app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668
  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/assets/' + 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/autocomplete-custom-dropdown.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/autocomplete-custom-dropdown.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. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.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/credential-form-modal.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. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. }
  1992. });
  1993. /***/ }),
  1994. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1995. /*!*********************************************************************************************************************************************************************!*\
  1996. !*** ./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& ***!
  1997. \*********************************************************************************************************************************************************************/
  1998. /*! exports provided: default */
  1999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2000. "use strict";
  2001. __webpack_require__.r(__webpack_exports__);
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. /* harmony default export */ __webpack_exports__["default"] = ({
  2034. props: ['credential', 'descriptions'],
  2035. data: function data() {
  2036. return {
  2037. data: this.credential,
  2038. creddescList: this.descriptions
  2039. };
  2040. },
  2041. mounted: function mounted() {
  2042. var _this = this;
  2043. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  2044. // This part could potentially use a refactor.
  2045. // Probably needs a credential list component to listen for this
  2046. // even and update the corresponding credential. Currently every
  2047. // credential on the page receives this event and checks whether it was intended
  2048. // for its credential or not. I would imagine this could cause a problem
  2049. // on the group page, which will potentially have a lot more credentials from
  2050. // various assets. Better solution may be to have a credentials list component
  2051. // That listens for credential update events and updates the appropriate credential.
  2052. // There would still be multiples of those on the group credentials page, but an
  2053. // order of magnitude less of those than of individual credentials.
  2054. // It also may not be a big deal performance wise to do it like this, not sure.
  2055. var eData = JSON.parse(e.data);
  2056. if (_this.data.credid === eData.credid) {
  2057. _this.data = eData;
  2058. }
  2059. });
  2060. }
  2061. });
  2062. /***/ }),
  2063. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2064. /*!********************************************************************************************************************************************************************!*\
  2065. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  2066. \********************************************************************************************************************************************************************/
  2067. /*! exports provided: default */
  2068. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2069. "use strict";
  2070. __webpack_require__.r(__webpack_exports__);
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. /* harmony default export */ __webpack_exports__["default"] = ({
  2077. props: ['errors'],
  2078. data: function data() {
  2079. return {
  2080. errorList: this.errors
  2081. };
  2082. },
  2083. watch: {
  2084. errors: function errors(newErrors) {
  2085. this.errorList = newErrors;
  2086. }
  2087. }
  2088. });
  2089. /***/ }),
  2090. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2091. /*!****************************************************************************************************************************************************************!*\
  2092. !*** ./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& ***!
  2093. \****************************************************************************************************************************************************************/
  2094. /*! exports provided: default */
  2095. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2096. "use strict";
  2097. __webpack_require__.r(__webpack_exports__);
  2098. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2099. //
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. //
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. //
  2129. //
  2130. //
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. /* harmony default export */ __webpack_exports__["default"] = ({
  2139. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2140. props: ['initialnotes', 'authusername'],
  2141. data: function data() {
  2142. return {
  2143. notes: this.initialnotes
  2144. };
  2145. }
  2146. });
  2147. /***/ }),
  2148. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  2149. /*!****************************************************************************************************************************************************************************!*\
  2150. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  2151. \****************************************************************************************************************************************************************************/
  2152. /*! exports provided: default */
  2153. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2154. "use strict";
  2155. __webpack_require__.r(__webpack_exports__);
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. /* harmony default export */ __webpack_exports__["default"] = ({
  2190. props: ['populateWith', 'storeList', 'modalId'],
  2191. data: function data() {
  2192. return {
  2193. // Copies object from prop, so it doesn't mutate the object
  2194. // from the parent component. Parent component will be updated via
  2195. // Websocket if updateWorkOrder is successful.
  2196. data: JSON.parse(JSON.stringify(this.populateWith)),
  2197. id: this.modalId,
  2198. store: {},
  2199. errors: []
  2200. };
  2201. },
  2202. mounted: function mounted() {
  2203. this.store = {
  2204. 'id': this.data.storeid,
  2205. 'name': this.storeList[this.data.storeid]
  2206. };
  2207. },
  2208. methods: {
  2209. updateWorkOrder: function updateWorkOrder() {
  2210. var _this = this;
  2211. this.data.storeid = this.store.id;
  2212. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2213. $('#workordereditModal').modal('hide');
  2214. })["catch"](function (error) {
  2215. _this.errors = JSON.parse(error.response.request.response).errors;
  2216. });
  2217. }
  2218. }
  2219. });
  2220. /***/ }),
  2221. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2222. /*!*****************************************************************************************************************************************************************!*\
  2223. !*** ./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& ***!
  2224. \*****************************************************************************************************************************************************************/
  2225. /*! exports provided: default */
  2226. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2227. "use strict";
  2228. __webpack_require__.r(__webpack_exports__);
  2229. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. //
  2240. //
  2241. //
  2242. //
  2243. //
  2244. //
  2245. //
  2246. //
  2247. //
  2248. //
  2249. //
  2250. /* harmony default export */ __webpack_exports__["default"] = ({
  2251. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2252. props: ['workOrder', 'stores'],
  2253. data: function data() {
  2254. return {
  2255. data: JSON.parse(this.workOrder)
  2256. };
  2257. },
  2258. computed: {
  2259. storeList: function storeList() {
  2260. var list = {};
  2261. JSON.parse(this.stores).map(function (val) {
  2262. list[val.storeid] = val.storesname;
  2263. });
  2264. return list;
  2265. }
  2266. },
  2267. mounted: function mounted() {
  2268. var _this = this;
  2269. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  2270. _this.data = JSON.parse(e.data);
  2271. });
  2272. }
  2273. });
  2274. /***/ }),
  2275. /***/ "./node_modules/base64-js/index.js":
  2276. /*!*****************************************!*\
  2277. !*** ./node_modules/base64-js/index.js ***!
  2278. \*****************************************/
  2279. /*! no static exports found */
  2280. /***/ (function(module, exports, __webpack_require__) {
  2281. "use strict";
  2282. exports.byteLength = byteLength
  2283. exports.toByteArray = toByteArray
  2284. exports.fromByteArray = fromByteArray
  2285. var lookup = []
  2286. var revLookup = []
  2287. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2288. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2289. for (var i = 0, len = code.length; i < len; ++i) {
  2290. lookup[i] = code[i]
  2291. revLookup[code.charCodeAt(i)] = i
  2292. }
  2293. // Support decoding URL-safe base64 strings, as Node.js does.
  2294. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2295. revLookup['-'.charCodeAt(0)] = 62
  2296. revLookup['_'.charCodeAt(0)] = 63
  2297. function getLens (b64) {
  2298. var len = b64.length
  2299. if (len % 4 > 0) {
  2300. throw new Error('Invalid string. Length must be a multiple of 4')
  2301. }
  2302. // Trim off extra bytes after placeholder bytes are found
  2303. // See: https://github.com/beatgammit/base64-js/issues/42
  2304. var validLen = b64.indexOf('=')
  2305. if (validLen === -1) validLen = len
  2306. var placeHoldersLen = validLen === len
  2307. ? 0
  2308. : 4 - (validLen % 4)
  2309. return [validLen, placeHoldersLen]
  2310. }
  2311. // base64 is 4/3 + up to two characters of the original data
  2312. function byteLength (b64) {
  2313. var lens = getLens(b64)
  2314. var validLen = lens[0]
  2315. var placeHoldersLen = lens[1]
  2316. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2317. }
  2318. function _byteLength (b64, validLen, placeHoldersLen) {
  2319. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2320. }
  2321. function toByteArray (b64) {
  2322. var tmp
  2323. var lens = getLens(b64)
  2324. var validLen = lens[0]
  2325. var placeHoldersLen = lens[1]
  2326. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2327. var curByte = 0
  2328. // if there are placeholders, only get up to the last complete 4 chars
  2329. var len = placeHoldersLen > 0
  2330. ? validLen - 4
  2331. : validLen
  2332. var i
  2333. for (i = 0; i < len; i += 4) {
  2334. tmp =
  2335. (revLookup[b64.charCodeAt(i)] << 18) |
  2336. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2337. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2338. revLookup[b64.charCodeAt(i + 3)]
  2339. arr[curByte++] = (tmp >> 16) & 0xFF
  2340. arr[curByte++] = (tmp >> 8) & 0xFF
  2341. arr[curByte++] = tmp & 0xFF
  2342. }
  2343. if (placeHoldersLen === 2) {
  2344. tmp =
  2345. (revLookup[b64.charCodeAt(i)] << 2) |
  2346. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2347. arr[curByte++] = tmp & 0xFF
  2348. }
  2349. if (placeHoldersLen === 1) {
  2350. tmp =
  2351. (revLookup[b64.charCodeAt(i)] << 10) |
  2352. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2353. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2354. arr[curByte++] = (tmp >> 8) & 0xFF
  2355. arr[curByte++] = tmp & 0xFF
  2356. }
  2357. return arr
  2358. }
  2359. function tripletToBase64 (num) {
  2360. return lookup[num >> 18 & 0x3F] +
  2361. lookup[num >> 12 & 0x3F] +
  2362. lookup[num >> 6 & 0x3F] +
  2363. lookup[num & 0x3F]
  2364. }
  2365. function encodeChunk (uint8, start, end) {
  2366. var tmp
  2367. var output = []
  2368. for (var i = start; i < end; i += 3) {
  2369. tmp =
  2370. ((uint8[i] << 16) & 0xFF0000) +
  2371. ((uint8[i + 1] << 8) & 0xFF00) +
  2372. (uint8[i + 2] & 0xFF)
  2373. output.push(tripletToBase64(tmp))
  2374. }
  2375. return output.join('')
  2376. }
  2377. function fromByteArray (uint8) {
  2378. var tmp
  2379. var len = uint8.length
  2380. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2381. var parts = []
  2382. var maxChunkLength = 16383 // must be multiple of 3
  2383. // go through the array every three bytes, we'll deal with trailing stuff later
  2384. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2385. parts.push(encodeChunk(
  2386. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2387. ))
  2388. }
  2389. // pad the end with zeros, but make sure to not forget the extra bytes
  2390. if (extraBytes === 1) {
  2391. tmp = uint8[len - 1]
  2392. parts.push(
  2393. lookup[tmp >> 2] +
  2394. lookup[(tmp << 4) & 0x3F] +
  2395. '=='
  2396. )
  2397. } else if (extraBytes === 2) {
  2398. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2399. parts.push(
  2400. lookup[tmp >> 10] +
  2401. lookup[(tmp >> 4) & 0x3F] +
  2402. lookup[(tmp << 2) & 0x3F] +
  2403. '='
  2404. )
  2405. }
  2406. return parts.join('')
  2407. }
  2408. /***/ }),
  2409. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2410. /*!*****************************************************!*\
  2411. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2412. \*****************************************************/
  2413. /*! no static exports found */
  2414. /***/ (function(module, exports, __webpack_require__) {
  2415. /*!
  2416. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2417. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2418. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2419. */
  2420. (function (global, factory) {
  2421. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2422. undefined;
  2423. }(this, (function (exports, $, Popper) { 'use strict';
  2424. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2425. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2426. function _defineProperties(target, props) {
  2427. for (var i = 0; i < props.length; i++) {
  2428. var descriptor = props[i];
  2429. descriptor.enumerable = descriptor.enumerable || false;
  2430. descriptor.configurable = true;
  2431. if ("value" in descriptor) descriptor.writable = true;
  2432. Object.defineProperty(target, descriptor.key, descriptor);
  2433. }
  2434. }
  2435. function _createClass(Constructor, protoProps, staticProps) {
  2436. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2437. if (staticProps) _defineProperties(Constructor, staticProps);
  2438. return Constructor;
  2439. }
  2440. function _defineProperty(obj, key, value) {
  2441. if (key in obj) {
  2442. Object.defineProperty(obj, key, {
  2443. value: value,
  2444. enumerable: true,
  2445. configurable: true,
  2446. writable: true
  2447. });
  2448. } else {
  2449. obj[key] = value;
  2450. }
  2451. return obj;
  2452. }
  2453. function ownKeys(object, enumerableOnly) {
  2454. var keys = Object.keys(object);
  2455. if (Object.getOwnPropertySymbols) {
  2456. var symbols = Object.getOwnPropertySymbols(object);
  2457. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2458. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2459. });
  2460. keys.push.apply(keys, symbols);
  2461. }
  2462. return keys;
  2463. }
  2464. function _objectSpread2(target) {
  2465. for (var i = 1; i < arguments.length; i++) {
  2466. var source = arguments[i] != null ? arguments[i] : {};
  2467. if (i % 2) {
  2468. ownKeys(Object(source), true).forEach(function (key) {
  2469. _defineProperty(target, key, source[key]);
  2470. });
  2471. } else if (Object.getOwnPropertyDescriptors) {
  2472. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2473. } else {
  2474. ownKeys(Object(source)).forEach(function (key) {
  2475. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2476. });
  2477. }
  2478. }
  2479. return target;
  2480. }
  2481. function _inheritsLoose(subClass, superClass) {
  2482. subClass.prototype = Object.create(superClass.prototype);
  2483. subClass.prototype.constructor = subClass;
  2484. subClass.__proto__ = superClass;
  2485. }
  2486. /**
  2487. * --------------------------------------------------------------------------
  2488. * Bootstrap (v4.4.1): util.js
  2489. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2490. * --------------------------------------------------------------------------
  2491. */
  2492. /**
  2493. * ------------------------------------------------------------------------
  2494. * Private TransitionEnd Helpers
  2495. * ------------------------------------------------------------------------
  2496. */
  2497. var TRANSITION_END = 'transitionend';
  2498. var MAX_UID = 1000000;
  2499. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2500. function toType(obj) {
  2501. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2502. }
  2503. function getSpecialTransitionEndEvent() {
  2504. return {
  2505. bindType: TRANSITION_END,
  2506. delegateType: TRANSITION_END,
  2507. handle: function handle(event) {
  2508. if ($(event.target).is(this)) {
  2509. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2510. }
  2511. return undefined; // eslint-disable-line no-undefined
  2512. }
  2513. };
  2514. }
  2515. function transitionEndEmulator(duration) {
  2516. var _this = this;
  2517. var called = false;
  2518. $(this).one(Util.TRANSITION_END, function () {
  2519. called = true;
  2520. });
  2521. setTimeout(function () {
  2522. if (!called) {
  2523. Util.triggerTransitionEnd(_this);
  2524. }
  2525. }, duration);
  2526. return this;
  2527. }
  2528. function setTransitionEndSupport() {
  2529. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2530. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2531. }
  2532. /**
  2533. * --------------------------------------------------------------------------
  2534. * Public Util Api
  2535. * --------------------------------------------------------------------------
  2536. */
  2537. var Util = {
  2538. TRANSITION_END: 'bsTransitionEnd',
  2539. getUID: function getUID(prefix) {
  2540. do {
  2541. // eslint-disable-next-line no-bitwise
  2542. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2543. } while (document.getElementById(prefix));
  2544. return prefix;
  2545. },
  2546. getSelectorFromElement: function getSelectorFromElement(element) {
  2547. var selector = element.getAttribute('data-target');
  2548. if (!selector || selector === '#') {
  2549. var hrefAttr = element.getAttribute('href');
  2550. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2551. }
  2552. try {
  2553. return document.querySelector(selector) ? selector : null;
  2554. } catch (err) {
  2555. return null;
  2556. }
  2557. },
  2558. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2559. if (!element) {
  2560. return 0;
  2561. } // Get transition-duration of the element
  2562. var transitionDuration = $(element).css('transition-duration');
  2563. var transitionDelay = $(element).css('transition-delay');
  2564. var floatTransitionDuration = parseFloat(transitionDuration);
  2565. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2566. if (!floatTransitionDuration && !floatTransitionDelay) {
  2567. return 0;
  2568. } // If multiple durations are defined, take the first
  2569. transitionDuration = transitionDuration.split(',')[0];
  2570. transitionDelay = transitionDelay.split(',')[0];
  2571. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2572. },
  2573. reflow: function reflow(element) {
  2574. return element.offsetHeight;
  2575. },
  2576. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2577. $(element).trigger(TRANSITION_END);
  2578. },
  2579. // TODO: Remove in v5
  2580. supportsTransitionEnd: function supportsTransitionEnd() {
  2581. return Boolean(TRANSITION_END);
  2582. },
  2583. isElement: function isElement(obj) {
  2584. return (obj[0] || obj).nodeType;
  2585. },
  2586. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2587. for (var property in configTypes) {
  2588. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2589. var expectedTypes = configTypes[property];
  2590. var value = config[property];
  2591. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2592. if (!new RegExp(expectedTypes).test(valueType)) {
  2593. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2594. }
  2595. }
  2596. }
  2597. },
  2598. findShadowRoot: function findShadowRoot(element) {
  2599. if (!document.documentElement.attachShadow) {
  2600. return null;
  2601. } // Can find the shadow root otherwise it'll return the document
  2602. if (typeof element.getRootNode === 'function') {
  2603. var root = element.getRootNode();
  2604. return root instanceof ShadowRoot ? root : null;
  2605. }
  2606. if (element instanceof ShadowRoot) {
  2607. return element;
  2608. } // when we don't find a shadow root
  2609. if (!element.parentNode) {
  2610. return null;
  2611. }
  2612. return Util.findShadowRoot(element.parentNode);
  2613. },
  2614. jQueryDetection: function jQueryDetection() {
  2615. if (typeof $ === 'undefined') {
  2616. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2617. }
  2618. var version = $.fn.jquery.split(' ')[0].split('.');
  2619. var minMajor = 1;
  2620. var ltMajor = 2;
  2621. var minMinor = 9;
  2622. var minPatch = 1;
  2623. var maxMajor = 4;
  2624. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2625. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2626. }
  2627. }
  2628. };
  2629. Util.jQueryDetection();
  2630. setTransitionEndSupport();
  2631. /**
  2632. * ------------------------------------------------------------------------
  2633. * Constants
  2634. * ------------------------------------------------------------------------
  2635. */
  2636. var NAME = 'alert';
  2637. var VERSION = '4.4.1';
  2638. var DATA_KEY = 'bs.alert';
  2639. var EVENT_KEY = "." + DATA_KEY;
  2640. var DATA_API_KEY = '.data-api';
  2641. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2642. var Selector = {
  2643. DISMISS: '[data-dismiss="alert"]'
  2644. };
  2645. var Event = {
  2646. CLOSE: "close" + EVENT_KEY,
  2647. CLOSED: "closed" + EVENT_KEY,
  2648. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2649. };
  2650. var ClassName = {
  2651. ALERT: 'alert',
  2652. FADE: 'fade',
  2653. SHOW: 'show'
  2654. };
  2655. /**
  2656. * ------------------------------------------------------------------------
  2657. * Class Definition
  2658. * ------------------------------------------------------------------------
  2659. */
  2660. var Alert =
  2661. /*#__PURE__*/
  2662. function () {
  2663. function Alert(element) {
  2664. this._element = element;
  2665. } // Getters
  2666. var _proto = Alert.prototype;
  2667. // Public
  2668. _proto.close = function close(element) {
  2669. var rootElement = this._element;
  2670. if (element) {
  2671. rootElement = this._getRootElement(element);
  2672. }
  2673. var customEvent = this._triggerCloseEvent(rootElement);
  2674. if (customEvent.isDefaultPrevented()) {
  2675. return;
  2676. }
  2677. this._removeElement(rootElement);
  2678. };
  2679. _proto.dispose = function dispose() {
  2680. $.removeData(this._element, DATA_KEY);
  2681. this._element = null;
  2682. } // Private
  2683. ;
  2684. _proto._getRootElement = function _getRootElement(element) {
  2685. var selector = Util.getSelectorFromElement(element);
  2686. var parent = false;
  2687. if (selector) {
  2688. parent = document.querySelector(selector);
  2689. }
  2690. if (!parent) {
  2691. parent = $(element).closest("." + ClassName.ALERT)[0];
  2692. }
  2693. return parent;
  2694. };
  2695. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2696. var closeEvent = $.Event(Event.CLOSE);
  2697. $(element).trigger(closeEvent);
  2698. return closeEvent;
  2699. };
  2700. _proto._removeElement = function _removeElement(element) {
  2701. var _this = this;
  2702. $(element).removeClass(ClassName.SHOW);
  2703. if (!$(element).hasClass(ClassName.FADE)) {
  2704. this._destroyElement(element);
  2705. return;
  2706. }
  2707. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2708. $(element).one(Util.TRANSITION_END, function (event) {
  2709. return _this._destroyElement(element, event);
  2710. }).emulateTransitionEnd(transitionDuration);
  2711. };
  2712. _proto._destroyElement = function _destroyElement(element) {
  2713. $(element).detach().trigger(Event.CLOSED).remove();
  2714. } // Static
  2715. ;
  2716. Alert._jQueryInterface = function _jQueryInterface(config) {
  2717. return this.each(function () {
  2718. var $element = $(this);
  2719. var data = $element.data(DATA_KEY);
  2720. if (!data) {
  2721. data = new Alert(this);
  2722. $element.data(DATA_KEY, data);
  2723. }
  2724. if (config === 'close') {
  2725. data[config](this);
  2726. }
  2727. });
  2728. };
  2729. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2730. return function (event) {
  2731. if (event) {
  2732. event.preventDefault();
  2733. }
  2734. alertInstance.close(this);
  2735. };
  2736. };
  2737. _createClass(Alert, null, [{
  2738. key: "VERSION",
  2739. get: function get() {
  2740. return VERSION;
  2741. }
  2742. }]);
  2743. return Alert;
  2744. }();
  2745. /**
  2746. * ------------------------------------------------------------------------
  2747. * Data Api implementation
  2748. * ------------------------------------------------------------------------
  2749. */
  2750. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2751. /**
  2752. * ------------------------------------------------------------------------
  2753. * jQuery
  2754. * ------------------------------------------------------------------------
  2755. */
  2756. $.fn[NAME] = Alert._jQueryInterface;
  2757. $.fn[NAME].Constructor = Alert;
  2758. $.fn[NAME].noConflict = function () {
  2759. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2760. return Alert._jQueryInterface;
  2761. };
  2762. /**
  2763. * ------------------------------------------------------------------------
  2764. * Constants
  2765. * ------------------------------------------------------------------------
  2766. */
  2767. var NAME$1 = 'button';
  2768. var VERSION$1 = '4.4.1';
  2769. var DATA_KEY$1 = 'bs.button';
  2770. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2771. var DATA_API_KEY$1 = '.data-api';
  2772. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2773. var ClassName$1 = {
  2774. ACTIVE: 'active',
  2775. BUTTON: 'btn',
  2776. FOCUS: 'focus'
  2777. };
  2778. var Selector$1 = {
  2779. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2780. DATA_TOGGLES: '[data-toggle="buttons"]',
  2781. DATA_TOGGLE: '[data-toggle="button"]',
  2782. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2783. INPUT: 'input:not([type="hidden"])',
  2784. ACTIVE: '.active',
  2785. BUTTON: '.btn'
  2786. };
  2787. var Event$1 = {
  2788. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2789. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2790. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2791. };
  2792. /**
  2793. * ------------------------------------------------------------------------
  2794. * Class Definition
  2795. * ------------------------------------------------------------------------
  2796. */
  2797. var Button =
  2798. /*#__PURE__*/
  2799. function () {
  2800. function Button(element) {
  2801. this._element = element;
  2802. } // Getters
  2803. var _proto = Button.prototype;
  2804. // Public
  2805. _proto.toggle = function toggle() {
  2806. var triggerChangeEvent = true;
  2807. var addAriaPressed = true;
  2808. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2809. if (rootElement) {
  2810. var input = this._element.querySelector(Selector$1.INPUT);
  2811. if (input) {
  2812. if (input.type === 'radio') {
  2813. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2814. triggerChangeEvent = false;
  2815. } else {
  2816. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2817. if (activeElement) {
  2818. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2819. }
  2820. }
  2821. } else if (input.type === 'checkbox') {
  2822. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2823. triggerChangeEvent = false;
  2824. }
  2825. } else {
  2826. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2827. triggerChangeEvent = false;
  2828. }
  2829. if (triggerChangeEvent) {
  2830. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2831. $(input).trigger('change');
  2832. }
  2833. input.focus();
  2834. addAriaPressed = false;
  2835. }
  2836. }
  2837. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2838. if (addAriaPressed) {
  2839. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2840. }
  2841. if (triggerChangeEvent) {
  2842. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2843. }
  2844. }
  2845. };
  2846. _proto.dispose = function dispose() {
  2847. $.removeData(this._element, DATA_KEY$1);
  2848. this._element = null;
  2849. } // Static
  2850. ;
  2851. Button._jQueryInterface = function _jQueryInterface(config) {
  2852. return this.each(function () {
  2853. var data = $(this).data(DATA_KEY$1);
  2854. if (!data) {
  2855. data = new Button(this);
  2856. $(this).data(DATA_KEY$1, data);
  2857. }
  2858. if (config === 'toggle') {
  2859. data[config]();
  2860. }
  2861. });
  2862. };
  2863. _createClass(Button, null, [{
  2864. key: "VERSION",
  2865. get: function get() {
  2866. return VERSION$1;
  2867. }
  2868. }]);
  2869. return Button;
  2870. }();
  2871. /**
  2872. * ------------------------------------------------------------------------
  2873. * Data Api implementation
  2874. * ------------------------------------------------------------------------
  2875. */
  2876. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2877. var button = event.target;
  2878. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2879. button = $(button).closest(Selector$1.BUTTON)[0];
  2880. }
  2881. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2882. event.preventDefault(); // work around Firefox bug #1540995
  2883. } else {
  2884. var inputBtn = button.querySelector(Selector$1.INPUT);
  2885. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2886. event.preventDefault(); // work around Firefox bug #1540995
  2887. return;
  2888. }
  2889. Button._jQueryInterface.call($(button), 'toggle');
  2890. }
  2891. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2892. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2893. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2894. });
  2895. $(window).on(Event$1.LOAD_DATA_API, function () {
  2896. // ensure correct active class is set to match the controls' actual values/states
  2897. // find all checkboxes/readio buttons inside data-toggle groups
  2898. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2899. for (var i = 0, len = buttons.length; i < len; i++) {
  2900. var button = buttons[i];
  2901. var input = button.querySelector(Selector$1.INPUT);
  2902. if (input.checked || input.hasAttribute('checked')) {
  2903. button.classList.add(ClassName$1.ACTIVE);
  2904. } else {
  2905. button.classList.remove(ClassName$1.ACTIVE);
  2906. }
  2907. } // find all button toggles
  2908. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2909. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2910. var _button = buttons[_i];
  2911. if (_button.getAttribute('aria-pressed') === 'true') {
  2912. _button.classList.add(ClassName$1.ACTIVE);
  2913. } else {
  2914. _button.classList.remove(ClassName$1.ACTIVE);
  2915. }
  2916. }
  2917. });
  2918. /**
  2919. * ------------------------------------------------------------------------
  2920. * jQuery
  2921. * ------------------------------------------------------------------------
  2922. */
  2923. $.fn[NAME$1] = Button._jQueryInterface;
  2924. $.fn[NAME$1].Constructor = Button;
  2925. $.fn[NAME$1].noConflict = function () {
  2926. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2927. return Button._jQueryInterface;
  2928. };
  2929. /**
  2930. * ------------------------------------------------------------------------
  2931. * Constants
  2932. * ------------------------------------------------------------------------
  2933. */
  2934. var NAME$2 = 'carousel';
  2935. var VERSION$2 = '4.4.1';
  2936. var DATA_KEY$2 = 'bs.carousel';
  2937. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2938. var DATA_API_KEY$2 = '.data-api';
  2939. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2940. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2941. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2942. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2943. var SWIPE_THRESHOLD = 40;
  2944. var Default = {
  2945. interval: 5000,
  2946. keyboard: true,
  2947. slide: false,
  2948. pause: 'hover',
  2949. wrap: true,
  2950. touch: true
  2951. };
  2952. var DefaultType = {
  2953. interval: '(number|boolean)',
  2954. keyboard: 'boolean',
  2955. slide: '(boolean|string)',
  2956. pause: '(string|boolean)',
  2957. wrap: 'boolean',
  2958. touch: 'boolean'
  2959. };
  2960. var Direction = {
  2961. NEXT: 'next',
  2962. PREV: 'prev',
  2963. LEFT: 'left',
  2964. RIGHT: 'right'
  2965. };
  2966. var Event$2 = {
  2967. SLIDE: "slide" + EVENT_KEY$2,
  2968. SLID: "slid" + EVENT_KEY$2,
  2969. KEYDOWN: "keydown" + EVENT_KEY$2,
  2970. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2971. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2972. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2973. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2974. TOUCHEND: "touchend" + EVENT_KEY$2,
  2975. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2976. POINTERUP: "pointerup" + EVENT_KEY$2,
  2977. DRAG_START: "dragstart" + EVENT_KEY$2,
  2978. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2979. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2980. };
  2981. var ClassName$2 = {
  2982. CAROUSEL: 'carousel',
  2983. ACTIVE: 'active',
  2984. SLIDE: 'slide',
  2985. RIGHT: 'carousel-item-right',
  2986. LEFT: 'carousel-item-left',
  2987. NEXT: 'carousel-item-next',
  2988. PREV: 'carousel-item-prev',
  2989. ITEM: 'carousel-item',
  2990. POINTER_EVENT: 'pointer-event'
  2991. };
  2992. var Selector$2 = {
  2993. ACTIVE: '.active',
  2994. ACTIVE_ITEM: '.active.carousel-item',
  2995. ITEM: '.carousel-item',
  2996. ITEM_IMG: '.carousel-item img',
  2997. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2998. INDICATORS: '.carousel-indicators',
  2999. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3000. DATA_RIDE: '[data-ride="carousel"]'
  3001. };
  3002. var PointerType = {
  3003. TOUCH: 'touch',
  3004. PEN: 'pen'
  3005. };
  3006. /**
  3007. * ------------------------------------------------------------------------
  3008. * Class Definition
  3009. * ------------------------------------------------------------------------
  3010. */
  3011. var Carousel =
  3012. /*#__PURE__*/
  3013. function () {
  3014. function Carousel(element, config) {
  3015. this._items = null;
  3016. this._interval = null;
  3017. this._activeElement = null;
  3018. this._isPaused = false;
  3019. this._isSliding = false;
  3020. this.touchTimeout = null;
  3021. this.touchStartX = 0;
  3022. this.touchDeltaX = 0;
  3023. this._config = this._getConfig(config);
  3024. this._element = element;
  3025. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3026. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3027. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3028. this._addEventListeners();
  3029. } // Getters
  3030. var _proto = Carousel.prototype;
  3031. // Public
  3032. _proto.next = function next() {
  3033. if (!this._isSliding) {
  3034. this._slide(Direction.NEXT);
  3035. }
  3036. };
  3037. _proto.nextWhenVisible = function nextWhenVisible() {
  3038. // Don't call next when the page isn't visible
  3039. // or the carousel or its parent isn't visible
  3040. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3041. this.next();
  3042. }
  3043. };
  3044. _proto.prev = function prev() {
  3045. if (!this._isSliding) {
  3046. this._slide(Direction.PREV);
  3047. }
  3048. };
  3049. _proto.pause = function pause(event) {
  3050. if (!event) {
  3051. this._isPaused = true;
  3052. }
  3053. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3054. Util.triggerTransitionEnd(this._element);
  3055. this.cycle(true);
  3056. }
  3057. clearInterval(this._interval);
  3058. this._interval = null;
  3059. };
  3060. _proto.cycle = function cycle(event) {
  3061. if (!event) {
  3062. this._isPaused = false;
  3063. }
  3064. if (this._interval) {
  3065. clearInterval(this._interval);
  3066. this._interval = null;
  3067. }
  3068. if (this._config.interval && !this._isPaused) {
  3069. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3070. }
  3071. };
  3072. _proto.to = function to(index) {
  3073. var _this = this;
  3074. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3075. var activeIndex = this._getItemIndex(this._activeElement);
  3076. if (index > this._items.length - 1 || index < 0) {
  3077. return;
  3078. }
  3079. if (this._isSliding) {
  3080. $(this._element).one(Event$2.SLID, function () {
  3081. return _this.to(index);
  3082. });
  3083. return;
  3084. }
  3085. if (activeIndex === index) {
  3086. this.pause();
  3087. this.cycle();
  3088. return;
  3089. }
  3090. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3091. this._slide(direction, this._items[index]);
  3092. };
  3093. _proto.dispose = function dispose() {
  3094. $(this._element).off(EVENT_KEY$2);
  3095. $.removeData(this._element, DATA_KEY$2);
  3096. this._items = null;
  3097. this._config = null;
  3098. this._element = null;
  3099. this._interval = null;
  3100. this._isPaused = null;
  3101. this._isSliding = null;
  3102. this._activeElement = null;
  3103. this._indicatorsElement = null;
  3104. } // Private
  3105. ;
  3106. _proto._getConfig = function _getConfig(config) {
  3107. config = _objectSpread2({}, Default, {}, config);
  3108. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3109. return config;
  3110. };
  3111. _proto._handleSwipe = function _handleSwipe() {
  3112. var absDeltax = Math.abs(this.touchDeltaX);
  3113. if (absDeltax <= SWIPE_THRESHOLD) {
  3114. return;
  3115. }
  3116. var direction = absDeltax / this.touchDeltaX;
  3117. this.touchDeltaX = 0; // swipe left
  3118. if (direction > 0) {
  3119. this.prev();
  3120. } // swipe right
  3121. if (direction < 0) {
  3122. this.next();
  3123. }
  3124. };
  3125. _proto._addEventListeners = function _addEventListeners() {
  3126. var _this2 = this;
  3127. if (this._config.keyboard) {
  3128. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3129. return _this2._keydown(event);
  3130. });
  3131. }
  3132. if (this._config.pause === 'hover') {
  3133. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3134. return _this2.pause(event);
  3135. }).on(Event$2.MOUSELEAVE, function (event) {
  3136. return _this2.cycle(event);
  3137. });
  3138. }
  3139. if (this._config.touch) {
  3140. this._addTouchEventListeners();
  3141. }
  3142. };
  3143. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3144. var _this3 = this;
  3145. if (!this._touchSupported) {
  3146. return;
  3147. }
  3148. var start = function start(event) {
  3149. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3150. _this3.touchStartX = event.originalEvent.clientX;
  3151. } else if (!_this3._pointerEvent) {
  3152. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3153. }
  3154. };
  3155. var move = function move(event) {
  3156. // ensure swiping with one touch and not pinching
  3157. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3158. _this3.touchDeltaX = 0;
  3159. } else {
  3160. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3161. }
  3162. };
  3163. var end = function end(event) {
  3164. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3165. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3166. }
  3167. _this3._handleSwipe();
  3168. if (_this3._config.pause === 'hover') {
  3169. // If it's a touch-enabled device, mouseenter/leave are fired as
  3170. // part of the mouse compatibility events on first tap - the carousel
  3171. // would stop cycling until user tapped out of it;
  3172. // here, we listen for touchend, explicitly pause the carousel
  3173. // (as if it's the second time we tap on it, mouseenter compat event
  3174. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3175. // events to fire) we explicitly restart cycling
  3176. _this3.pause();
  3177. if (_this3.touchTimeout) {
  3178. clearTimeout(_this3.touchTimeout);
  3179. }
  3180. _this3.touchTimeout = setTimeout(function (event) {
  3181. return _this3.cycle(event);
  3182. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3183. }
  3184. };
  3185. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3186. return e.preventDefault();
  3187. });
  3188. if (this._pointerEvent) {
  3189. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3190. return start(event);
  3191. });
  3192. $(this._element).on(Event$2.POINTERUP, function (event) {
  3193. return end(event);
  3194. });
  3195. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3196. } else {
  3197. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3198. return start(event);
  3199. });
  3200. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3201. return move(event);
  3202. });
  3203. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3204. return end(event);
  3205. });
  3206. }
  3207. };
  3208. _proto._keydown = function _keydown(event) {
  3209. if (/input|textarea/i.test(event.target.tagName)) {
  3210. return;
  3211. }
  3212. switch (event.which) {
  3213. case ARROW_LEFT_KEYCODE:
  3214. event.preventDefault();
  3215. this.prev();
  3216. break;
  3217. case ARROW_RIGHT_KEYCODE:
  3218. event.preventDefault();
  3219. this.next();
  3220. break;
  3221. }
  3222. };
  3223. _proto._getItemIndex = function _getItemIndex(element) {
  3224. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3225. return this._items.indexOf(element);
  3226. };
  3227. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3228. var isNextDirection = direction === Direction.NEXT;
  3229. var isPrevDirection = direction === Direction.PREV;
  3230. var activeIndex = this._getItemIndex(activeElement);
  3231. var lastItemIndex = this._items.length - 1;
  3232. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3233. if (isGoingToWrap && !this._config.wrap) {
  3234. return activeElement;
  3235. }
  3236. var delta = direction === Direction.PREV ? -1 : 1;
  3237. var itemIndex = (activeIndex + delta) % this._items.length;
  3238. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3239. };
  3240. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3241. var targetIndex = this._getItemIndex(relatedTarget);
  3242. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3243. var slideEvent = $.Event(Event$2.SLIDE, {
  3244. relatedTarget: relatedTarget,
  3245. direction: eventDirectionName,
  3246. from: fromIndex,
  3247. to: targetIndex
  3248. });
  3249. $(this._element).trigger(slideEvent);
  3250. return slideEvent;
  3251. };
  3252. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3253. if (this._indicatorsElement) {
  3254. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3255. $(indicators).removeClass(ClassName$2.ACTIVE);
  3256. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3257. if (nextIndicator) {
  3258. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3259. }
  3260. }
  3261. };
  3262. _proto._slide = function _slide(direction, element) {
  3263. var _this4 = this;
  3264. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3265. var activeElementIndex = this._getItemIndex(activeElement);
  3266. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3267. var nextElementIndex = this._getItemIndex(nextElement);
  3268. var isCycling = Boolean(this._interval);
  3269. var directionalClassName;
  3270. var orderClassName;
  3271. var eventDirectionName;
  3272. if (direction === Direction.NEXT) {
  3273. directionalClassName = ClassName$2.LEFT;
  3274. orderClassName = ClassName$2.NEXT;
  3275. eventDirectionName = Direction.LEFT;
  3276. } else {
  3277. directionalClassName = ClassName$2.RIGHT;
  3278. orderClassName = ClassName$2.PREV;
  3279. eventDirectionName = Direction.RIGHT;
  3280. }
  3281. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3282. this._isSliding = false;
  3283. return;
  3284. }
  3285. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3286. if (slideEvent.isDefaultPrevented()) {
  3287. return;
  3288. }
  3289. if (!activeElement || !nextElement) {
  3290. // Some weirdness is happening, so we bail
  3291. return;
  3292. }
  3293. this._isSliding = true;
  3294. if (isCycling) {
  3295. this.pause();
  3296. }
  3297. this._setActiveIndicatorElement(nextElement);
  3298. var slidEvent = $.Event(Event$2.SLID, {
  3299. relatedTarget: nextElement,
  3300. direction: eventDirectionName,
  3301. from: activeElementIndex,
  3302. to: nextElementIndex
  3303. });
  3304. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3305. $(nextElement).addClass(orderClassName);
  3306. Util.reflow(nextElement);
  3307. $(activeElement).addClass(directionalClassName);
  3308. $(nextElement).addClass(directionalClassName);
  3309. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3310. if (nextElementInterval) {
  3311. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3312. this._config.interval = nextElementInterval;
  3313. } else {
  3314. this._config.interval = this._config.defaultInterval || this._config.interval;
  3315. }
  3316. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3317. $(activeElement).one(Util.TRANSITION_END, function () {
  3318. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3319. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3320. _this4._isSliding = false;
  3321. setTimeout(function () {
  3322. return $(_this4._element).trigger(slidEvent);
  3323. }, 0);
  3324. }).emulateTransitionEnd(transitionDuration);
  3325. } else {
  3326. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3327. $(nextElement).addClass(ClassName$2.ACTIVE);
  3328. this._isSliding = false;
  3329. $(this._element).trigger(slidEvent);
  3330. }
  3331. if (isCycling) {
  3332. this.cycle();
  3333. }
  3334. } // Static
  3335. ;
  3336. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3337. return this.each(function () {
  3338. var data = $(this).data(DATA_KEY$2);
  3339. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3340. if (typeof config === 'object') {
  3341. _config = _objectSpread2({}, _config, {}, config);
  3342. }
  3343. var action = typeof config === 'string' ? config : _config.slide;
  3344. if (!data) {
  3345. data = new Carousel(this, _config);
  3346. $(this).data(DATA_KEY$2, data);
  3347. }
  3348. if (typeof config === 'number') {
  3349. data.to(config);
  3350. } else if (typeof action === 'string') {
  3351. if (typeof data[action] === 'undefined') {
  3352. throw new TypeError("No method named \"" + action + "\"");
  3353. }
  3354. data[action]();
  3355. } else if (_config.interval && _config.ride) {
  3356. data.pause();
  3357. data.cycle();
  3358. }
  3359. });
  3360. };
  3361. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3362. var selector = Util.getSelectorFromElement(this);
  3363. if (!selector) {
  3364. return;
  3365. }
  3366. var target = $(selector)[0];
  3367. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3368. return;
  3369. }
  3370. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3371. var slideIndex = this.getAttribute('data-slide-to');
  3372. if (slideIndex) {
  3373. config.interval = false;
  3374. }
  3375. Carousel._jQueryInterface.call($(target), config);
  3376. if (slideIndex) {
  3377. $(target).data(DATA_KEY$2).to(slideIndex);
  3378. }
  3379. event.preventDefault();
  3380. };
  3381. _createClass(Carousel, null, [{
  3382. key: "VERSION",
  3383. get: function get() {
  3384. return VERSION$2;
  3385. }
  3386. }, {
  3387. key: "Default",
  3388. get: function get() {
  3389. return Default;
  3390. }
  3391. }]);
  3392. return Carousel;
  3393. }();
  3394. /**
  3395. * ------------------------------------------------------------------------
  3396. * Data Api implementation
  3397. * ------------------------------------------------------------------------
  3398. */
  3399. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3400. $(window).on(Event$2.LOAD_DATA_API, function () {
  3401. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3402. for (var i = 0, len = carousels.length; i < len; i++) {
  3403. var $carousel = $(carousels[i]);
  3404. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3405. }
  3406. });
  3407. /**
  3408. * ------------------------------------------------------------------------
  3409. * jQuery
  3410. * ------------------------------------------------------------------------
  3411. */
  3412. $.fn[NAME$2] = Carousel._jQueryInterface;
  3413. $.fn[NAME$2].Constructor = Carousel;
  3414. $.fn[NAME$2].noConflict = function () {
  3415. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3416. return Carousel._jQueryInterface;
  3417. };
  3418. /**
  3419. * ------------------------------------------------------------------------
  3420. * Constants
  3421. * ------------------------------------------------------------------------
  3422. */
  3423. var NAME$3 = 'collapse';
  3424. var VERSION$3 = '4.4.1';
  3425. var DATA_KEY$3 = 'bs.collapse';
  3426. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3427. var DATA_API_KEY$3 = '.data-api';
  3428. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3429. var Default$1 = {
  3430. toggle: true,
  3431. parent: ''
  3432. };
  3433. var DefaultType$1 = {
  3434. toggle: 'boolean',
  3435. parent: '(string|element)'
  3436. };
  3437. var Event$3 = {
  3438. SHOW: "show" + EVENT_KEY$3,
  3439. SHOWN: "shown" + EVENT_KEY$3,
  3440. HIDE: "hide" + EVENT_KEY$3,
  3441. HIDDEN: "hidden" + EVENT_KEY$3,
  3442. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3443. };
  3444. var ClassName$3 = {
  3445. SHOW: 'show',
  3446. COLLAPSE: 'collapse',
  3447. COLLAPSING: 'collapsing',
  3448. COLLAPSED: 'collapsed'
  3449. };
  3450. var Dimension = {
  3451. WIDTH: 'width',
  3452. HEIGHT: 'height'
  3453. };
  3454. var Selector$3 = {
  3455. ACTIVES: '.show, .collapsing',
  3456. DATA_TOGGLE: '[data-toggle="collapse"]'
  3457. };
  3458. /**
  3459. * ------------------------------------------------------------------------
  3460. * Class Definition
  3461. * ------------------------------------------------------------------------
  3462. */
  3463. var Collapse =
  3464. /*#__PURE__*/
  3465. function () {
  3466. function Collapse(element, config) {
  3467. this._isTransitioning = false;
  3468. this._element = element;
  3469. this._config = this._getConfig(config);
  3470. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3471. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3472. for (var i = 0, len = toggleList.length; i < len; i++) {
  3473. var elem = toggleList[i];
  3474. var selector = Util.getSelectorFromElement(elem);
  3475. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3476. return foundElem === element;
  3477. });
  3478. if (selector !== null && filterElement.length > 0) {
  3479. this._selector = selector;
  3480. this._triggerArray.push(elem);
  3481. }
  3482. }
  3483. this._parent = this._config.parent ? this._getParent() : null;
  3484. if (!this._config.parent) {
  3485. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3486. }
  3487. if (this._config.toggle) {
  3488. this.toggle();
  3489. }
  3490. } // Getters
  3491. var _proto = Collapse.prototype;
  3492. // Public
  3493. _proto.toggle = function toggle() {
  3494. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3495. this.hide();
  3496. } else {
  3497. this.show();
  3498. }
  3499. };
  3500. _proto.show = function show() {
  3501. var _this = this;
  3502. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3503. return;
  3504. }
  3505. var actives;
  3506. var activesData;
  3507. if (this._parent) {
  3508. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3509. if (typeof _this._config.parent === 'string') {
  3510. return elem.getAttribute('data-parent') === _this._config.parent;
  3511. }
  3512. return elem.classList.contains(ClassName$3.COLLAPSE);
  3513. });
  3514. if (actives.length === 0) {
  3515. actives = null;
  3516. }
  3517. }
  3518. if (actives) {
  3519. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3520. if (activesData && activesData._isTransitioning) {
  3521. return;
  3522. }
  3523. }
  3524. var startEvent = $.Event(Event$3.SHOW);
  3525. $(this._element).trigger(startEvent);
  3526. if (startEvent.isDefaultPrevented()) {
  3527. return;
  3528. }
  3529. if (actives) {
  3530. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3531. if (!activesData) {
  3532. $(actives).data(DATA_KEY$3, null);
  3533. }
  3534. }
  3535. var dimension = this._getDimension();
  3536. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3537. this._element.style[dimension] = 0;
  3538. if (this._triggerArray.length) {
  3539. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3540. }
  3541. this.setTransitioning(true);
  3542. var complete = function complete() {
  3543. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3544. _this._element.style[dimension] = '';
  3545. _this.setTransitioning(false);
  3546. $(_this._element).trigger(Event$3.SHOWN);
  3547. };
  3548. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3549. var scrollSize = "scroll" + capitalizedDimension;
  3550. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3551. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3552. this._element.style[dimension] = this._element[scrollSize] + "px";
  3553. };
  3554. _proto.hide = function hide() {
  3555. var _this2 = this;
  3556. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3557. return;
  3558. }
  3559. var startEvent = $.Event(Event$3.HIDE);
  3560. $(this._element).trigger(startEvent);
  3561. if (startEvent.isDefaultPrevented()) {
  3562. return;
  3563. }
  3564. var dimension = this._getDimension();
  3565. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3566. Util.reflow(this._element);
  3567. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3568. var triggerArrayLength = this._triggerArray.length;
  3569. if (triggerArrayLength > 0) {
  3570. for (var i = 0; i < triggerArrayLength; i++) {
  3571. var trigger = this._triggerArray[i];
  3572. var selector = Util.getSelectorFromElement(trigger);
  3573. if (selector !== null) {
  3574. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3575. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3576. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3577. }
  3578. }
  3579. }
  3580. }
  3581. this.setTransitioning(true);
  3582. var complete = function complete() {
  3583. _this2.setTransitioning(false);
  3584. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3585. };
  3586. this._element.style[dimension] = '';
  3587. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3588. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3589. };
  3590. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3591. this._isTransitioning = isTransitioning;
  3592. };
  3593. _proto.dispose = function dispose() {
  3594. $.removeData(this._element, DATA_KEY$3);
  3595. this._config = null;
  3596. this._parent = null;
  3597. this._element = null;
  3598. this._triggerArray = null;
  3599. this._isTransitioning = null;
  3600. } // Private
  3601. ;
  3602. _proto._getConfig = function _getConfig(config) {
  3603. config = _objectSpread2({}, Default$1, {}, config);
  3604. config.toggle = Boolean(config.toggle); // Coerce string values
  3605. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3606. return config;
  3607. };
  3608. _proto._getDimension = function _getDimension() {
  3609. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3610. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3611. };
  3612. _proto._getParent = function _getParent() {
  3613. var _this3 = this;
  3614. var parent;
  3615. if (Util.isElement(this._config.parent)) {
  3616. parent = this._config.parent; // It's a jQuery object
  3617. if (typeof this._config.parent.jquery !== 'undefined') {
  3618. parent = this._config.parent[0];
  3619. }
  3620. } else {
  3621. parent = document.querySelector(this._config.parent);
  3622. }
  3623. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3624. var children = [].slice.call(parent.querySelectorAll(selector));
  3625. $(children).each(function (i, element) {
  3626. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3627. });
  3628. return parent;
  3629. };
  3630. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3631. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3632. if (triggerArray.length) {
  3633. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3634. }
  3635. } // Static
  3636. ;
  3637. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3638. var selector = Util.getSelectorFromElement(element);
  3639. return selector ? document.querySelector(selector) : null;
  3640. };
  3641. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3642. return this.each(function () {
  3643. var $this = $(this);
  3644. var data = $this.data(DATA_KEY$3);
  3645. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3646. if (!data && _config.toggle && /show|hide/.test(config)) {
  3647. _config.toggle = false;
  3648. }
  3649. if (!data) {
  3650. data = new Collapse(this, _config);
  3651. $this.data(DATA_KEY$3, data);
  3652. }
  3653. if (typeof config === 'string') {
  3654. if (typeof data[config] === 'undefined') {
  3655. throw new TypeError("No method named \"" + config + "\"");
  3656. }
  3657. data[config]();
  3658. }
  3659. });
  3660. };
  3661. _createClass(Collapse, null, [{
  3662. key: "VERSION",
  3663. get: function get() {
  3664. return VERSION$3;
  3665. }
  3666. }, {
  3667. key: "Default",
  3668. get: function get() {
  3669. return Default$1;
  3670. }
  3671. }]);
  3672. return Collapse;
  3673. }();
  3674. /**
  3675. * ------------------------------------------------------------------------
  3676. * Data Api implementation
  3677. * ------------------------------------------------------------------------
  3678. */
  3679. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3680. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3681. if (event.currentTarget.tagName === 'A') {
  3682. event.preventDefault();
  3683. }
  3684. var $trigger = $(this);
  3685. var selector = Util.getSelectorFromElement(this);
  3686. var selectors = [].slice.call(document.querySelectorAll(selector));
  3687. $(selectors).each(function () {
  3688. var $target = $(this);
  3689. var data = $target.data(DATA_KEY$3);
  3690. var config = data ? 'toggle' : $trigger.data();
  3691. Collapse._jQueryInterface.call($target, config);
  3692. });
  3693. });
  3694. /**
  3695. * ------------------------------------------------------------------------
  3696. * jQuery
  3697. * ------------------------------------------------------------------------
  3698. */
  3699. $.fn[NAME$3] = Collapse._jQueryInterface;
  3700. $.fn[NAME$3].Constructor = Collapse;
  3701. $.fn[NAME$3].noConflict = function () {
  3702. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3703. return Collapse._jQueryInterface;
  3704. };
  3705. /**
  3706. * ------------------------------------------------------------------------
  3707. * Constants
  3708. * ------------------------------------------------------------------------
  3709. */
  3710. var NAME$4 = 'dropdown';
  3711. var VERSION$4 = '4.4.1';
  3712. var DATA_KEY$4 = 'bs.dropdown';
  3713. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3714. var DATA_API_KEY$4 = '.data-api';
  3715. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3716. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3717. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3718. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3719. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3720. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3721. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3722. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3723. var Event$4 = {
  3724. HIDE: "hide" + EVENT_KEY$4,
  3725. HIDDEN: "hidden" + EVENT_KEY$4,
  3726. SHOW: "show" + EVENT_KEY$4,
  3727. SHOWN: "shown" + EVENT_KEY$4,
  3728. CLICK: "click" + EVENT_KEY$4,
  3729. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3730. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3731. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3732. };
  3733. var ClassName$4 = {
  3734. DISABLED: 'disabled',
  3735. SHOW: 'show',
  3736. DROPUP: 'dropup',
  3737. DROPRIGHT: 'dropright',
  3738. DROPLEFT: 'dropleft',
  3739. MENURIGHT: 'dropdown-menu-right',
  3740. MENULEFT: 'dropdown-menu-left',
  3741. POSITION_STATIC: 'position-static'
  3742. };
  3743. var Selector$4 = {
  3744. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3745. FORM_CHILD: '.dropdown form',
  3746. MENU: '.dropdown-menu',
  3747. NAVBAR_NAV: '.navbar-nav',
  3748. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3749. };
  3750. var AttachmentMap = {
  3751. TOP: 'top-start',
  3752. TOPEND: 'top-end',
  3753. BOTTOM: 'bottom-start',
  3754. BOTTOMEND: 'bottom-end',
  3755. RIGHT: 'right-start',
  3756. RIGHTEND: 'right-end',
  3757. LEFT: 'left-start',
  3758. LEFTEND: 'left-end'
  3759. };
  3760. var Default$2 = {
  3761. offset: 0,
  3762. flip: true,
  3763. boundary: 'scrollParent',
  3764. reference: 'toggle',
  3765. display: 'dynamic',
  3766. popperConfig: null
  3767. };
  3768. var DefaultType$2 = {
  3769. offset: '(number|string|function)',
  3770. flip: 'boolean',
  3771. boundary: '(string|element)',
  3772. reference: '(string|element)',
  3773. display: 'string',
  3774. popperConfig: '(null|object)'
  3775. };
  3776. /**
  3777. * ------------------------------------------------------------------------
  3778. * Class Definition
  3779. * ------------------------------------------------------------------------
  3780. */
  3781. var Dropdown =
  3782. /*#__PURE__*/
  3783. function () {
  3784. function Dropdown(element, config) {
  3785. this._element = element;
  3786. this._popper = null;
  3787. this._config = this._getConfig(config);
  3788. this._menu = this._getMenuElement();
  3789. this._inNavbar = this._detectNavbar();
  3790. this._addEventListeners();
  3791. } // Getters
  3792. var _proto = Dropdown.prototype;
  3793. // Public
  3794. _proto.toggle = function toggle() {
  3795. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3796. return;
  3797. }
  3798. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3799. Dropdown._clearMenus();
  3800. if (isActive) {
  3801. return;
  3802. }
  3803. this.show(true);
  3804. };
  3805. _proto.show = function show(usePopper) {
  3806. if (usePopper === void 0) {
  3807. usePopper = false;
  3808. }
  3809. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3810. return;
  3811. }
  3812. var relatedTarget = {
  3813. relatedTarget: this._element
  3814. };
  3815. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3816. var parent = Dropdown._getParentFromElement(this._element);
  3817. $(parent).trigger(showEvent);
  3818. if (showEvent.isDefaultPrevented()) {
  3819. return;
  3820. } // Disable totally Popper.js for Dropdown in Navbar
  3821. if (!this._inNavbar && usePopper) {
  3822. /**
  3823. * Check for Popper dependency
  3824. * Popper - https://popper.js.org
  3825. */
  3826. if (typeof Popper === 'undefined') {
  3827. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3828. }
  3829. var referenceElement = this._element;
  3830. if (this._config.reference === 'parent') {
  3831. referenceElement = parent;
  3832. } else if (Util.isElement(this._config.reference)) {
  3833. referenceElement = this._config.reference; // Check if it's jQuery element
  3834. if (typeof this._config.reference.jquery !== 'undefined') {
  3835. referenceElement = this._config.reference[0];
  3836. }
  3837. } // If boundary is not `scrollParent`, then set position to `static`
  3838. // to allow the menu to "escape" the scroll parent's boundaries
  3839. // https://github.com/twbs/bootstrap/issues/24251
  3840. if (this._config.boundary !== 'scrollParent') {
  3841. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3842. }
  3843. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3844. } // If this is a touch-enabled device we add extra
  3845. // empty mouseover listeners to the body's immediate children;
  3846. // only needed because of broken event delegation on iOS
  3847. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3848. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3849. $(document.body).children().on('mouseover', null, $.noop);
  3850. }
  3851. this._element.focus();
  3852. this._element.setAttribute('aria-expanded', true);
  3853. $(this._menu).toggleClass(ClassName$4.SHOW);
  3854. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3855. };
  3856. _proto.hide = function hide() {
  3857. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3858. return;
  3859. }
  3860. var relatedTarget = {
  3861. relatedTarget: this._element
  3862. };
  3863. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3864. var parent = Dropdown._getParentFromElement(this._element);
  3865. $(parent).trigger(hideEvent);
  3866. if (hideEvent.isDefaultPrevented()) {
  3867. return;
  3868. }
  3869. if (this._popper) {
  3870. this._popper.destroy();
  3871. }
  3872. $(this._menu).toggleClass(ClassName$4.SHOW);
  3873. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3874. };
  3875. _proto.dispose = function dispose() {
  3876. $.removeData(this._element, DATA_KEY$4);
  3877. $(this._element).off(EVENT_KEY$4);
  3878. this._element = null;
  3879. this._menu = null;
  3880. if (this._popper !== null) {
  3881. this._popper.destroy();
  3882. this._popper = null;
  3883. }
  3884. };
  3885. _proto.update = function update() {
  3886. this._inNavbar = this._detectNavbar();
  3887. if (this._popper !== null) {
  3888. this._popper.scheduleUpdate();
  3889. }
  3890. } // Private
  3891. ;
  3892. _proto._addEventListeners = function _addEventListeners() {
  3893. var _this = this;
  3894. $(this._element).on(Event$4.CLICK, function (event) {
  3895. event.preventDefault();
  3896. event.stopPropagation();
  3897. _this.toggle();
  3898. });
  3899. };
  3900. _proto._getConfig = function _getConfig(config) {
  3901. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3902. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3903. return config;
  3904. };
  3905. _proto._getMenuElement = function _getMenuElement() {
  3906. if (!this._menu) {
  3907. var parent = Dropdown._getParentFromElement(this._element);
  3908. if (parent) {
  3909. this._menu = parent.querySelector(Selector$4.MENU);
  3910. }
  3911. }
  3912. return this._menu;
  3913. };
  3914. _proto._getPlacement = function _getPlacement() {
  3915. var $parentDropdown = $(this._element.parentNode);
  3916. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3917. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3918. placement = AttachmentMap.TOP;
  3919. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3920. placement = AttachmentMap.TOPEND;
  3921. }
  3922. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3923. placement = AttachmentMap.RIGHT;
  3924. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3925. placement = AttachmentMap.LEFT;
  3926. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3927. placement = AttachmentMap.BOTTOMEND;
  3928. }
  3929. return placement;
  3930. };
  3931. _proto._detectNavbar = function _detectNavbar() {
  3932. return $(this._element).closest('.navbar').length > 0;
  3933. };
  3934. _proto._getOffset = function _getOffset() {
  3935. var _this2 = this;
  3936. var offset = {};
  3937. if (typeof this._config.offset === 'function') {
  3938. offset.fn = function (data) {
  3939. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3940. return data;
  3941. };
  3942. } else {
  3943. offset.offset = this._config.offset;
  3944. }
  3945. return offset;
  3946. };
  3947. _proto._getPopperConfig = function _getPopperConfig() {
  3948. var popperConfig = {
  3949. placement: this._getPlacement(),
  3950. modifiers: {
  3951. offset: this._getOffset(),
  3952. flip: {
  3953. enabled: this._config.flip
  3954. },
  3955. preventOverflow: {
  3956. boundariesElement: this._config.boundary
  3957. }
  3958. }
  3959. }; // Disable Popper.js if we have a static display
  3960. if (this._config.display === 'static') {
  3961. popperConfig.modifiers.applyStyle = {
  3962. enabled: false
  3963. };
  3964. }
  3965. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3966. } // Static
  3967. ;
  3968. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3969. return this.each(function () {
  3970. var data = $(this).data(DATA_KEY$4);
  3971. var _config = typeof config === 'object' ? config : null;
  3972. if (!data) {
  3973. data = new Dropdown(this, _config);
  3974. $(this).data(DATA_KEY$4, data);
  3975. }
  3976. if (typeof config === 'string') {
  3977. if (typeof data[config] === 'undefined') {
  3978. throw new TypeError("No method named \"" + config + "\"");
  3979. }
  3980. data[config]();
  3981. }
  3982. });
  3983. };
  3984. Dropdown._clearMenus = function _clearMenus(event) {
  3985. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3986. return;
  3987. }
  3988. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3989. for (var i = 0, len = toggles.length; i < len; i++) {
  3990. var parent = Dropdown._getParentFromElement(toggles[i]);
  3991. var context = $(toggles[i]).data(DATA_KEY$4);
  3992. var relatedTarget = {
  3993. relatedTarget: toggles[i]
  3994. };
  3995. if (event && event.type === 'click') {
  3996. relatedTarget.clickEvent = event;
  3997. }
  3998. if (!context) {
  3999. continue;
  4000. }
  4001. var dropdownMenu = context._menu;
  4002. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4003. continue;
  4004. }
  4005. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4006. continue;
  4007. }
  4008. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4009. $(parent).trigger(hideEvent);
  4010. if (hideEvent.isDefaultPrevented()) {
  4011. continue;
  4012. } // If this is a touch-enabled device we remove the extra
  4013. // empty mouseover listeners we added for iOS support
  4014. if ('ontouchstart' in document.documentElement) {
  4015. $(document.body).children().off('mouseover', null, $.noop);
  4016. }
  4017. toggles[i].setAttribute('aria-expanded', 'false');
  4018. if (context._popper) {
  4019. context._popper.destroy();
  4020. }
  4021. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4022. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4023. }
  4024. };
  4025. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4026. var parent;
  4027. var selector = Util.getSelectorFromElement(element);
  4028. if (selector) {
  4029. parent = document.querySelector(selector);
  4030. }
  4031. return parent || element.parentNode;
  4032. } // eslint-disable-next-line complexity
  4033. ;
  4034. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4035. // If not input/textarea:
  4036. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4037. // If input/textarea:
  4038. // - If space key => not a dropdown command
  4039. // - If key is other than escape
  4040. // - If key is not up or down => not a dropdown command
  4041. // - If trigger inside the menu => not a dropdown command
  4042. 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)) {
  4043. return;
  4044. }
  4045. event.preventDefault();
  4046. event.stopPropagation();
  4047. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4048. return;
  4049. }
  4050. var parent = Dropdown._getParentFromElement(this);
  4051. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4052. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4053. return;
  4054. }
  4055. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4056. if (event.which === ESCAPE_KEYCODE) {
  4057. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4058. $(toggle).trigger('focus');
  4059. }
  4060. $(this).trigger('click');
  4061. return;
  4062. }
  4063. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4064. return $(item).is(':visible');
  4065. });
  4066. if (items.length === 0) {
  4067. return;
  4068. }
  4069. var index = items.indexOf(event.target);
  4070. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4071. // Up
  4072. index--;
  4073. }
  4074. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4075. // Down
  4076. index++;
  4077. }
  4078. if (index < 0) {
  4079. index = 0;
  4080. }
  4081. items[index].focus();
  4082. };
  4083. _createClass(Dropdown, null, [{
  4084. key: "VERSION",
  4085. get: function get() {
  4086. return VERSION$4;
  4087. }
  4088. }, {
  4089. key: "Default",
  4090. get: function get() {
  4091. return Default$2;
  4092. }
  4093. }, {
  4094. key: "DefaultType",
  4095. get: function get() {
  4096. return DefaultType$2;
  4097. }
  4098. }]);
  4099. return Dropdown;
  4100. }();
  4101. /**
  4102. * ------------------------------------------------------------------------
  4103. * Data Api implementation
  4104. * ------------------------------------------------------------------------
  4105. */
  4106. $(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) {
  4107. event.preventDefault();
  4108. event.stopPropagation();
  4109. Dropdown._jQueryInterface.call($(this), 'toggle');
  4110. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4111. e.stopPropagation();
  4112. });
  4113. /**
  4114. * ------------------------------------------------------------------------
  4115. * jQuery
  4116. * ------------------------------------------------------------------------
  4117. */
  4118. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4119. $.fn[NAME$4].Constructor = Dropdown;
  4120. $.fn[NAME$4].noConflict = function () {
  4121. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4122. return Dropdown._jQueryInterface;
  4123. };
  4124. /**
  4125. * ------------------------------------------------------------------------
  4126. * Constants
  4127. * ------------------------------------------------------------------------
  4128. */
  4129. var NAME$5 = 'modal';
  4130. var VERSION$5 = '4.4.1';
  4131. var DATA_KEY$5 = 'bs.modal';
  4132. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4133. var DATA_API_KEY$5 = '.data-api';
  4134. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4135. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4136. var Default$3 = {
  4137. backdrop: true,
  4138. keyboard: true,
  4139. focus: true,
  4140. show: true
  4141. };
  4142. var DefaultType$3 = {
  4143. backdrop: '(boolean|string)',
  4144. keyboard: 'boolean',
  4145. focus: 'boolean',
  4146. show: 'boolean'
  4147. };
  4148. var Event$5 = {
  4149. HIDE: "hide" + EVENT_KEY$5,
  4150. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4151. HIDDEN: "hidden" + EVENT_KEY$5,
  4152. SHOW: "show" + EVENT_KEY$5,
  4153. SHOWN: "shown" + EVENT_KEY$5,
  4154. FOCUSIN: "focusin" + EVENT_KEY$5,
  4155. RESIZE: "resize" + EVENT_KEY$5,
  4156. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4157. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4158. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4159. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4160. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4161. };
  4162. var ClassName$5 = {
  4163. SCROLLABLE: 'modal-dialog-scrollable',
  4164. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4165. BACKDROP: 'modal-backdrop',
  4166. OPEN: 'modal-open',
  4167. FADE: 'fade',
  4168. SHOW: 'show',
  4169. STATIC: 'modal-static'
  4170. };
  4171. var Selector$5 = {
  4172. DIALOG: '.modal-dialog',
  4173. MODAL_BODY: '.modal-body',
  4174. DATA_TOGGLE: '[data-toggle="modal"]',
  4175. DATA_DISMISS: '[data-dismiss="modal"]',
  4176. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4177. STICKY_CONTENT: '.sticky-top'
  4178. };
  4179. /**
  4180. * ------------------------------------------------------------------------
  4181. * Class Definition
  4182. * ------------------------------------------------------------------------
  4183. */
  4184. var Modal =
  4185. /*#__PURE__*/
  4186. function () {
  4187. function Modal(element, config) {
  4188. this._config = this._getConfig(config);
  4189. this._element = element;
  4190. this._dialog = element.querySelector(Selector$5.DIALOG);
  4191. this._backdrop = null;
  4192. this._isShown = false;
  4193. this._isBodyOverflowing = false;
  4194. this._ignoreBackdropClick = false;
  4195. this._isTransitioning = false;
  4196. this._scrollbarWidth = 0;
  4197. } // Getters
  4198. var _proto = Modal.prototype;
  4199. // Public
  4200. _proto.toggle = function toggle(relatedTarget) {
  4201. return this._isShown ? this.hide() : this.show(relatedTarget);
  4202. };
  4203. _proto.show = function show(relatedTarget) {
  4204. var _this = this;
  4205. if (this._isShown || this._isTransitioning) {
  4206. return;
  4207. }
  4208. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4209. this._isTransitioning = true;
  4210. }
  4211. var showEvent = $.Event(Event$5.SHOW, {
  4212. relatedTarget: relatedTarget
  4213. });
  4214. $(this._element).trigger(showEvent);
  4215. if (this._isShown || showEvent.isDefaultPrevented()) {
  4216. return;
  4217. }
  4218. this._isShown = true;
  4219. this._checkScrollbar();
  4220. this._setScrollbar();
  4221. this._adjustDialog();
  4222. this._setEscapeEvent();
  4223. this._setResizeEvent();
  4224. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4225. return _this.hide(event);
  4226. });
  4227. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4228. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4229. if ($(event.target).is(_this._element)) {
  4230. _this._ignoreBackdropClick = true;
  4231. }
  4232. });
  4233. });
  4234. this._showBackdrop(function () {
  4235. return _this._showElement(relatedTarget);
  4236. });
  4237. };
  4238. _proto.hide = function hide(event) {
  4239. var _this2 = this;
  4240. if (event) {
  4241. event.preventDefault();
  4242. }
  4243. if (!this._isShown || this._isTransitioning) {
  4244. return;
  4245. }
  4246. var hideEvent = $.Event(Event$5.HIDE);
  4247. $(this._element).trigger(hideEvent);
  4248. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4249. return;
  4250. }
  4251. this._isShown = false;
  4252. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4253. if (transition) {
  4254. this._isTransitioning = true;
  4255. }
  4256. this._setEscapeEvent();
  4257. this._setResizeEvent();
  4258. $(document).off(Event$5.FOCUSIN);
  4259. $(this._element).removeClass(ClassName$5.SHOW);
  4260. $(this._element).off(Event$5.CLICK_DISMISS);
  4261. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4262. if (transition) {
  4263. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4264. $(this._element).one(Util.TRANSITION_END, function (event) {
  4265. return _this2._hideModal(event);
  4266. }).emulateTransitionEnd(transitionDuration);
  4267. } else {
  4268. this._hideModal();
  4269. }
  4270. };
  4271. _proto.dispose = function dispose() {
  4272. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4273. return $(htmlElement).off(EVENT_KEY$5);
  4274. });
  4275. /**
  4276. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4277. * Do not move `document` in `htmlElements` array
  4278. * It will remove `Event.CLICK_DATA_API` event that should remain
  4279. */
  4280. $(document).off(Event$5.FOCUSIN);
  4281. $.removeData(this._element, DATA_KEY$5);
  4282. this._config = null;
  4283. this._element = null;
  4284. this._dialog = null;
  4285. this._backdrop = null;
  4286. this._isShown = null;
  4287. this._isBodyOverflowing = null;
  4288. this._ignoreBackdropClick = null;
  4289. this._isTransitioning = null;
  4290. this._scrollbarWidth = null;
  4291. };
  4292. _proto.handleUpdate = function handleUpdate() {
  4293. this._adjustDialog();
  4294. } // Private
  4295. ;
  4296. _proto._getConfig = function _getConfig(config) {
  4297. config = _objectSpread2({}, Default$3, {}, config);
  4298. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4299. return config;
  4300. };
  4301. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4302. var _this3 = this;
  4303. if (this._config.backdrop === 'static') {
  4304. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4305. $(this._element).trigger(hideEventPrevented);
  4306. if (hideEventPrevented.defaultPrevented) {
  4307. return;
  4308. }
  4309. this._element.classList.add(ClassName$5.STATIC);
  4310. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4311. $(this._element).one(Util.TRANSITION_END, function () {
  4312. _this3._element.classList.remove(ClassName$5.STATIC);
  4313. }).emulateTransitionEnd(modalTransitionDuration);
  4314. this._element.focus();
  4315. } else {
  4316. this.hide();
  4317. }
  4318. };
  4319. _proto._showElement = function _showElement(relatedTarget) {
  4320. var _this4 = this;
  4321. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4322. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4323. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4324. // Don't move modal's DOM position
  4325. document.body.appendChild(this._element);
  4326. }
  4327. this._element.style.display = 'block';
  4328. this._element.removeAttribute('aria-hidden');
  4329. this._element.setAttribute('aria-modal', true);
  4330. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4331. modalBody.scrollTop = 0;
  4332. } else {
  4333. this._element.scrollTop = 0;
  4334. }
  4335. if (transition) {
  4336. Util.reflow(this._element);
  4337. }
  4338. $(this._element).addClass(ClassName$5.SHOW);
  4339. if (this._config.focus) {
  4340. this._enforceFocus();
  4341. }
  4342. var shownEvent = $.Event(Event$5.SHOWN, {
  4343. relatedTarget: relatedTarget
  4344. });
  4345. var transitionComplete = function transitionComplete() {
  4346. if (_this4._config.focus) {
  4347. _this4._element.focus();
  4348. }
  4349. _this4._isTransitioning = false;
  4350. $(_this4._element).trigger(shownEvent);
  4351. };
  4352. if (transition) {
  4353. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4354. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4355. } else {
  4356. transitionComplete();
  4357. }
  4358. };
  4359. _proto._enforceFocus = function _enforceFocus() {
  4360. var _this5 = this;
  4361. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4362. .on(Event$5.FOCUSIN, function (event) {
  4363. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4364. _this5._element.focus();
  4365. }
  4366. });
  4367. };
  4368. _proto._setEscapeEvent = function _setEscapeEvent() {
  4369. var _this6 = this;
  4370. if (this._isShown && this._config.keyboard) {
  4371. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4372. if (event.which === ESCAPE_KEYCODE$1) {
  4373. _this6._triggerBackdropTransition();
  4374. }
  4375. });
  4376. } else if (!this._isShown) {
  4377. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4378. }
  4379. };
  4380. _proto._setResizeEvent = function _setResizeEvent() {
  4381. var _this7 = this;
  4382. if (this._isShown) {
  4383. $(window).on(Event$5.RESIZE, function (event) {
  4384. return _this7.handleUpdate(event);
  4385. });
  4386. } else {
  4387. $(window).off(Event$5.RESIZE);
  4388. }
  4389. };
  4390. _proto._hideModal = function _hideModal() {
  4391. var _this8 = this;
  4392. this._element.style.display = 'none';
  4393. this._element.setAttribute('aria-hidden', true);
  4394. this._element.removeAttribute('aria-modal');
  4395. this._isTransitioning = false;
  4396. this._showBackdrop(function () {
  4397. $(document.body).removeClass(ClassName$5.OPEN);
  4398. _this8._resetAdjustments();
  4399. _this8._resetScrollbar();
  4400. $(_this8._element).trigger(Event$5.HIDDEN);
  4401. });
  4402. };
  4403. _proto._removeBackdrop = function _removeBackdrop() {
  4404. if (this._backdrop) {
  4405. $(this._backdrop).remove();
  4406. this._backdrop = null;
  4407. }
  4408. };
  4409. _proto._showBackdrop = function _showBackdrop(callback) {
  4410. var _this9 = this;
  4411. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4412. if (this._isShown && this._config.backdrop) {
  4413. this._backdrop = document.createElement('div');
  4414. this._backdrop.className = ClassName$5.BACKDROP;
  4415. if (animate) {
  4416. this._backdrop.classList.add(animate);
  4417. }
  4418. $(this._backdrop).appendTo(document.body);
  4419. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4420. if (_this9._ignoreBackdropClick) {
  4421. _this9._ignoreBackdropClick = false;
  4422. return;
  4423. }
  4424. if (event.target !== event.currentTarget) {
  4425. return;
  4426. }
  4427. _this9._triggerBackdropTransition();
  4428. });
  4429. if (animate) {
  4430. Util.reflow(this._backdrop);
  4431. }
  4432. $(this._backdrop).addClass(ClassName$5.SHOW);
  4433. if (!callback) {
  4434. return;
  4435. }
  4436. if (!animate) {
  4437. callback();
  4438. return;
  4439. }
  4440. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4441. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4442. } else if (!this._isShown && this._backdrop) {
  4443. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4444. var callbackRemove = function callbackRemove() {
  4445. _this9._removeBackdrop();
  4446. if (callback) {
  4447. callback();
  4448. }
  4449. };
  4450. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4451. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4452. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4453. } else {
  4454. callbackRemove();
  4455. }
  4456. } else if (callback) {
  4457. callback();
  4458. }
  4459. } // ----------------------------------------------------------------------
  4460. // the following methods are used to handle overflowing modals
  4461. // todo (fat): these should probably be refactored out of modal.js
  4462. // ----------------------------------------------------------------------
  4463. ;
  4464. _proto._adjustDialog = function _adjustDialog() {
  4465. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4466. if (!this._isBodyOverflowing && isModalOverflowing) {
  4467. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4468. }
  4469. if (this._isBodyOverflowing && !isModalOverflowing) {
  4470. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4471. }
  4472. };
  4473. _proto._resetAdjustments = function _resetAdjustments() {
  4474. this._element.style.paddingLeft = '';
  4475. this._element.style.paddingRight = '';
  4476. };
  4477. _proto._checkScrollbar = function _checkScrollbar() {
  4478. var rect = document.body.getBoundingClientRect();
  4479. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4480. this._scrollbarWidth = this._getScrollbarWidth();
  4481. };
  4482. _proto._setScrollbar = function _setScrollbar() {
  4483. var _this10 = this;
  4484. if (this._isBodyOverflowing) {
  4485. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4486. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4487. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4488. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4489. $(fixedContent).each(function (index, element) {
  4490. var actualPadding = element.style.paddingRight;
  4491. var calculatedPadding = $(element).css('padding-right');
  4492. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4493. }); // Adjust sticky content margin
  4494. $(stickyContent).each(function (index, element) {
  4495. var actualMargin = element.style.marginRight;
  4496. var calculatedMargin = $(element).css('margin-right');
  4497. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4498. }); // Adjust body padding
  4499. var actualPadding = document.body.style.paddingRight;
  4500. var calculatedPadding = $(document.body).css('padding-right');
  4501. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4502. }
  4503. $(document.body).addClass(ClassName$5.OPEN);
  4504. };
  4505. _proto._resetScrollbar = function _resetScrollbar() {
  4506. // Restore fixed content padding
  4507. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4508. $(fixedContent).each(function (index, element) {
  4509. var padding = $(element).data('padding-right');
  4510. $(element).removeData('padding-right');
  4511. element.style.paddingRight = padding ? padding : '';
  4512. }); // Restore sticky content
  4513. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4514. $(elements).each(function (index, element) {
  4515. var margin = $(element).data('margin-right');
  4516. if (typeof margin !== 'undefined') {
  4517. $(element).css('margin-right', margin).removeData('margin-right');
  4518. }
  4519. }); // Restore body padding
  4520. var padding = $(document.body).data('padding-right');
  4521. $(document.body).removeData('padding-right');
  4522. document.body.style.paddingRight = padding ? padding : '';
  4523. };
  4524. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4525. // thx d.walsh
  4526. var scrollDiv = document.createElement('div');
  4527. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4528. document.body.appendChild(scrollDiv);
  4529. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4530. document.body.removeChild(scrollDiv);
  4531. return scrollbarWidth;
  4532. } // Static
  4533. ;
  4534. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4535. return this.each(function () {
  4536. var data = $(this).data(DATA_KEY$5);
  4537. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4538. if (!data) {
  4539. data = new Modal(this, _config);
  4540. $(this).data(DATA_KEY$5, data);
  4541. }
  4542. if (typeof config === 'string') {
  4543. if (typeof data[config] === 'undefined') {
  4544. throw new TypeError("No method named \"" + config + "\"");
  4545. }
  4546. data[config](relatedTarget);
  4547. } else if (_config.show) {
  4548. data.show(relatedTarget);
  4549. }
  4550. });
  4551. };
  4552. _createClass(Modal, null, [{
  4553. key: "VERSION",
  4554. get: function get() {
  4555. return VERSION$5;
  4556. }
  4557. }, {
  4558. key: "Default",
  4559. get: function get() {
  4560. return Default$3;
  4561. }
  4562. }]);
  4563. return Modal;
  4564. }();
  4565. /**
  4566. * ------------------------------------------------------------------------
  4567. * Data Api implementation
  4568. * ------------------------------------------------------------------------
  4569. */
  4570. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4571. var _this11 = this;
  4572. var target;
  4573. var selector = Util.getSelectorFromElement(this);
  4574. if (selector) {
  4575. target = document.querySelector(selector);
  4576. }
  4577. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4578. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4579. event.preventDefault();
  4580. }
  4581. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4582. if (showEvent.isDefaultPrevented()) {
  4583. // Only register focus restorer if modal will actually get shown
  4584. return;
  4585. }
  4586. $target.one(Event$5.HIDDEN, function () {
  4587. if ($(_this11).is(':visible')) {
  4588. _this11.focus();
  4589. }
  4590. });
  4591. });
  4592. Modal._jQueryInterface.call($(target), config, this);
  4593. });
  4594. /**
  4595. * ------------------------------------------------------------------------
  4596. * jQuery
  4597. * ------------------------------------------------------------------------
  4598. */
  4599. $.fn[NAME$5] = Modal._jQueryInterface;
  4600. $.fn[NAME$5].Constructor = Modal;
  4601. $.fn[NAME$5].noConflict = function () {
  4602. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4603. return Modal._jQueryInterface;
  4604. };
  4605. /**
  4606. * --------------------------------------------------------------------------
  4607. * Bootstrap (v4.4.1): tools/sanitizer.js
  4608. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4609. * --------------------------------------------------------------------------
  4610. */
  4611. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4612. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4613. var DefaultWhitelist = {
  4614. // Global attributes allowed on any supplied element below.
  4615. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4616. a: ['target', 'href', 'title', 'rel'],
  4617. area: [],
  4618. b: [],
  4619. br: [],
  4620. col: [],
  4621. code: [],
  4622. div: [],
  4623. em: [],
  4624. hr: [],
  4625. h1: [],
  4626. h2: [],
  4627. h3: [],
  4628. h4: [],
  4629. h5: [],
  4630. h6: [],
  4631. i: [],
  4632. img: ['src', 'alt', 'title', 'width', 'height'],
  4633. li: [],
  4634. ol: [],
  4635. p: [],
  4636. pre: [],
  4637. s: [],
  4638. small: [],
  4639. span: [],
  4640. sub: [],
  4641. sup: [],
  4642. strong: [],
  4643. u: [],
  4644. ul: []
  4645. };
  4646. /**
  4647. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4648. *
  4649. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4650. */
  4651. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4652. /**
  4653. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4654. *
  4655. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4656. */
  4657. 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;
  4658. function allowedAttribute(attr, allowedAttributeList) {
  4659. var attrName = attr.nodeName.toLowerCase();
  4660. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4661. if (uriAttrs.indexOf(attrName) !== -1) {
  4662. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4663. }
  4664. return true;
  4665. }
  4666. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4667. return attrRegex instanceof RegExp;
  4668. }); // Check if a regular expression validates the attribute.
  4669. for (var i = 0, l = regExp.length; i < l; i++) {
  4670. if (attrName.match(regExp[i])) {
  4671. return true;
  4672. }
  4673. }
  4674. return false;
  4675. }
  4676. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4677. if (unsafeHtml.length === 0) {
  4678. return unsafeHtml;
  4679. }
  4680. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4681. return sanitizeFn(unsafeHtml);
  4682. }
  4683. var domParser = new window.DOMParser();
  4684. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4685. var whitelistKeys = Object.keys(whiteList);
  4686. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4687. var _loop = function _loop(i, len) {
  4688. var el = elements[i];
  4689. var elName = el.nodeName.toLowerCase();
  4690. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4691. el.parentNode.removeChild(el);
  4692. return "continue";
  4693. }
  4694. var attributeList = [].slice.call(el.attributes);
  4695. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4696. attributeList.forEach(function (attr) {
  4697. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4698. el.removeAttribute(attr.nodeName);
  4699. }
  4700. });
  4701. };
  4702. for (var i = 0, len = elements.length; i < len; i++) {
  4703. var _ret = _loop(i);
  4704. if (_ret === "continue") continue;
  4705. }
  4706. return createdDocument.body.innerHTML;
  4707. }
  4708. /**
  4709. * ------------------------------------------------------------------------
  4710. * Constants
  4711. * ------------------------------------------------------------------------
  4712. */
  4713. var NAME$6 = 'tooltip';
  4714. var VERSION$6 = '4.4.1';
  4715. var DATA_KEY$6 = 'bs.tooltip';
  4716. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4717. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4718. var CLASS_PREFIX = 'bs-tooltip';
  4719. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4720. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4721. var DefaultType$4 = {
  4722. animation: 'boolean',
  4723. template: 'string',
  4724. title: '(string|element|function)',
  4725. trigger: 'string',
  4726. delay: '(number|object)',
  4727. html: 'boolean',
  4728. selector: '(string|boolean)',
  4729. placement: '(string|function)',
  4730. offset: '(number|string|function)',
  4731. container: '(string|element|boolean)',
  4732. fallbackPlacement: '(string|array)',
  4733. boundary: '(string|element)',
  4734. sanitize: 'boolean',
  4735. sanitizeFn: '(null|function)',
  4736. whiteList: 'object',
  4737. popperConfig: '(null|object)'
  4738. };
  4739. var AttachmentMap$1 = {
  4740. AUTO: 'auto',
  4741. TOP: 'top',
  4742. RIGHT: 'right',
  4743. BOTTOM: 'bottom',
  4744. LEFT: 'left'
  4745. };
  4746. var Default$4 = {
  4747. animation: true,
  4748. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4749. trigger: 'hover focus',
  4750. title: '',
  4751. delay: 0,
  4752. html: false,
  4753. selector: false,
  4754. placement: 'top',
  4755. offset: 0,
  4756. container: false,
  4757. fallbackPlacement: 'flip',
  4758. boundary: 'scrollParent',
  4759. sanitize: true,
  4760. sanitizeFn: null,
  4761. whiteList: DefaultWhitelist,
  4762. popperConfig: null
  4763. };
  4764. var HoverState = {
  4765. SHOW: 'show',
  4766. OUT: 'out'
  4767. };
  4768. var Event$6 = {
  4769. HIDE: "hide" + EVENT_KEY$6,
  4770. HIDDEN: "hidden" + EVENT_KEY$6,
  4771. SHOW: "show" + EVENT_KEY$6,
  4772. SHOWN: "shown" + EVENT_KEY$6,
  4773. INSERTED: "inserted" + EVENT_KEY$6,
  4774. CLICK: "click" + EVENT_KEY$6,
  4775. FOCUSIN: "focusin" + EVENT_KEY$6,
  4776. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4777. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4778. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4779. };
  4780. var ClassName$6 = {
  4781. FADE: 'fade',
  4782. SHOW: 'show'
  4783. };
  4784. var Selector$6 = {
  4785. TOOLTIP: '.tooltip',
  4786. TOOLTIP_INNER: '.tooltip-inner',
  4787. ARROW: '.arrow'
  4788. };
  4789. var Trigger = {
  4790. HOVER: 'hover',
  4791. FOCUS: 'focus',
  4792. CLICK: 'click',
  4793. MANUAL: 'manual'
  4794. };
  4795. /**
  4796. * ------------------------------------------------------------------------
  4797. * Class Definition
  4798. * ------------------------------------------------------------------------
  4799. */
  4800. var Tooltip =
  4801. /*#__PURE__*/
  4802. function () {
  4803. function Tooltip(element, config) {
  4804. if (typeof Popper === 'undefined') {
  4805. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4806. } // private
  4807. this._isEnabled = true;
  4808. this._timeout = 0;
  4809. this._hoverState = '';
  4810. this._activeTrigger = {};
  4811. this._popper = null; // Protected
  4812. this.element = element;
  4813. this.config = this._getConfig(config);
  4814. this.tip = null;
  4815. this._setListeners();
  4816. } // Getters
  4817. var _proto = Tooltip.prototype;
  4818. // Public
  4819. _proto.enable = function enable() {
  4820. this._isEnabled = true;
  4821. };
  4822. _proto.disable = function disable() {
  4823. this._isEnabled = false;
  4824. };
  4825. _proto.toggleEnabled = function toggleEnabled() {
  4826. this._isEnabled = !this._isEnabled;
  4827. };
  4828. _proto.toggle = function toggle(event) {
  4829. if (!this._isEnabled) {
  4830. return;
  4831. }
  4832. if (event) {
  4833. var dataKey = this.constructor.DATA_KEY;
  4834. var context = $(event.currentTarget).data(dataKey);
  4835. if (!context) {
  4836. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4837. $(event.currentTarget).data(dataKey, context);
  4838. }
  4839. context._activeTrigger.click = !context._activeTrigger.click;
  4840. if (context._isWithActiveTrigger()) {
  4841. context._enter(null, context);
  4842. } else {
  4843. context._leave(null, context);
  4844. }
  4845. } else {
  4846. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4847. this._leave(null, this);
  4848. return;
  4849. }
  4850. this._enter(null, this);
  4851. }
  4852. };
  4853. _proto.dispose = function dispose() {
  4854. clearTimeout(this._timeout);
  4855. $.removeData(this.element, this.constructor.DATA_KEY);
  4856. $(this.element).off(this.constructor.EVENT_KEY);
  4857. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4858. if (this.tip) {
  4859. $(this.tip).remove();
  4860. }
  4861. this._isEnabled = null;
  4862. this._timeout = null;
  4863. this._hoverState = null;
  4864. this._activeTrigger = null;
  4865. if (this._popper) {
  4866. this._popper.destroy();
  4867. }
  4868. this._popper = null;
  4869. this.element = null;
  4870. this.config = null;
  4871. this.tip = null;
  4872. };
  4873. _proto.show = function show() {
  4874. var _this = this;
  4875. if ($(this.element).css('display') === 'none') {
  4876. throw new Error('Please use show on visible elements');
  4877. }
  4878. var showEvent = $.Event(this.constructor.Event.SHOW);
  4879. if (this.isWithContent() && this._isEnabled) {
  4880. $(this.element).trigger(showEvent);
  4881. var shadowRoot = Util.findShadowRoot(this.element);
  4882. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4883. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4884. return;
  4885. }
  4886. var tip = this.getTipElement();
  4887. var tipId = Util.getUID(this.constructor.NAME);
  4888. tip.setAttribute('id', tipId);
  4889. this.element.setAttribute('aria-describedby', tipId);
  4890. this.setContent();
  4891. if (this.config.animation) {
  4892. $(tip).addClass(ClassName$6.FADE);
  4893. }
  4894. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4895. var attachment = this._getAttachment(placement);
  4896. this.addAttachmentClass(attachment);
  4897. var container = this._getContainer();
  4898. $(tip).data(this.constructor.DATA_KEY, this);
  4899. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4900. $(tip).appendTo(container);
  4901. }
  4902. $(this.element).trigger(this.constructor.Event.INSERTED);
  4903. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4904. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4905. // empty mouseover listeners to the body's immediate children;
  4906. // only needed because of broken event delegation on iOS
  4907. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4908. if ('ontouchstart' in document.documentElement) {
  4909. $(document.body).children().on('mouseover', null, $.noop);
  4910. }
  4911. var complete = function complete() {
  4912. if (_this.config.animation) {
  4913. _this._fixTransition();
  4914. }
  4915. var prevHoverState = _this._hoverState;
  4916. _this._hoverState = null;
  4917. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4918. if (prevHoverState === HoverState.OUT) {
  4919. _this._leave(null, _this);
  4920. }
  4921. };
  4922. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4923. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4924. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4925. } else {
  4926. complete();
  4927. }
  4928. }
  4929. };
  4930. _proto.hide = function hide(callback) {
  4931. var _this2 = this;
  4932. var tip = this.getTipElement();
  4933. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4934. var complete = function complete() {
  4935. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4936. tip.parentNode.removeChild(tip);
  4937. }
  4938. _this2._cleanTipClass();
  4939. _this2.element.removeAttribute('aria-describedby');
  4940. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4941. if (_this2._popper !== null) {
  4942. _this2._popper.destroy();
  4943. }
  4944. if (callback) {
  4945. callback();
  4946. }
  4947. };
  4948. $(this.element).trigger(hideEvent);
  4949. if (hideEvent.isDefaultPrevented()) {
  4950. return;
  4951. }
  4952. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4953. // empty mouseover listeners we added for iOS support
  4954. if ('ontouchstart' in document.documentElement) {
  4955. $(document.body).children().off('mouseover', null, $.noop);
  4956. }
  4957. this._activeTrigger[Trigger.CLICK] = false;
  4958. this._activeTrigger[Trigger.FOCUS] = false;
  4959. this._activeTrigger[Trigger.HOVER] = false;
  4960. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4961. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4962. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4963. } else {
  4964. complete();
  4965. }
  4966. this._hoverState = '';
  4967. };
  4968. _proto.update = function update() {
  4969. if (this._popper !== null) {
  4970. this._popper.scheduleUpdate();
  4971. }
  4972. } // Protected
  4973. ;
  4974. _proto.isWithContent = function isWithContent() {
  4975. return Boolean(this.getTitle());
  4976. };
  4977. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4978. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4979. };
  4980. _proto.getTipElement = function getTipElement() {
  4981. this.tip = this.tip || $(this.config.template)[0];
  4982. return this.tip;
  4983. };
  4984. _proto.setContent = function setContent() {
  4985. var tip = this.getTipElement();
  4986. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4987. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4988. };
  4989. _proto.setElementContent = function setElementContent($element, content) {
  4990. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4991. // Content is a DOM node or a jQuery
  4992. if (this.config.html) {
  4993. if (!$(content).parent().is($element)) {
  4994. $element.empty().append(content);
  4995. }
  4996. } else {
  4997. $element.text($(content).text());
  4998. }
  4999. return;
  5000. }
  5001. if (this.config.html) {
  5002. if (this.config.sanitize) {
  5003. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5004. }
  5005. $element.html(content);
  5006. } else {
  5007. $element.text(content);
  5008. }
  5009. };
  5010. _proto.getTitle = function getTitle() {
  5011. var title = this.element.getAttribute('data-original-title');
  5012. if (!title) {
  5013. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5014. }
  5015. return title;
  5016. } // Private
  5017. ;
  5018. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5019. var _this3 = this;
  5020. var defaultBsConfig = {
  5021. placement: attachment,
  5022. modifiers: {
  5023. offset: this._getOffset(),
  5024. flip: {
  5025. behavior: this.config.fallbackPlacement
  5026. },
  5027. arrow: {
  5028. element: Selector$6.ARROW
  5029. },
  5030. preventOverflow: {
  5031. boundariesElement: this.config.boundary
  5032. }
  5033. },
  5034. onCreate: function onCreate(data) {
  5035. if (data.originalPlacement !== data.placement) {
  5036. _this3._handlePopperPlacementChange(data);
  5037. }
  5038. },
  5039. onUpdate: function onUpdate(data) {
  5040. return _this3._handlePopperPlacementChange(data);
  5041. }
  5042. };
  5043. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5044. };
  5045. _proto._getOffset = function _getOffset() {
  5046. var _this4 = this;
  5047. var offset = {};
  5048. if (typeof this.config.offset === 'function') {
  5049. offset.fn = function (data) {
  5050. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5051. return data;
  5052. };
  5053. } else {
  5054. offset.offset = this.config.offset;
  5055. }
  5056. return offset;
  5057. };
  5058. _proto._getContainer = function _getContainer() {
  5059. if (this.config.container === false) {
  5060. return document.body;
  5061. }
  5062. if (Util.isElement(this.config.container)) {
  5063. return $(this.config.container);
  5064. }
  5065. return $(document).find(this.config.container);
  5066. };
  5067. _proto._getAttachment = function _getAttachment(placement) {
  5068. return AttachmentMap$1[placement.toUpperCase()];
  5069. };
  5070. _proto._setListeners = function _setListeners() {
  5071. var _this5 = this;
  5072. var triggers = this.config.trigger.split(' ');
  5073. triggers.forEach(function (trigger) {
  5074. if (trigger === 'click') {
  5075. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5076. return _this5.toggle(event);
  5077. });
  5078. } else if (trigger !== Trigger.MANUAL) {
  5079. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5080. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5081. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5082. return _this5._enter(event);
  5083. }).on(eventOut, _this5.config.selector, function (event) {
  5084. return _this5._leave(event);
  5085. });
  5086. }
  5087. });
  5088. this._hideModalHandler = function () {
  5089. if (_this5.element) {
  5090. _this5.hide();
  5091. }
  5092. };
  5093. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5094. if (this.config.selector) {
  5095. this.config = _objectSpread2({}, this.config, {
  5096. trigger: 'manual',
  5097. selector: ''
  5098. });
  5099. } else {
  5100. this._fixTitle();
  5101. }
  5102. };
  5103. _proto._fixTitle = function _fixTitle() {
  5104. var titleType = typeof this.element.getAttribute('data-original-title');
  5105. if (this.element.getAttribute('title') || titleType !== 'string') {
  5106. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5107. this.element.setAttribute('title', '');
  5108. }
  5109. };
  5110. _proto._enter = function _enter(event, context) {
  5111. var dataKey = this.constructor.DATA_KEY;
  5112. context = context || $(event.currentTarget).data(dataKey);
  5113. if (!context) {
  5114. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5115. $(event.currentTarget).data(dataKey, context);
  5116. }
  5117. if (event) {
  5118. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5119. }
  5120. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5121. context._hoverState = HoverState.SHOW;
  5122. return;
  5123. }
  5124. clearTimeout(context._timeout);
  5125. context._hoverState = HoverState.SHOW;
  5126. if (!context.config.delay || !context.config.delay.show) {
  5127. context.show();
  5128. return;
  5129. }
  5130. context._timeout = setTimeout(function () {
  5131. if (context._hoverState === HoverState.SHOW) {
  5132. context.show();
  5133. }
  5134. }, context.config.delay.show);
  5135. };
  5136. _proto._leave = function _leave(event, context) {
  5137. var dataKey = this.constructor.DATA_KEY;
  5138. context = context || $(event.currentTarget).data(dataKey);
  5139. if (!context) {
  5140. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5141. $(event.currentTarget).data(dataKey, context);
  5142. }
  5143. if (event) {
  5144. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5145. }
  5146. if (context._isWithActiveTrigger()) {
  5147. return;
  5148. }
  5149. clearTimeout(context._timeout);
  5150. context._hoverState = HoverState.OUT;
  5151. if (!context.config.delay || !context.config.delay.hide) {
  5152. context.hide();
  5153. return;
  5154. }
  5155. context._timeout = setTimeout(function () {
  5156. if (context._hoverState === HoverState.OUT) {
  5157. context.hide();
  5158. }
  5159. }, context.config.delay.hide);
  5160. };
  5161. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5162. for (var trigger in this._activeTrigger) {
  5163. if (this._activeTrigger[trigger]) {
  5164. return true;
  5165. }
  5166. }
  5167. return false;
  5168. };
  5169. _proto._getConfig = function _getConfig(config) {
  5170. var dataAttributes = $(this.element).data();
  5171. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5172. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5173. delete dataAttributes[dataAttr];
  5174. }
  5175. });
  5176. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5177. if (typeof config.delay === 'number') {
  5178. config.delay = {
  5179. show: config.delay,
  5180. hide: config.delay
  5181. };
  5182. }
  5183. if (typeof config.title === 'number') {
  5184. config.title = config.title.toString();
  5185. }
  5186. if (typeof config.content === 'number') {
  5187. config.content = config.content.toString();
  5188. }
  5189. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5190. if (config.sanitize) {
  5191. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5192. }
  5193. return config;
  5194. };
  5195. _proto._getDelegateConfig = function _getDelegateConfig() {
  5196. var config = {};
  5197. if (this.config) {
  5198. for (var key in this.config) {
  5199. if (this.constructor.Default[key] !== this.config[key]) {
  5200. config[key] = this.config[key];
  5201. }
  5202. }
  5203. }
  5204. return config;
  5205. };
  5206. _proto._cleanTipClass = function _cleanTipClass() {
  5207. var $tip = $(this.getTipElement());
  5208. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5209. if (tabClass !== null && tabClass.length) {
  5210. $tip.removeClass(tabClass.join(''));
  5211. }
  5212. };
  5213. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5214. var popperInstance = popperData.instance;
  5215. this.tip = popperInstance.popper;
  5216. this._cleanTipClass();
  5217. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5218. };
  5219. _proto._fixTransition = function _fixTransition() {
  5220. var tip = this.getTipElement();
  5221. var initConfigAnimation = this.config.animation;
  5222. if (tip.getAttribute('x-placement') !== null) {
  5223. return;
  5224. }
  5225. $(tip).removeClass(ClassName$6.FADE);
  5226. this.config.animation = false;
  5227. this.hide();
  5228. this.show();
  5229. this.config.animation = initConfigAnimation;
  5230. } // Static
  5231. ;
  5232. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5233. return this.each(function () {
  5234. var data = $(this).data(DATA_KEY$6);
  5235. var _config = typeof config === 'object' && config;
  5236. if (!data && /dispose|hide/.test(config)) {
  5237. return;
  5238. }
  5239. if (!data) {
  5240. data = new Tooltip(this, _config);
  5241. $(this).data(DATA_KEY$6, data);
  5242. }
  5243. if (typeof config === 'string') {
  5244. if (typeof data[config] === 'undefined') {
  5245. throw new TypeError("No method named \"" + config + "\"");
  5246. }
  5247. data[config]();
  5248. }
  5249. });
  5250. };
  5251. _createClass(Tooltip, null, [{
  5252. key: "VERSION",
  5253. get: function get() {
  5254. return VERSION$6;
  5255. }
  5256. }, {
  5257. key: "Default",
  5258. get: function get() {
  5259. return Default$4;
  5260. }
  5261. }, {
  5262. key: "NAME",
  5263. get: function get() {
  5264. return NAME$6;
  5265. }
  5266. }, {
  5267. key: "DATA_KEY",
  5268. get: function get() {
  5269. return DATA_KEY$6;
  5270. }
  5271. }, {
  5272. key: "Event",
  5273. get: function get() {
  5274. return Event$6;
  5275. }
  5276. }, {
  5277. key: "EVENT_KEY",
  5278. get: function get() {
  5279. return EVENT_KEY$6;
  5280. }
  5281. }, {
  5282. key: "DefaultType",
  5283. get: function get() {
  5284. return DefaultType$4;
  5285. }
  5286. }]);
  5287. return Tooltip;
  5288. }();
  5289. /**
  5290. * ------------------------------------------------------------------------
  5291. * jQuery
  5292. * ------------------------------------------------------------------------
  5293. */
  5294. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5295. $.fn[NAME$6].Constructor = Tooltip;
  5296. $.fn[NAME$6].noConflict = function () {
  5297. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5298. return Tooltip._jQueryInterface;
  5299. };
  5300. /**
  5301. * ------------------------------------------------------------------------
  5302. * Constants
  5303. * ------------------------------------------------------------------------
  5304. */
  5305. var NAME$7 = 'popover';
  5306. var VERSION$7 = '4.4.1';
  5307. var DATA_KEY$7 = 'bs.popover';
  5308. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5309. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5310. var CLASS_PREFIX$1 = 'bs-popover';
  5311. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5312. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5313. placement: 'right',
  5314. trigger: 'click',
  5315. content: '',
  5316. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5317. });
  5318. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5319. content: '(string|element|function)'
  5320. });
  5321. var ClassName$7 = {
  5322. FADE: 'fade',
  5323. SHOW: 'show'
  5324. };
  5325. var Selector$7 = {
  5326. TITLE: '.popover-header',
  5327. CONTENT: '.popover-body'
  5328. };
  5329. var Event$7 = {
  5330. HIDE: "hide" + EVENT_KEY$7,
  5331. HIDDEN: "hidden" + EVENT_KEY$7,
  5332. SHOW: "show" + EVENT_KEY$7,
  5333. SHOWN: "shown" + EVENT_KEY$7,
  5334. INSERTED: "inserted" + EVENT_KEY$7,
  5335. CLICK: "click" + EVENT_KEY$7,
  5336. FOCUSIN: "focusin" + EVENT_KEY$7,
  5337. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5338. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5339. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5340. };
  5341. /**
  5342. * ------------------------------------------------------------------------
  5343. * Class Definition
  5344. * ------------------------------------------------------------------------
  5345. */
  5346. var Popover =
  5347. /*#__PURE__*/
  5348. function (_Tooltip) {
  5349. _inheritsLoose(Popover, _Tooltip);
  5350. function Popover() {
  5351. return _Tooltip.apply(this, arguments) || this;
  5352. }
  5353. var _proto = Popover.prototype;
  5354. // Overrides
  5355. _proto.isWithContent = function isWithContent() {
  5356. return this.getTitle() || this._getContent();
  5357. };
  5358. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5359. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5360. };
  5361. _proto.getTipElement = function getTipElement() {
  5362. this.tip = this.tip || $(this.config.template)[0];
  5363. return this.tip;
  5364. };
  5365. _proto.setContent = function setContent() {
  5366. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5367. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5368. var content = this._getContent();
  5369. if (typeof content === 'function') {
  5370. content = content.call(this.element);
  5371. }
  5372. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5373. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5374. } // Private
  5375. ;
  5376. _proto._getContent = function _getContent() {
  5377. return this.element.getAttribute('data-content') || this.config.content;
  5378. };
  5379. _proto._cleanTipClass = function _cleanTipClass() {
  5380. var $tip = $(this.getTipElement());
  5381. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5382. if (tabClass !== null && tabClass.length > 0) {
  5383. $tip.removeClass(tabClass.join(''));
  5384. }
  5385. } // Static
  5386. ;
  5387. Popover._jQueryInterface = function _jQueryInterface(config) {
  5388. return this.each(function () {
  5389. var data = $(this).data(DATA_KEY$7);
  5390. var _config = typeof config === 'object' ? config : null;
  5391. if (!data && /dispose|hide/.test(config)) {
  5392. return;
  5393. }
  5394. if (!data) {
  5395. data = new Popover(this, _config);
  5396. $(this).data(DATA_KEY$7, data);
  5397. }
  5398. if (typeof config === 'string') {
  5399. if (typeof data[config] === 'undefined') {
  5400. throw new TypeError("No method named \"" + config + "\"");
  5401. }
  5402. data[config]();
  5403. }
  5404. });
  5405. };
  5406. _createClass(Popover, null, [{
  5407. key: "VERSION",
  5408. // Getters
  5409. get: function get() {
  5410. return VERSION$7;
  5411. }
  5412. }, {
  5413. key: "Default",
  5414. get: function get() {
  5415. return Default$5;
  5416. }
  5417. }, {
  5418. key: "NAME",
  5419. get: function get() {
  5420. return NAME$7;
  5421. }
  5422. }, {
  5423. key: "DATA_KEY",
  5424. get: function get() {
  5425. return DATA_KEY$7;
  5426. }
  5427. }, {
  5428. key: "Event",
  5429. get: function get() {
  5430. return Event$7;
  5431. }
  5432. }, {
  5433. key: "EVENT_KEY",
  5434. get: function get() {
  5435. return EVENT_KEY$7;
  5436. }
  5437. }, {
  5438. key: "DefaultType",
  5439. get: function get() {
  5440. return DefaultType$5;
  5441. }
  5442. }]);
  5443. return Popover;
  5444. }(Tooltip);
  5445. /**
  5446. * ------------------------------------------------------------------------
  5447. * jQuery
  5448. * ------------------------------------------------------------------------
  5449. */
  5450. $.fn[NAME$7] = Popover._jQueryInterface;
  5451. $.fn[NAME$7].Constructor = Popover;
  5452. $.fn[NAME$7].noConflict = function () {
  5453. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5454. return Popover._jQueryInterface;
  5455. };
  5456. /**
  5457. * ------------------------------------------------------------------------
  5458. * Constants
  5459. * ------------------------------------------------------------------------
  5460. */
  5461. var NAME$8 = 'scrollspy';
  5462. var VERSION$8 = '4.4.1';
  5463. var DATA_KEY$8 = 'bs.scrollspy';
  5464. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5465. var DATA_API_KEY$6 = '.data-api';
  5466. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5467. var Default$6 = {
  5468. offset: 10,
  5469. method: 'auto',
  5470. target: ''
  5471. };
  5472. var DefaultType$6 = {
  5473. offset: 'number',
  5474. method: 'string',
  5475. target: '(string|element)'
  5476. };
  5477. var Event$8 = {
  5478. ACTIVATE: "activate" + EVENT_KEY$8,
  5479. SCROLL: "scroll" + EVENT_KEY$8,
  5480. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5481. };
  5482. var ClassName$8 = {
  5483. DROPDOWN_ITEM: 'dropdown-item',
  5484. DROPDOWN_MENU: 'dropdown-menu',
  5485. ACTIVE: 'active'
  5486. };
  5487. var Selector$8 = {
  5488. DATA_SPY: '[data-spy="scroll"]',
  5489. ACTIVE: '.active',
  5490. NAV_LIST_GROUP: '.nav, .list-group',
  5491. NAV_LINKS: '.nav-link',
  5492. NAV_ITEMS: '.nav-item',
  5493. LIST_ITEMS: '.list-group-item',
  5494. DROPDOWN: '.dropdown',
  5495. DROPDOWN_ITEMS: '.dropdown-item',
  5496. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5497. };
  5498. var OffsetMethod = {
  5499. OFFSET: 'offset',
  5500. POSITION: 'position'
  5501. };
  5502. /**
  5503. * ------------------------------------------------------------------------
  5504. * Class Definition
  5505. * ------------------------------------------------------------------------
  5506. */
  5507. var ScrollSpy =
  5508. /*#__PURE__*/
  5509. function () {
  5510. function ScrollSpy(element, config) {
  5511. var _this = this;
  5512. this._element = element;
  5513. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5514. this._config = this._getConfig(config);
  5515. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5516. this._offsets = [];
  5517. this._targets = [];
  5518. this._activeTarget = null;
  5519. this._scrollHeight = 0;
  5520. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5521. return _this._process(event);
  5522. });
  5523. this.refresh();
  5524. this._process();
  5525. } // Getters
  5526. var _proto = ScrollSpy.prototype;
  5527. // Public
  5528. _proto.refresh = function refresh() {
  5529. var _this2 = this;
  5530. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5531. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5532. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5533. this._offsets = [];
  5534. this._targets = [];
  5535. this._scrollHeight = this._getScrollHeight();
  5536. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5537. targets.map(function (element) {
  5538. var target;
  5539. var targetSelector = Util.getSelectorFromElement(element);
  5540. if (targetSelector) {
  5541. target = document.querySelector(targetSelector);
  5542. }
  5543. if (target) {
  5544. var targetBCR = target.getBoundingClientRect();
  5545. if (targetBCR.width || targetBCR.height) {
  5546. // TODO (fat): remove sketch reliance on jQuery position/offset
  5547. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5548. }
  5549. }
  5550. return null;
  5551. }).filter(function (item) {
  5552. return item;
  5553. }).sort(function (a, b) {
  5554. return a[0] - b[0];
  5555. }).forEach(function (item) {
  5556. _this2._offsets.push(item[0]);
  5557. _this2._targets.push(item[1]);
  5558. });
  5559. };
  5560. _proto.dispose = function dispose() {
  5561. $.removeData(this._element, DATA_KEY$8);
  5562. $(this._scrollElement).off(EVENT_KEY$8);
  5563. this._element = null;
  5564. this._scrollElement = null;
  5565. this._config = null;
  5566. this._selector = null;
  5567. this._offsets = null;
  5568. this._targets = null;
  5569. this._activeTarget = null;
  5570. this._scrollHeight = null;
  5571. } // Private
  5572. ;
  5573. _proto._getConfig = function _getConfig(config) {
  5574. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5575. if (typeof config.target !== 'string') {
  5576. var id = $(config.target).attr('id');
  5577. if (!id) {
  5578. id = Util.getUID(NAME$8);
  5579. $(config.target).attr('id', id);
  5580. }
  5581. config.target = "#" + id;
  5582. }
  5583. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5584. return config;
  5585. };
  5586. _proto._getScrollTop = function _getScrollTop() {
  5587. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5588. };
  5589. _proto._getScrollHeight = function _getScrollHeight() {
  5590. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5591. };
  5592. _proto._getOffsetHeight = function _getOffsetHeight() {
  5593. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5594. };
  5595. _proto._process = function _process() {
  5596. var scrollTop = this._getScrollTop() + this._config.offset;
  5597. var scrollHeight = this._getScrollHeight();
  5598. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5599. if (this._scrollHeight !== scrollHeight) {
  5600. this.refresh();
  5601. }
  5602. if (scrollTop >= maxScroll) {
  5603. var target = this._targets[this._targets.length - 1];
  5604. if (this._activeTarget !== target) {
  5605. this._activate(target);
  5606. }
  5607. return;
  5608. }
  5609. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5610. this._activeTarget = null;
  5611. this._clear();
  5612. return;
  5613. }
  5614. var offsetLength = this._offsets.length;
  5615. for (var i = offsetLength; i--;) {
  5616. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5617. if (isActiveTarget) {
  5618. this._activate(this._targets[i]);
  5619. }
  5620. }
  5621. };
  5622. _proto._activate = function _activate(target) {
  5623. this._activeTarget = target;
  5624. this._clear();
  5625. var queries = this._selector.split(',').map(function (selector) {
  5626. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5627. });
  5628. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5629. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5630. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5631. $link.addClass(ClassName$8.ACTIVE);
  5632. } else {
  5633. // Set triggered link as active
  5634. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5635. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5636. $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
  5637. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5638. }
  5639. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5640. relatedTarget: target
  5641. });
  5642. };
  5643. _proto._clear = function _clear() {
  5644. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5645. return node.classList.contains(ClassName$8.ACTIVE);
  5646. }).forEach(function (node) {
  5647. return node.classList.remove(ClassName$8.ACTIVE);
  5648. });
  5649. } // Static
  5650. ;
  5651. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5652. return this.each(function () {
  5653. var data = $(this).data(DATA_KEY$8);
  5654. var _config = typeof config === 'object' && config;
  5655. if (!data) {
  5656. data = new ScrollSpy(this, _config);
  5657. $(this).data(DATA_KEY$8, data);
  5658. }
  5659. if (typeof config === 'string') {
  5660. if (typeof data[config] === 'undefined') {
  5661. throw new TypeError("No method named \"" + config + "\"");
  5662. }
  5663. data[config]();
  5664. }
  5665. });
  5666. };
  5667. _createClass(ScrollSpy, null, [{
  5668. key: "VERSION",
  5669. get: function get() {
  5670. return VERSION$8;
  5671. }
  5672. }, {
  5673. key: "Default",
  5674. get: function get() {
  5675. return Default$6;
  5676. }
  5677. }]);
  5678. return ScrollSpy;
  5679. }();
  5680. /**
  5681. * ------------------------------------------------------------------------
  5682. * Data Api implementation
  5683. * ------------------------------------------------------------------------
  5684. */
  5685. $(window).on(Event$8.LOAD_DATA_API, function () {
  5686. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5687. var scrollSpysLength = scrollSpys.length;
  5688. for (var i = scrollSpysLength; i--;) {
  5689. var $spy = $(scrollSpys[i]);
  5690. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5691. }
  5692. });
  5693. /**
  5694. * ------------------------------------------------------------------------
  5695. * jQuery
  5696. * ------------------------------------------------------------------------
  5697. */
  5698. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5699. $.fn[NAME$8].Constructor = ScrollSpy;
  5700. $.fn[NAME$8].noConflict = function () {
  5701. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5702. return ScrollSpy._jQueryInterface;
  5703. };
  5704. /**
  5705. * ------------------------------------------------------------------------
  5706. * Constants
  5707. * ------------------------------------------------------------------------
  5708. */
  5709. var NAME$9 = 'tab';
  5710. var VERSION$9 = '4.4.1';
  5711. var DATA_KEY$9 = 'bs.tab';
  5712. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5713. var DATA_API_KEY$7 = '.data-api';
  5714. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5715. var Event$9 = {
  5716. HIDE: "hide" + EVENT_KEY$9,
  5717. HIDDEN: "hidden" + EVENT_KEY$9,
  5718. SHOW: "show" + EVENT_KEY$9,
  5719. SHOWN: "shown" + EVENT_KEY$9,
  5720. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5721. };
  5722. var ClassName$9 = {
  5723. DROPDOWN_MENU: 'dropdown-menu',
  5724. ACTIVE: 'active',
  5725. DISABLED: 'disabled',
  5726. FADE: 'fade',
  5727. SHOW: 'show'
  5728. };
  5729. var Selector$9 = {
  5730. DROPDOWN: '.dropdown',
  5731. NAV_LIST_GROUP: '.nav, .list-group',
  5732. ACTIVE: '.active',
  5733. ACTIVE_UL: '> li > .active',
  5734. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5735. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5736. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5737. };
  5738. /**
  5739. * ------------------------------------------------------------------------
  5740. * Class Definition
  5741. * ------------------------------------------------------------------------
  5742. */
  5743. var Tab =
  5744. /*#__PURE__*/
  5745. function () {
  5746. function Tab(element) {
  5747. this._element = element;
  5748. } // Getters
  5749. var _proto = Tab.prototype;
  5750. // Public
  5751. _proto.show = function show() {
  5752. var _this = this;
  5753. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5754. return;
  5755. }
  5756. var target;
  5757. var previous;
  5758. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5759. var selector = Util.getSelectorFromElement(this._element);
  5760. if (listElement) {
  5761. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5762. previous = $.makeArray($(listElement).find(itemSelector));
  5763. previous = previous[previous.length - 1];
  5764. }
  5765. var hideEvent = $.Event(Event$9.HIDE, {
  5766. relatedTarget: this._element
  5767. });
  5768. var showEvent = $.Event(Event$9.SHOW, {
  5769. relatedTarget: previous
  5770. });
  5771. if (previous) {
  5772. $(previous).trigger(hideEvent);
  5773. }
  5774. $(this._element).trigger(showEvent);
  5775. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5776. return;
  5777. }
  5778. if (selector) {
  5779. target = document.querySelector(selector);
  5780. }
  5781. this._activate(this._element, listElement);
  5782. var complete = function complete() {
  5783. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5784. relatedTarget: _this._element
  5785. });
  5786. var shownEvent = $.Event(Event$9.SHOWN, {
  5787. relatedTarget: previous
  5788. });
  5789. $(previous).trigger(hiddenEvent);
  5790. $(_this._element).trigger(shownEvent);
  5791. };
  5792. if (target) {
  5793. this._activate(target, target.parentNode, complete);
  5794. } else {
  5795. complete();
  5796. }
  5797. };
  5798. _proto.dispose = function dispose() {
  5799. $.removeData(this._element, DATA_KEY$9);
  5800. this._element = null;
  5801. } // Private
  5802. ;
  5803. _proto._activate = function _activate(element, container, callback) {
  5804. var _this2 = this;
  5805. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5806. var active = activeElements[0];
  5807. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5808. var complete = function complete() {
  5809. return _this2._transitionComplete(element, active, callback);
  5810. };
  5811. if (active && isTransitioning) {
  5812. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5813. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5814. } else {
  5815. complete();
  5816. }
  5817. };
  5818. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5819. if (active) {
  5820. $(active).removeClass(ClassName$9.ACTIVE);
  5821. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5822. if (dropdownChild) {
  5823. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5824. }
  5825. if (active.getAttribute('role') === 'tab') {
  5826. active.setAttribute('aria-selected', false);
  5827. }
  5828. }
  5829. $(element).addClass(ClassName$9.ACTIVE);
  5830. if (element.getAttribute('role') === 'tab') {
  5831. element.setAttribute('aria-selected', true);
  5832. }
  5833. Util.reflow(element);
  5834. if (element.classList.contains(ClassName$9.FADE)) {
  5835. element.classList.add(ClassName$9.SHOW);
  5836. }
  5837. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5838. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5839. if (dropdownElement) {
  5840. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5841. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5842. }
  5843. element.setAttribute('aria-expanded', true);
  5844. }
  5845. if (callback) {
  5846. callback();
  5847. }
  5848. } // Static
  5849. ;
  5850. Tab._jQueryInterface = function _jQueryInterface(config) {
  5851. return this.each(function () {
  5852. var $this = $(this);
  5853. var data = $this.data(DATA_KEY$9);
  5854. if (!data) {
  5855. data = new Tab(this);
  5856. $this.data(DATA_KEY$9, data);
  5857. }
  5858. if (typeof config === 'string') {
  5859. if (typeof data[config] === 'undefined') {
  5860. throw new TypeError("No method named \"" + config + "\"");
  5861. }
  5862. data[config]();
  5863. }
  5864. });
  5865. };
  5866. _createClass(Tab, null, [{
  5867. key: "VERSION",
  5868. get: function get() {
  5869. return VERSION$9;
  5870. }
  5871. }]);
  5872. return Tab;
  5873. }();
  5874. /**
  5875. * ------------------------------------------------------------------------
  5876. * Data Api implementation
  5877. * ------------------------------------------------------------------------
  5878. */
  5879. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5880. event.preventDefault();
  5881. Tab._jQueryInterface.call($(this), 'show');
  5882. });
  5883. /**
  5884. * ------------------------------------------------------------------------
  5885. * jQuery
  5886. * ------------------------------------------------------------------------
  5887. */
  5888. $.fn[NAME$9] = Tab._jQueryInterface;
  5889. $.fn[NAME$9].Constructor = Tab;
  5890. $.fn[NAME$9].noConflict = function () {
  5891. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5892. return Tab._jQueryInterface;
  5893. };
  5894. /**
  5895. * ------------------------------------------------------------------------
  5896. * Constants
  5897. * ------------------------------------------------------------------------
  5898. */
  5899. var NAME$a = 'toast';
  5900. var VERSION$a = '4.4.1';
  5901. var DATA_KEY$a = 'bs.toast';
  5902. var EVENT_KEY$a = "." + DATA_KEY$a;
  5903. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5904. var Event$a = {
  5905. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5906. HIDE: "hide" + EVENT_KEY$a,
  5907. HIDDEN: "hidden" + EVENT_KEY$a,
  5908. SHOW: "show" + EVENT_KEY$a,
  5909. SHOWN: "shown" + EVENT_KEY$a
  5910. };
  5911. var ClassName$a = {
  5912. FADE: 'fade',
  5913. HIDE: 'hide',
  5914. SHOW: 'show',
  5915. SHOWING: 'showing'
  5916. };
  5917. var DefaultType$7 = {
  5918. animation: 'boolean',
  5919. autohide: 'boolean',
  5920. delay: 'number'
  5921. };
  5922. var Default$7 = {
  5923. animation: true,
  5924. autohide: true,
  5925. delay: 500
  5926. };
  5927. var Selector$a = {
  5928. DATA_DISMISS: '[data-dismiss="toast"]'
  5929. };
  5930. /**
  5931. * ------------------------------------------------------------------------
  5932. * Class Definition
  5933. * ------------------------------------------------------------------------
  5934. */
  5935. var Toast =
  5936. /*#__PURE__*/
  5937. function () {
  5938. function Toast(element, config) {
  5939. this._element = element;
  5940. this._config = this._getConfig(config);
  5941. this._timeout = null;
  5942. this._setListeners();
  5943. } // Getters
  5944. var _proto = Toast.prototype;
  5945. // Public
  5946. _proto.show = function show() {
  5947. var _this = this;
  5948. var showEvent = $.Event(Event$a.SHOW);
  5949. $(this._element).trigger(showEvent);
  5950. if (showEvent.isDefaultPrevented()) {
  5951. return;
  5952. }
  5953. if (this._config.animation) {
  5954. this._element.classList.add(ClassName$a.FADE);
  5955. }
  5956. var complete = function complete() {
  5957. _this._element.classList.remove(ClassName$a.SHOWING);
  5958. _this._element.classList.add(ClassName$a.SHOW);
  5959. $(_this._element).trigger(Event$a.SHOWN);
  5960. if (_this._config.autohide) {
  5961. _this._timeout = setTimeout(function () {
  5962. _this.hide();
  5963. }, _this._config.delay);
  5964. }
  5965. };
  5966. this._element.classList.remove(ClassName$a.HIDE);
  5967. Util.reflow(this._element);
  5968. this._element.classList.add(ClassName$a.SHOWING);
  5969. if (this._config.animation) {
  5970. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5971. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5972. } else {
  5973. complete();
  5974. }
  5975. };
  5976. _proto.hide = function hide() {
  5977. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5978. return;
  5979. }
  5980. var hideEvent = $.Event(Event$a.HIDE);
  5981. $(this._element).trigger(hideEvent);
  5982. if (hideEvent.isDefaultPrevented()) {
  5983. return;
  5984. }
  5985. this._close();
  5986. };
  5987. _proto.dispose = function dispose() {
  5988. clearTimeout(this._timeout);
  5989. this._timeout = null;
  5990. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5991. this._element.classList.remove(ClassName$a.SHOW);
  5992. }
  5993. $(this._element).off(Event$a.CLICK_DISMISS);
  5994. $.removeData(this._element, DATA_KEY$a);
  5995. this._element = null;
  5996. this._config = null;
  5997. } // Private
  5998. ;
  5999. _proto._getConfig = function _getConfig(config) {
  6000. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6001. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6002. return config;
  6003. };
  6004. _proto._setListeners = function _setListeners() {
  6005. var _this2 = this;
  6006. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6007. return _this2.hide();
  6008. });
  6009. };
  6010. _proto._close = function _close() {
  6011. var _this3 = this;
  6012. var complete = function complete() {
  6013. _this3._element.classList.add(ClassName$a.HIDE);
  6014. $(_this3._element).trigger(Event$a.HIDDEN);
  6015. };
  6016. this._element.classList.remove(ClassName$a.SHOW);
  6017. if (this._config.animation) {
  6018. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6019. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6020. } else {
  6021. complete();
  6022. }
  6023. } // Static
  6024. ;
  6025. Toast._jQueryInterface = function _jQueryInterface(config) {
  6026. return this.each(function () {
  6027. var $element = $(this);
  6028. var data = $element.data(DATA_KEY$a);
  6029. var _config = typeof config === 'object' && config;
  6030. if (!data) {
  6031. data = new Toast(this, _config);
  6032. $element.data(DATA_KEY$a, data);
  6033. }
  6034. if (typeof config === 'string') {
  6035. if (typeof data[config] === 'undefined') {
  6036. throw new TypeError("No method named \"" + config + "\"");
  6037. }
  6038. data[config](this);
  6039. }
  6040. });
  6041. };
  6042. _createClass(Toast, null, [{
  6043. key: "VERSION",
  6044. get: function get() {
  6045. return VERSION$a;
  6046. }
  6047. }, {
  6048. key: "DefaultType",
  6049. get: function get() {
  6050. return DefaultType$7;
  6051. }
  6052. }, {
  6053. key: "Default",
  6054. get: function get() {
  6055. return Default$7;
  6056. }
  6057. }]);
  6058. return Toast;
  6059. }();
  6060. /**
  6061. * ------------------------------------------------------------------------
  6062. * jQuery
  6063. * ------------------------------------------------------------------------
  6064. */
  6065. $.fn[NAME$a] = Toast._jQueryInterface;
  6066. $.fn[NAME$a].Constructor = Toast;
  6067. $.fn[NAME$a].noConflict = function () {
  6068. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6069. return Toast._jQueryInterface;
  6070. };
  6071. exports.Alert = Alert;
  6072. exports.Button = Button;
  6073. exports.Carousel = Carousel;
  6074. exports.Collapse = Collapse;
  6075. exports.Dropdown = Dropdown;
  6076. exports.Modal = Modal;
  6077. exports.Popover = Popover;
  6078. exports.Scrollspy = ScrollSpy;
  6079. exports.Tab = Tab;
  6080. exports.Toast = Toast;
  6081. exports.Tooltip = Tooltip;
  6082. exports.Util = Util;
  6083. Object.defineProperty(exports, '__esModule', { value: true });
  6084. })));
  6085. //# sourceMappingURL=bootstrap.js.map
  6086. /***/ }),
  6087. /***/ "./node_modules/buffer/index.js":
  6088. /*!**************************************!*\
  6089. !*** ./node_modules/buffer/index.js ***!
  6090. \**************************************/
  6091. /*! no static exports found */
  6092. /***/ (function(module, exports, __webpack_require__) {
  6093. "use strict";
  6094. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6095. * The buffer module from node.js, for the browser.
  6096. *
  6097. * @author Feross Aboukhadijeh <http://feross.org>
  6098. * @license MIT
  6099. */
  6100. /* eslint-disable no-proto */
  6101. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6102. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6103. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6104. exports.Buffer = Buffer
  6105. exports.SlowBuffer = SlowBuffer
  6106. exports.INSPECT_MAX_BYTES = 50
  6107. /**
  6108. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6109. * === true Use Uint8Array implementation (fastest)
  6110. * === false Use Object implementation (most compatible, even IE6)
  6111. *
  6112. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6113. * Opera 11.6+, iOS 4.2+.
  6114. *
  6115. * Due to various browser bugs, sometimes the Object implementation will be used even
  6116. * when the browser supports typed arrays.
  6117. *
  6118. * Note:
  6119. *
  6120. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6121. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6122. *
  6123. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6124. *
  6125. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6126. * incorrect length in some situations.
  6127. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6128. * get the Object implementation, which is slower but behaves correctly.
  6129. */
  6130. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6131. ? global.TYPED_ARRAY_SUPPORT
  6132. : typedArraySupport()
  6133. /*
  6134. * Export kMaxLength after typed array support is determined.
  6135. */
  6136. exports.kMaxLength = kMaxLength()
  6137. function typedArraySupport () {
  6138. try {
  6139. var arr = new Uint8Array(1)
  6140. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6141. return arr.foo() === 42 && // typed array instances can be augmented
  6142. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6143. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6144. } catch (e) {
  6145. return false
  6146. }
  6147. }
  6148. function kMaxLength () {
  6149. return Buffer.TYPED_ARRAY_SUPPORT
  6150. ? 0x7fffffff
  6151. : 0x3fffffff
  6152. }
  6153. function createBuffer (that, length) {
  6154. if (kMaxLength() < length) {
  6155. throw new RangeError('Invalid typed array length')
  6156. }
  6157. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6158. // Return an augmented `Uint8Array` instance, for best performance
  6159. that = new Uint8Array(length)
  6160. that.__proto__ = Buffer.prototype
  6161. } else {
  6162. // Fallback: Return an object instance of the Buffer class
  6163. if (that === null) {
  6164. that = new Buffer(length)
  6165. }
  6166. that.length = length
  6167. }
  6168. return that
  6169. }
  6170. /**
  6171. * The Buffer constructor returns instances of `Uint8Array` that have their
  6172. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6173. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6174. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6175. * returns a single octet.
  6176. *
  6177. * The `Uint8Array` prototype remains unmodified.
  6178. */
  6179. function Buffer (arg, encodingOrOffset, length) {
  6180. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6181. return new Buffer(arg, encodingOrOffset, length)
  6182. }
  6183. // Common case.
  6184. if (typeof arg === 'number') {
  6185. if (typeof encodingOrOffset === 'string') {
  6186. throw new Error(
  6187. 'If encoding is specified then the first argument must be a string'
  6188. )
  6189. }
  6190. return allocUnsafe(this, arg)
  6191. }
  6192. return from(this, arg, encodingOrOffset, length)
  6193. }
  6194. Buffer.poolSize = 8192 // not used by this implementation
  6195. // TODO: Legacy, not needed anymore. Remove in next major version.
  6196. Buffer._augment = function (arr) {
  6197. arr.__proto__ = Buffer.prototype
  6198. return arr
  6199. }
  6200. function from (that, value, encodingOrOffset, length) {
  6201. if (typeof value === 'number') {
  6202. throw new TypeError('"value" argument must not be a number')
  6203. }
  6204. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6205. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6206. }
  6207. if (typeof value === 'string') {
  6208. return fromString(that, value, encodingOrOffset)
  6209. }
  6210. return fromObject(that, value)
  6211. }
  6212. /**
  6213. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6214. * if value is a number.
  6215. * Buffer.from(str[, encoding])
  6216. * Buffer.from(array)
  6217. * Buffer.from(buffer)
  6218. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6219. **/
  6220. Buffer.from = function (value, encodingOrOffset, length) {
  6221. return from(null, value, encodingOrOffset, length)
  6222. }
  6223. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6224. Buffer.prototype.__proto__ = Uint8Array.prototype
  6225. Buffer.__proto__ = Uint8Array
  6226. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6227. Buffer[Symbol.species] === Buffer) {
  6228. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6229. Object.defineProperty(Buffer, Symbol.species, {
  6230. value: null,
  6231. configurable: true
  6232. })
  6233. }
  6234. }
  6235. function assertSize (size) {
  6236. if (typeof size !== 'number') {
  6237. throw new TypeError('"size" argument must be a number')
  6238. } else if (size < 0) {
  6239. throw new RangeError('"size" argument must not be negative')
  6240. }
  6241. }
  6242. function alloc (that, size, fill, encoding) {
  6243. assertSize(size)
  6244. if (size <= 0) {
  6245. return createBuffer(that, size)
  6246. }
  6247. if (fill !== undefined) {
  6248. // Only pay attention to encoding if it's a string. This
  6249. // prevents accidentally sending in a number that would
  6250. // be interpretted as a start offset.
  6251. return typeof encoding === 'string'
  6252. ? createBuffer(that, size).fill(fill, encoding)
  6253. : createBuffer(that, size).fill(fill)
  6254. }
  6255. return createBuffer(that, size)
  6256. }
  6257. /**
  6258. * Creates a new filled Buffer instance.
  6259. * alloc(size[, fill[, encoding]])
  6260. **/
  6261. Buffer.alloc = function (size, fill, encoding) {
  6262. return alloc(null, size, fill, encoding)
  6263. }
  6264. function allocUnsafe (that, size) {
  6265. assertSize(size)
  6266. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6267. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6268. for (var i = 0; i < size; ++i) {
  6269. that[i] = 0
  6270. }
  6271. }
  6272. return that
  6273. }
  6274. /**
  6275. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6276. * */
  6277. Buffer.allocUnsafe = function (size) {
  6278. return allocUnsafe(null, size)
  6279. }
  6280. /**
  6281. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6282. */
  6283. Buffer.allocUnsafeSlow = function (size) {
  6284. return allocUnsafe(null, size)
  6285. }
  6286. function fromString (that, string, encoding) {
  6287. if (typeof encoding !== 'string' || encoding === '') {
  6288. encoding = 'utf8'
  6289. }
  6290. if (!Buffer.isEncoding(encoding)) {
  6291. throw new TypeError('"encoding" must be a valid string encoding')
  6292. }
  6293. var length = byteLength(string, encoding) | 0
  6294. that = createBuffer(that, length)
  6295. var actual = that.write(string, encoding)
  6296. if (actual !== length) {
  6297. // Writing a hex string, for example, that contains invalid characters will
  6298. // cause everything after the first invalid character to be ignored. (e.g.
  6299. // 'abxxcd' will be treated as 'ab')
  6300. that = that.slice(0, actual)
  6301. }
  6302. return that
  6303. }
  6304. function fromArrayLike (that, array) {
  6305. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6306. that = createBuffer(that, length)
  6307. for (var i = 0; i < length; i += 1) {
  6308. that[i] = array[i] & 255
  6309. }
  6310. return that
  6311. }
  6312. function fromArrayBuffer (that, array, byteOffset, length) {
  6313. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6314. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6315. throw new RangeError('\'offset\' is out of bounds')
  6316. }
  6317. if (array.byteLength < byteOffset + (length || 0)) {
  6318. throw new RangeError('\'length\' is out of bounds')
  6319. }
  6320. if (byteOffset === undefined && length === undefined) {
  6321. array = new Uint8Array(array)
  6322. } else if (length === undefined) {
  6323. array = new Uint8Array(array, byteOffset)
  6324. } else {
  6325. array = new Uint8Array(array, byteOffset, length)
  6326. }
  6327. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6328. // Return an augmented `Uint8Array` instance, for best performance
  6329. that = array
  6330. that.__proto__ = Buffer.prototype
  6331. } else {
  6332. // Fallback: Return an object instance of the Buffer class
  6333. that = fromArrayLike(that, array)
  6334. }
  6335. return that
  6336. }
  6337. function fromObject (that, obj) {
  6338. if (Buffer.isBuffer(obj)) {
  6339. var len = checked(obj.length) | 0
  6340. that = createBuffer(that, len)
  6341. if (that.length === 0) {
  6342. return that
  6343. }
  6344. obj.copy(that, 0, 0, len)
  6345. return that
  6346. }
  6347. if (obj) {
  6348. if ((typeof ArrayBuffer !== 'undefined' &&
  6349. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6350. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6351. return createBuffer(that, 0)
  6352. }
  6353. return fromArrayLike(that, obj)
  6354. }
  6355. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6356. return fromArrayLike(that, obj.data)
  6357. }
  6358. }
  6359. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6360. }
  6361. function checked (length) {
  6362. // Note: cannot use `length < kMaxLength()` here because that fails when
  6363. // length is NaN (which is otherwise coerced to zero.)
  6364. if (length >= kMaxLength()) {
  6365. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6366. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6367. }
  6368. return length | 0
  6369. }
  6370. function SlowBuffer (length) {
  6371. if (+length != length) { // eslint-disable-line eqeqeq
  6372. length = 0
  6373. }
  6374. return Buffer.alloc(+length)
  6375. }
  6376. Buffer.isBuffer = function isBuffer (b) {
  6377. return !!(b != null && b._isBuffer)
  6378. }
  6379. Buffer.compare = function compare (a, b) {
  6380. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6381. throw new TypeError('Arguments must be Buffers')
  6382. }
  6383. if (a === b) return 0
  6384. var x = a.length
  6385. var y = b.length
  6386. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6387. if (a[i] !== b[i]) {
  6388. x = a[i]
  6389. y = b[i]
  6390. break
  6391. }
  6392. }
  6393. if (x < y) return -1
  6394. if (y < x) return 1
  6395. return 0
  6396. }
  6397. Buffer.isEncoding = function isEncoding (encoding) {
  6398. switch (String(encoding).toLowerCase()) {
  6399. case 'hex':
  6400. case 'utf8':
  6401. case 'utf-8':
  6402. case 'ascii':
  6403. case 'latin1':
  6404. case 'binary':
  6405. case 'base64':
  6406. case 'ucs2':
  6407. case 'ucs-2':
  6408. case 'utf16le':
  6409. case 'utf-16le':
  6410. return true
  6411. default:
  6412. return false
  6413. }
  6414. }
  6415. Buffer.concat = function concat (list, length) {
  6416. if (!isArray(list)) {
  6417. throw new TypeError('"list" argument must be an Array of Buffers')
  6418. }
  6419. if (list.length === 0) {
  6420. return Buffer.alloc(0)
  6421. }
  6422. var i
  6423. if (length === undefined) {
  6424. length = 0
  6425. for (i = 0; i < list.length; ++i) {
  6426. length += list[i].length
  6427. }
  6428. }
  6429. var buffer = Buffer.allocUnsafe(length)
  6430. var pos = 0
  6431. for (i = 0; i < list.length; ++i) {
  6432. var buf = list[i]
  6433. if (!Buffer.isBuffer(buf)) {
  6434. throw new TypeError('"list" argument must be an Array of Buffers')
  6435. }
  6436. buf.copy(buffer, pos)
  6437. pos += buf.length
  6438. }
  6439. return buffer
  6440. }
  6441. function byteLength (string, encoding) {
  6442. if (Buffer.isBuffer(string)) {
  6443. return string.length
  6444. }
  6445. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6446. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6447. return string.byteLength
  6448. }
  6449. if (typeof string !== 'string') {
  6450. string = '' + string
  6451. }
  6452. var len = string.length
  6453. if (len === 0) return 0
  6454. // Use a for loop to avoid recursion
  6455. var loweredCase = false
  6456. for (;;) {
  6457. switch (encoding) {
  6458. case 'ascii':
  6459. case 'latin1':
  6460. case 'binary':
  6461. return len
  6462. case 'utf8':
  6463. case 'utf-8':
  6464. case undefined:
  6465. return utf8ToBytes(string).length
  6466. case 'ucs2':
  6467. case 'ucs-2':
  6468. case 'utf16le':
  6469. case 'utf-16le':
  6470. return len * 2
  6471. case 'hex':
  6472. return len >>> 1
  6473. case 'base64':
  6474. return base64ToBytes(string).length
  6475. default:
  6476. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6477. encoding = ('' + encoding).toLowerCase()
  6478. loweredCase = true
  6479. }
  6480. }
  6481. }
  6482. Buffer.byteLength = byteLength
  6483. function slowToString (encoding, start, end) {
  6484. var loweredCase = false
  6485. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6486. // property of a typed array.
  6487. // This behaves neither like String nor Uint8Array in that we set start/end
  6488. // to their upper/lower bounds if the value passed is out of range.
  6489. // undefined is handled specially as per ECMA-262 6th Edition,
  6490. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6491. if (start === undefined || start < 0) {
  6492. start = 0
  6493. }
  6494. // Return early if start > this.length. Done here to prevent potential uint32
  6495. // coercion fail below.
  6496. if (start > this.length) {
  6497. return ''
  6498. }
  6499. if (end === undefined || end > this.length) {
  6500. end = this.length
  6501. }
  6502. if (end <= 0) {
  6503. return ''
  6504. }
  6505. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6506. end >>>= 0
  6507. start >>>= 0
  6508. if (end <= start) {
  6509. return ''
  6510. }
  6511. if (!encoding) encoding = 'utf8'
  6512. while (true) {
  6513. switch (encoding) {
  6514. case 'hex':
  6515. return hexSlice(this, start, end)
  6516. case 'utf8':
  6517. case 'utf-8':
  6518. return utf8Slice(this, start, end)
  6519. case 'ascii':
  6520. return asciiSlice(this, start, end)
  6521. case 'latin1':
  6522. case 'binary':
  6523. return latin1Slice(this, start, end)
  6524. case 'base64':
  6525. return base64Slice(this, start, end)
  6526. case 'ucs2':
  6527. case 'ucs-2':
  6528. case 'utf16le':
  6529. case 'utf-16le':
  6530. return utf16leSlice(this, start, end)
  6531. default:
  6532. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6533. encoding = (encoding + '').toLowerCase()
  6534. loweredCase = true
  6535. }
  6536. }
  6537. }
  6538. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6539. // Buffer instances.
  6540. Buffer.prototype._isBuffer = true
  6541. function swap (b, n, m) {
  6542. var i = b[n]
  6543. b[n] = b[m]
  6544. b[m] = i
  6545. }
  6546. Buffer.prototype.swap16 = function swap16 () {
  6547. var len = this.length
  6548. if (len % 2 !== 0) {
  6549. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6550. }
  6551. for (var i = 0; i < len; i += 2) {
  6552. swap(this, i, i + 1)
  6553. }
  6554. return this
  6555. }
  6556. Buffer.prototype.swap32 = function swap32 () {
  6557. var len = this.length
  6558. if (len % 4 !== 0) {
  6559. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6560. }
  6561. for (var i = 0; i < len; i += 4) {
  6562. swap(this, i, i + 3)
  6563. swap(this, i + 1, i + 2)
  6564. }
  6565. return this
  6566. }
  6567. Buffer.prototype.swap64 = function swap64 () {
  6568. var len = this.length
  6569. if (len % 8 !== 0) {
  6570. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6571. }
  6572. for (var i = 0; i < len; i += 8) {
  6573. swap(this, i, i + 7)
  6574. swap(this, i + 1, i + 6)
  6575. swap(this, i + 2, i + 5)
  6576. swap(this, i + 3, i + 4)
  6577. }
  6578. return this
  6579. }
  6580. Buffer.prototype.toString = function toString () {
  6581. var length = this.length | 0
  6582. if (length === 0) return ''
  6583. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6584. return slowToString.apply(this, arguments)
  6585. }
  6586. Buffer.prototype.equals = function equals (b) {
  6587. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6588. if (this === b) return true
  6589. return Buffer.compare(this, b) === 0
  6590. }
  6591. Buffer.prototype.inspect = function inspect () {
  6592. var str = ''
  6593. var max = exports.INSPECT_MAX_BYTES
  6594. if (this.length > 0) {
  6595. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6596. if (this.length > max) str += ' ... '
  6597. }
  6598. return '<Buffer ' + str + '>'
  6599. }
  6600. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6601. if (!Buffer.isBuffer(target)) {
  6602. throw new TypeError('Argument must be a Buffer')
  6603. }
  6604. if (start === undefined) {
  6605. start = 0
  6606. }
  6607. if (end === undefined) {
  6608. end = target ? target.length : 0
  6609. }
  6610. if (thisStart === undefined) {
  6611. thisStart = 0
  6612. }
  6613. if (thisEnd === undefined) {
  6614. thisEnd = this.length
  6615. }
  6616. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6617. throw new RangeError('out of range index')
  6618. }
  6619. if (thisStart >= thisEnd && start >= end) {
  6620. return 0
  6621. }
  6622. if (thisStart >= thisEnd) {
  6623. return -1
  6624. }
  6625. if (start >= end) {
  6626. return 1
  6627. }
  6628. start >>>= 0
  6629. end >>>= 0
  6630. thisStart >>>= 0
  6631. thisEnd >>>= 0
  6632. if (this === target) return 0
  6633. var x = thisEnd - thisStart
  6634. var y = end - start
  6635. var len = Math.min(x, y)
  6636. var thisCopy = this.slice(thisStart, thisEnd)
  6637. var targetCopy = target.slice(start, end)
  6638. for (var i = 0; i < len; ++i) {
  6639. if (thisCopy[i] !== targetCopy[i]) {
  6640. x = thisCopy[i]
  6641. y = targetCopy[i]
  6642. break
  6643. }
  6644. }
  6645. if (x < y) return -1
  6646. if (y < x) return 1
  6647. return 0
  6648. }
  6649. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6650. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6651. //
  6652. // Arguments:
  6653. // - buffer - a Buffer to search
  6654. // - val - a string, Buffer, or number
  6655. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6656. // - encoding - an optional encoding, relevant is val is a string
  6657. // - dir - true for indexOf, false for lastIndexOf
  6658. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6659. // Empty buffer means no match
  6660. if (buffer.length === 0) return -1
  6661. // Normalize byteOffset
  6662. if (typeof byteOffset === 'string') {
  6663. encoding = byteOffset
  6664. byteOffset = 0
  6665. } else if (byteOffset > 0x7fffffff) {
  6666. byteOffset = 0x7fffffff
  6667. } else if (byteOffset < -0x80000000) {
  6668. byteOffset = -0x80000000
  6669. }
  6670. byteOffset = +byteOffset // Coerce to Number.
  6671. if (isNaN(byteOffset)) {
  6672. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6673. byteOffset = dir ? 0 : (buffer.length - 1)
  6674. }
  6675. // Normalize byteOffset: negative offsets start from the end of the buffer
  6676. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6677. if (byteOffset >= buffer.length) {
  6678. if (dir) return -1
  6679. else byteOffset = buffer.length - 1
  6680. } else if (byteOffset < 0) {
  6681. if (dir) byteOffset = 0
  6682. else return -1
  6683. }
  6684. // Normalize val
  6685. if (typeof val === 'string') {
  6686. val = Buffer.from(val, encoding)
  6687. }
  6688. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6689. if (Buffer.isBuffer(val)) {
  6690. // Special case: looking for empty string/buffer always fails
  6691. if (val.length === 0) {
  6692. return -1
  6693. }
  6694. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6695. } else if (typeof val === 'number') {
  6696. val = val & 0xFF // Search for a byte value [0-255]
  6697. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6698. typeof Uint8Array.prototype.indexOf === 'function') {
  6699. if (dir) {
  6700. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6701. } else {
  6702. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6703. }
  6704. }
  6705. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6706. }
  6707. throw new TypeError('val must be string, number or Buffer')
  6708. }
  6709. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6710. var indexSize = 1
  6711. var arrLength = arr.length
  6712. var valLength = val.length
  6713. if (encoding !== undefined) {
  6714. encoding = String(encoding).toLowerCase()
  6715. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6716. encoding === 'utf16le' || encoding === 'utf-16le') {
  6717. if (arr.length < 2 || val.length < 2) {
  6718. return -1
  6719. }
  6720. indexSize = 2
  6721. arrLength /= 2
  6722. valLength /= 2
  6723. byteOffset /= 2
  6724. }
  6725. }
  6726. function read (buf, i) {
  6727. if (indexSize === 1) {
  6728. return buf[i]
  6729. } else {
  6730. return buf.readUInt16BE(i * indexSize)
  6731. }
  6732. }
  6733. var i
  6734. if (dir) {
  6735. var foundIndex = -1
  6736. for (i = byteOffset; i < arrLength; i++) {
  6737. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6738. if (foundIndex === -1) foundIndex = i
  6739. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6740. } else {
  6741. if (foundIndex !== -1) i -= i - foundIndex
  6742. foundIndex = -1
  6743. }
  6744. }
  6745. } else {
  6746. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6747. for (i = byteOffset; i >= 0; i--) {
  6748. var found = true
  6749. for (var j = 0; j < valLength; j++) {
  6750. if (read(arr, i + j) !== read(val, j)) {
  6751. found = false
  6752. break
  6753. }
  6754. }
  6755. if (found) return i
  6756. }
  6757. }
  6758. return -1
  6759. }
  6760. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6761. return this.indexOf(val, byteOffset, encoding) !== -1
  6762. }
  6763. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6764. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6765. }
  6766. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6767. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6768. }
  6769. function hexWrite (buf, string, offset, length) {
  6770. offset = Number(offset) || 0
  6771. var remaining = buf.length - offset
  6772. if (!length) {
  6773. length = remaining
  6774. } else {
  6775. length = Number(length)
  6776. if (length > remaining) {
  6777. length = remaining
  6778. }
  6779. }
  6780. // must be an even number of digits
  6781. var strLen = string.length
  6782. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6783. if (length > strLen / 2) {
  6784. length = strLen / 2
  6785. }
  6786. for (var i = 0; i < length; ++i) {
  6787. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6788. if (isNaN(parsed)) return i
  6789. buf[offset + i] = parsed
  6790. }
  6791. return i
  6792. }
  6793. function utf8Write (buf, string, offset, length) {
  6794. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6795. }
  6796. function asciiWrite (buf, string, offset, length) {
  6797. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6798. }
  6799. function latin1Write (buf, string, offset, length) {
  6800. return asciiWrite(buf, string, offset, length)
  6801. }
  6802. function base64Write (buf, string, offset, length) {
  6803. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6804. }
  6805. function ucs2Write (buf, string, offset, length) {
  6806. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6807. }
  6808. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6809. // Buffer#write(string)
  6810. if (offset === undefined) {
  6811. encoding = 'utf8'
  6812. length = this.length
  6813. offset = 0
  6814. // Buffer#write(string, encoding)
  6815. } else if (length === undefined && typeof offset === 'string') {
  6816. encoding = offset
  6817. length = this.length
  6818. offset = 0
  6819. // Buffer#write(string, offset[, length][, encoding])
  6820. } else if (isFinite(offset)) {
  6821. offset = offset | 0
  6822. if (isFinite(length)) {
  6823. length = length | 0
  6824. if (encoding === undefined) encoding = 'utf8'
  6825. } else {
  6826. encoding = length
  6827. length = undefined
  6828. }
  6829. // legacy write(string, encoding, offset, length) - remove in v0.13
  6830. } else {
  6831. throw new Error(
  6832. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6833. )
  6834. }
  6835. var remaining = this.length - offset
  6836. if (length === undefined || length > remaining) length = remaining
  6837. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6838. throw new RangeError('Attempt to write outside buffer bounds')
  6839. }
  6840. if (!encoding) encoding = 'utf8'
  6841. var loweredCase = false
  6842. for (;;) {
  6843. switch (encoding) {
  6844. case 'hex':
  6845. return hexWrite(this, string, offset, length)
  6846. case 'utf8':
  6847. case 'utf-8':
  6848. return utf8Write(this, string, offset, length)
  6849. case 'ascii':
  6850. return asciiWrite(this, string, offset, length)
  6851. case 'latin1':
  6852. case 'binary':
  6853. return latin1Write(this, string, offset, length)
  6854. case 'base64':
  6855. // Warning: maxLength not taken into account in base64Write
  6856. return base64Write(this, string, offset, length)
  6857. case 'ucs2':
  6858. case 'ucs-2':
  6859. case 'utf16le':
  6860. case 'utf-16le':
  6861. return ucs2Write(this, string, offset, length)
  6862. default:
  6863. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6864. encoding = ('' + encoding).toLowerCase()
  6865. loweredCase = true
  6866. }
  6867. }
  6868. }
  6869. Buffer.prototype.toJSON = function toJSON () {
  6870. return {
  6871. type: 'Buffer',
  6872. data: Array.prototype.slice.call(this._arr || this, 0)
  6873. }
  6874. }
  6875. function base64Slice (buf, start, end) {
  6876. if (start === 0 && end === buf.length) {
  6877. return base64.fromByteArray(buf)
  6878. } else {
  6879. return base64.fromByteArray(buf.slice(start, end))
  6880. }
  6881. }
  6882. function utf8Slice (buf, start, end) {
  6883. end = Math.min(buf.length, end)
  6884. var res = []
  6885. var i = start
  6886. while (i < end) {
  6887. var firstByte = buf[i]
  6888. var codePoint = null
  6889. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6890. : (firstByte > 0xDF) ? 3
  6891. : (firstByte > 0xBF) ? 2
  6892. : 1
  6893. if (i + bytesPerSequence <= end) {
  6894. var secondByte, thirdByte, fourthByte, tempCodePoint
  6895. switch (bytesPerSequence) {
  6896. case 1:
  6897. if (firstByte < 0x80) {
  6898. codePoint = firstByte
  6899. }
  6900. break
  6901. case 2:
  6902. secondByte = buf[i + 1]
  6903. if ((secondByte & 0xC0) === 0x80) {
  6904. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6905. if (tempCodePoint > 0x7F) {
  6906. codePoint = tempCodePoint
  6907. }
  6908. }
  6909. break
  6910. case 3:
  6911. secondByte = buf[i + 1]
  6912. thirdByte = buf[i + 2]
  6913. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6914. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6915. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6916. codePoint = tempCodePoint
  6917. }
  6918. }
  6919. break
  6920. case 4:
  6921. secondByte = buf[i + 1]
  6922. thirdByte = buf[i + 2]
  6923. fourthByte = buf[i + 3]
  6924. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6925. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6926. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6927. codePoint = tempCodePoint
  6928. }
  6929. }
  6930. }
  6931. }
  6932. if (codePoint === null) {
  6933. // we did not generate a valid codePoint so insert a
  6934. // replacement char (U+FFFD) and advance only 1 byte
  6935. codePoint = 0xFFFD
  6936. bytesPerSequence = 1
  6937. } else if (codePoint > 0xFFFF) {
  6938. // encode to utf16 (surrogate pair dance)
  6939. codePoint -= 0x10000
  6940. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6941. codePoint = 0xDC00 | codePoint & 0x3FF
  6942. }
  6943. res.push(codePoint)
  6944. i += bytesPerSequence
  6945. }
  6946. return decodeCodePointsArray(res)
  6947. }
  6948. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6949. // the lowest limit is Chrome, with 0x10000 args.
  6950. // We go 1 magnitude less, for safety
  6951. var MAX_ARGUMENTS_LENGTH = 0x1000
  6952. function decodeCodePointsArray (codePoints) {
  6953. var len = codePoints.length
  6954. if (len <= MAX_ARGUMENTS_LENGTH) {
  6955. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6956. }
  6957. // Decode in chunks to avoid "call stack size exceeded".
  6958. var res = ''
  6959. var i = 0
  6960. while (i < len) {
  6961. res += String.fromCharCode.apply(
  6962. String,
  6963. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6964. )
  6965. }
  6966. return res
  6967. }
  6968. function asciiSlice (buf, start, end) {
  6969. var ret = ''
  6970. end = Math.min(buf.length, end)
  6971. for (var i = start; i < end; ++i) {
  6972. ret += String.fromCharCode(buf[i] & 0x7F)
  6973. }
  6974. return ret
  6975. }
  6976. function latin1Slice (buf, start, end) {
  6977. var ret = ''
  6978. end = Math.min(buf.length, end)
  6979. for (var i = start; i < end; ++i) {
  6980. ret += String.fromCharCode(buf[i])
  6981. }
  6982. return ret
  6983. }
  6984. function hexSlice (buf, start, end) {
  6985. var len = buf.length
  6986. if (!start || start < 0) start = 0
  6987. if (!end || end < 0 || end > len) end = len
  6988. var out = ''
  6989. for (var i = start; i < end; ++i) {
  6990. out += toHex(buf[i])
  6991. }
  6992. return out
  6993. }
  6994. function utf16leSlice (buf, start, end) {
  6995. var bytes = buf.slice(start, end)
  6996. var res = ''
  6997. for (var i = 0; i < bytes.length; i += 2) {
  6998. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6999. }
  7000. return res
  7001. }
  7002. Buffer.prototype.slice = function slice (start, end) {
  7003. var len = this.length
  7004. start = ~~start
  7005. end = end === undefined ? len : ~~end
  7006. if (start < 0) {
  7007. start += len
  7008. if (start < 0) start = 0
  7009. } else if (start > len) {
  7010. start = len
  7011. }
  7012. if (end < 0) {
  7013. end += len
  7014. if (end < 0) end = 0
  7015. } else if (end > len) {
  7016. end = len
  7017. }
  7018. if (end < start) end = start
  7019. var newBuf
  7020. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7021. newBuf = this.subarray(start, end)
  7022. newBuf.__proto__ = Buffer.prototype
  7023. } else {
  7024. var sliceLen = end - start
  7025. newBuf = new Buffer(sliceLen, undefined)
  7026. for (var i = 0; i < sliceLen; ++i) {
  7027. newBuf[i] = this[i + start]
  7028. }
  7029. }
  7030. return newBuf
  7031. }
  7032. /*
  7033. * Need to make sure that buffer isn't trying to write out of bounds.
  7034. */
  7035. function checkOffset (offset, ext, length) {
  7036. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7037. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7038. }
  7039. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7040. offset = offset | 0
  7041. byteLength = byteLength | 0
  7042. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7043. var val = this[offset]
  7044. var mul = 1
  7045. var i = 0
  7046. while (++i < byteLength && (mul *= 0x100)) {
  7047. val += this[offset + i] * mul
  7048. }
  7049. return val
  7050. }
  7051. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7052. offset = offset | 0
  7053. byteLength = byteLength | 0
  7054. if (!noAssert) {
  7055. checkOffset(offset, byteLength, this.length)
  7056. }
  7057. var val = this[offset + --byteLength]
  7058. var mul = 1
  7059. while (byteLength > 0 && (mul *= 0x100)) {
  7060. val += this[offset + --byteLength] * mul
  7061. }
  7062. return val
  7063. }
  7064. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7065. if (!noAssert) checkOffset(offset, 1, this.length)
  7066. return this[offset]
  7067. }
  7068. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7069. if (!noAssert) checkOffset(offset, 2, this.length)
  7070. return this[offset] | (this[offset + 1] << 8)
  7071. }
  7072. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7073. if (!noAssert) checkOffset(offset, 2, this.length)
  7074. return (this[offset] << 8) | this[offset + 1]
  7075. }
  7076. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7077. if (!noAssert) checkOffset(offset, 4, this.length)
  7078. return ((this[offset]) |
  7079. (this[offset + 1] << 8) |
  7080. (this[offset + 2] << 16)) +
  7081. (this[offset + 3] * 0x1000000)
  7082. }
  7083. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7084. if (!noAssert) checkOffset(offset, 4, this.length)
  7085. return (this[offset] * 0x1000000) +
  7086. ((this[offset + 1] << 16) |
  7087. (this[offset + 2] << 8) |
  7088. this[offset + 3])
  7089. }
  7090. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7091. offset = offset | 0
  7092. byteLength = byteLength | 0
  7093. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7094. var val = this[offset]
  7095. var mul = 1
  7096. var i = 0
  7097. while (++i < byteLength && (mul *= 0x100)) {
  7098. val += this[offset + i] * mul
  7099. }
  7100. mul *= 0x80
  7101. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7102. return val
  7103. }
  7104. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7105. offset = offset | 0
  7106. byteLength = byteLength | 0
  7107. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7108. var i = byteLength
  7109. var mul = 1
  7110. var val = this[offset + --i]
  7111. while (i > 0 && (mul *= 0x100)) {
  7112. val += this[offset + --i] * mul
  7113. }
  7114. mul *= 0x80
  7115. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7116. return val
  7117. }
  7118. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7119. if (!noAssert) checkOffset(offset, 1, this.length)
  7120. if (!(this[offset] & 0x80)) return (this[offset])
  7121. return ((0xff - this[offset] + 1) * -1)
  7122. }
  7123. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7124. if (!noAssert) checkOffset(offset, 2, this.length)
  7125. var val = this[offset] | (this[offset + 1] << 8)
  7126. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7127. }
  7128. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7129. if (!noAssert) checkOffset(offset, 2, this.length)
  7130. var val = this[offset + 1] | (this[offset] << 8)
  7131. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7132. }
  7133. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7134. if (!noAssert) checkOffset(offset, 4, this.length)
  7135. return (this[offset]) |
  7136. (this[offset + 1] << 8) |
  7137. (this[offset + 2] << 16) |
  7138. (this[offset + 3] << 24)
  7139. }
  7140. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7141. if (!noAssert) checkOffset(offset, 4, this.length)
  7142. return (this[offset] << 24) |
  7143. (this[offset + 1] << 16) |
  7144. (this[offset + 2] << 8) |
  7145. (this[offset + 3])
  7146. }
  7147. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7148. if (!noAssert) checkOffset(offset, 4, this.length)
  7149. return ieee754.read(this, offset, true, 23, 4)
  7150. }
  7151. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7152. if (!noAssert) checkOffset(offset, 4, this.length)
  7153. return ieee754.read(this, offset, false, 23, 4)
  7154. }
  7155. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7156. if (!noAssert) checkOffset(offset, 8, this.length)
  7157. return ieee754.read(this, offset, true, 52, 8)
  7158. }
  7159. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7160. if (!noAssert) checkOffset(offset, 8, this.length)
  7161. return ieee754.read(this, offset, false, 52, 8)
  7162. }
  7163. function checkInt (buf, value, offset, ext, max, min) {
  7164. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7165. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7166. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7167. }
  7168. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7169. value = +value
  7170. offset = offset | 0
  7171. byteLength = byteLength | 0
  7172. if (!noAssert) {
  7173. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7174. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7175. }
  7176. var mul = 1
  7177. var i = 0
  7178. this[offset] = value & 0xFF
  7179. while (++i < byteLength && (mul *= 0x100)) {
  7180. this[offset + i] = (value / mul) & 0xFF
  7181. }
  7182. return offset + byteLength
  7183. }
  7184. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7185. value = +value
  7186. offset = offset | 0
  7187. byteLength = byteLength | 0
  7188. if (!noAssert) {
  7189. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7190. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7191. }
  7192. var i = byteLength - 1
  7193. var mul = 1
  7194. this[offset + i] = value & 0xFF
  7195. while (--i >= 0 && (mul *= 0x100)) {
  7196. this[offset + i] = (value / mul) & 0xFF
  7197. }
  7198. return offset + byteLength
  7199. }
  7200. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7201. value = +value
  7202. offset = offset | 0
  7203. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7204. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7205. this[offset] = (value & 0xff)
  7206. return offset + 1
  7207. }
  7208. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7209. if (value < 0) value = 0xffff + value + 1
  7210. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7211. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7212. (littleEndian ? i : 1 - i) * 8
  7213. }
  7214. }
  7215. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7216. value = +value
  7217. offset = offset | 0
  7218. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7219. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7220. this[offset] = (value & 0xff)
  7221. this[offset + 1] = (value >>> 8)
  7222. } else {
  7223. objectWriteUInt16(this, value, offset, true)
  7224. }
  7225. return offset + 2
  7226. }
  7227. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7228. value = +value
  7229. offset = offset | 0
  7230. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7231. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7232. this[offset] = (value >>> 8)
  7233. this[offset + 1] = (value & 0xff)
  7234. } else {
  7235. objectWriteUInt16(this, value, offset, false)
  7236. }
  7237. return offset + 2
  7238. }
  7239. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7240. if (value < 0) value = 0xffffffff + value + 1
  7241. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7242. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7243. }
  7244. }
  7245. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7246. value = +value
  7247. offset = offset | 0
  7248. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7249. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7250. this[offset + 3] = (value >>> 24)
  7251. this[offset + 2] = (value >>> 16)
  7252. this[offset + 1] = (value >>> 8)
  7253. this[offset] = (value & 0xff)
  7254. } else {
  7255. objectWriteUInt32(this, value, offset, true)
  7256. }
  7257. return offset + 4
  7258. }
  7259. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7260. value = +value
  7261. offset = offset | 0
  7262. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7263. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7264. this[offset] = (value >>> 24)
  7265. this[offset + 1] = (value >>> 16)
  7266. this[offset + 2] = (value >>> 8)
  7267. this[offset + 3] = (value & 0xff)
  7268. } else {
  7269. objectWriteUInt32(this, value, offset, false)
  7270. }
  7271. return offset + 4
  7272. }
  7273. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7274. value = +value
  7275. offset = offset | 0
  7276. if (!noAssert) {
  7277. var limit = Math.pow(2, 8 * byteLength - 1)
  7278. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7279. }
  7280. var i = 0
  7281. var mul = 1
  7282. var sub = 0
  7283. this[offset] = value & 0xFF
  7284. while (++i < byteLength && (mul *= 0x100)) {
  7285. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7286. sub = 1
  7287. }
  7288. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7289. }
  7290. return offset + byteLength
  7291. }
  7292. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7293. value = +value
  7294. offset = offset | 0
  7295. if (!noAssert) {
  7296. var limit = Math.pow(2, 8 * byteLength - 1)
  7297. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7298. }
  7299. var i = byteLength - 1
  7300. var mul = 1
  7301. var sub = 0
  7302. this[offset + i] = value & 0xFF
  7303. while (--i >= 0 && (mul *= 0x100)) {
  7304. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7305. sub = 1
  7306. }
  7307. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7308. }
  7309. return offset + byteLength
  7310. }
  7311. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7312. value = +value
  7313. offset = offset | 0
  7314. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7315. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7316. if (value < 0) value = 0xff + value + 1
  7317. this[offset] = (value & 0xff)
  7318. return offset + 1
  7319. }
  7320. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7321. value = +value
  7322. offset = offset | 0
  7323. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7324. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7325. this[offset] = (value & 0xff)
  7326. this[offset + 1] = (value >>> 8)
  7327. } else {
  7328. objectWriteUInt16(this, value, offset, true)
  7329. }
  7330. return offset + 2
  7331. }
  7332. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7333. value = +value
  7334. offset = offset | 0
  7335. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7336. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7337. this[offset] = (value >>> 8)
  7338. this[offset + 1] = (value & 0xff)
  7339. } else {
  7340. objectWriteUInt16(this, value, offset, false)
  7341. }
  7342. return offset + 2
  7343. }
  7344. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7345. value = +value
  7346. offset = offset | 0
  7347. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7348. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7349. this[offset] = (value & 0xff)
  7350. this[offset + 1] = (value >>> 8)
  7351. this[offset + 2] = (value >>> 16)
  7352. this[offset + 3] = (value >>> 24)
  7353. } else {
  7354. objectWriteUInt32(this, value, offset, true)
  7355. }
  7356. return offset + 4
  7357. }
  7358. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7359. value = +value
  7360. offset = offset | 0
  7361. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7362. if (value < 0) value = 0xffffffff + value + 1
  7363. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7364. this[offset] = (value >>> 24)
  7365. this[offset + 1] = (value >>> 16)
  7366. this[offset + 2] = (value >>> 8)
  7367. this[offset + 3] = (value & 0xff)
  7368. } else {
  7369. objectWriteUInt32(this, value, offset, false)
  7370. }
  7371. return offset + 4
  7372. }
  7373. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7374. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7375. if (offset < 0) throw new RangeError('Index out of range')
  7376. }
  7377. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7378. if (!noAssert) {
  7379. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7380. }
  7381. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7382. return offset + 4
  7383. }
  7384. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7385. return writeFloat(this, value, offset, true, noAssert)
  7386. }
  7387. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7388. return writeFloat(this, value, offset, false, noAssert)
  7389. }
  7390. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7391. if (!noAssert) {
  7392. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7393. }
  7394. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7395. return offset + 8
  7396. }
  7397. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7398. return writeDouble(this, value, offset, true, noAssert)
  7399. }
  7400. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7401. return writeDouble(this, value, offset, false, noAssert)
  7402. }
  7403. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7404. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7405. if (!start) start = 0
  7406. if (!end && end !== 0) end = this.length
  7407. if (targetStart >= target.length) targetStart = target.length
  7408. if (!targetStart) targetStart = 0
  7409. if (end > 0 && end < start) end = start
  7410. // Copy 0 bytes; we're done
  7411. if (end === start) return 0
  7412. if (target.length === 0 || this.length === 0) return 0
  7413. // Fatal error conditions
  7414. if (targetStart < 0) {
  7415. throw new RangeError('targetStart out of bounds')
  7416. }
  7417. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7418. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7419. // Are we oob?
  7420. if (end > this.length) end = this.length
  7421. if (target.length - targetStart < end - start) {
  7422. end = target.length - targetStart + start
  7423. }
  7424. var len = end - start
  7425. var i
  7426. if (this === target && start < targetStart && targetStart < end) {
  7427. // descending copy from end
  7428. for (i = len - 1; i >= 0; --i) {
  7429. target[i + targetStart] = this[i + start]
  7430. }
  7431. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7432. // ascending copy from start
  7433. for (i = 0; i < len; ++i) {
  7434. target[i + targetStart] = this[i + start]
  7435. }
  7436. } else {
  7437. Uint8Array.prototype.set.call(
  7438. target,
  7439. this.subarray(start, start + len),
  7440. targetStart
  7441. )
  7442. }
  7443. return len
  7444. }
  7445. // Usage:
  7446. // buffer.fill(number[, offset[, end]])
  7447. // buffer.fill(buffer[, offset[, end]])
  7448. // buffer.fill(string[, offset[, end]][, encoding])
  7449. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7450. // Handle string cases:
  7451. if (typeof val === 'string') {
  7452. if (typeof start === 'string') {
  7453. encoding = start
  7454. start = 0
  7455. end = this.length
  7456. } else if (typeof end === 'string') {
  7457. encoding = end
  7458. end = this.length
  7459. }
  7460. if (val.length === 1) {
  7461. var code = val.charCodeAt(0)
  7462. if (code < 256) {
  7463. val = code
  7464. }
  7465. }
  7466. if (encoding !== undefined && typeof encoding !== 'string') {
  7467. throw new TypeError('encoding must be a string')
  7468. }
  7469. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7470. throw new TypeError('Unknown encoding: ' + encoding)
  7471. }
  7472. } else if (typeof val === 'number') {
  7473. val = val & 255
  7474. }
  7475. // Invalid ranges are not set to a default, so can range check early.
  7476. if (start < 0 || this.length < start || this.length < end) {
  7477. throw new RangeError('Out of range index')
  7478. }
  7479. if (end <= start) {
  7480. return this
  7481. }
  7482. start = start >>> 0
  7483. end = end === undefined ? this.length : end >>> 0
  7484. if (!val) val = 0
  7485. var i
  7486. if (typeof val === 'number') {
  7487. for (i = start; i < end; ++i) {
  7488. this[i] = val
  7489. }
  7490. } else {
  7491. var bytes = Buffer.isBuffer(val)
  7492. ? val
  7493. : utf8ToBytes(new Buffer(val, encoding).toString())
  7494. var len = bytes.length
  7495. for (i = 0; i < end - start; ++i) {
  7496. this[i + start] = bytes[i % len]
  7497. }
  7498. }
  7499. return this
  7500. }
  7501. // HELPER FUNCTIONS
  7502. // ================
  7503. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7504. function base64clean (str) {
  7505. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7506. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7507. // Node converts strings with length < 2 to ''
  7508. if (str.length < 2) return ''
  7509. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7510. while (str.length % 4 !== 0) {
  7511. str = str + '='
  7512. }
  7513. return str
  7514. }
  7515. function stringtrim (str) {
  7516. if (str.trim) return str.trim()
  7517. return str.replace(/^\s+|\s+$/g, '')
  7518. }
  7519. function toHex (n) {
  7520. if (n < 16) return '0' + n.toString(16)
  7521. return n.toString(16)
  7522. }
  7523. function utf8ToBytes (string, units) {
  7524. units = units || Infinity
  7525. var codePoint
  7526. var length = string.length
  7527. var leadSurrogate = null
  7528. var bytes = []
  7529. for (var i = 0; i < length; ++i) {
  7530. codePoint = string.charCodeAt(i)
  7531. // is surrogate component
  7532. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7533. // last char was a lead
  7534. if (!leadSurrogate) {
  7535. // no lead yet
  7536. if (codePoint > 0xDBFF) {
  7537. // unexpected trail
  7538. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7539. continue
  7540. } else if (i + 1 === length) {
  7541. // unpaired lead
  7542. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7543. continue
  7544. }
  7545. // valid lead
  7546. leadSurrogate = codePoint
  7547. continue
  7548. }
  7549. // 2 leads in a row
  7550. if (codePoint < 0xDC00) {
  7551. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7552. leadSurrogate = codePoint
  7553. continue
  7554. }
  7555. // valid surrogate pair
  7556. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7557. } else if (leadSurrogate) {
  7558. // valid bmp char, but last char was a lead
  7559. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7560. }
  7561. leadSurrogate = null
  7562. // encode utf8
  7563. if (codePoint < 0x80) {
  7564. if ((units -= 1) < 0) break
  7565. bytes.push(codePoint)
  7566. } else if (codePoint < 0x800) {
  7567. if ((units -= 2) < 0) break
  7568. bytes.push(
  7569. codePoint >> 0x6 | 0xC0,
  7570. codePoint & 0x3F | 0x80
  7571. )
  7572. } else if (codePoint < 0x10000) {
  7573. if ((units -= 3) < 0) break
  7574. bytes.push(
  7575. codePoint >> 0xC | 0xE0,
  7576. codePoint >> 0x6 & 0x3F | 0x80,
  7577. codePoint & 0x3F | 0x80
  7578. )
  7579. } else if (codePoint < 0x110000) {
  7580. if ((units -= 4) < 0) break
  7581. bytes.push(
  7582. codePoint >> 0x12 | 0xF0,
  7583. codePoint >> 0xC & 0x3F | 0x80,
  7584. codePoint >> 0x6 & 0x3F | 0x80,
  7585. codePoint & 0x3F | 0x80
  7586. )
  7587. } else {
  7588. throw new Error('Invalid code point')
  7589. }
  7590. }
  7591. return bytes
  7592. }
  7593. function asciiToBytes (str) {
  7594. var byteArray = []
  7595. for (var i = 0; i < str.length; ++i) {
  7596. // Node's code seems to be doing this and not & 0x7F..
  7597. byteArray.push(str.charCodeAt(i) & 0xFF)
  7598. }
  7599. return byteArray
  7600. }
  7601. function utf16leToBytes (str, units) {
  7602. var c, hi, lo
  7603. var byteArray = []
  7604. for (var i = 0; i < str.length; ++i) {
  7605. if ((units -= 2) < 0) break
  7606. c = str.charCodeAt(i)
  7607. hi = c >> 8
  7608. lo = c % 256
  7609. byteArray.push(lo)
  7610. byteArray.push(hi)
  7611. }
  7612. return byteArray
  7613. }
  7614. function base64ToBytes (str) {
  7615. return base64.toByteArray(base64clean(str))
  7616. }
  7617. function blitBuffer (src, dst, offset, length) {
  7618. for (var i = 0; i < length; ++i) {
  7619. if ((i + offset >= dst.length) || (i >= src.length)) break
  7620. dst[i + offset] = src[i]
  7621. }
  7622. return i
  7623. }
  7624. function isnan (val) {
  7625. return val !== val // eslint-disable-line no-self-compare
  7626. }
  7627. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7628. /***/ }),
  7629. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7630. /*!**************************************************!*\
  7631. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7632. \**************************************************/
  7633. /*! no static exports found */
  7634. /***/ (function(module, exports, __webpack_require__) {
  7635. /*!
  7636. * clipboard.js v2.0.4
  7637. * https://zenorocha.github.io/clipboard.js
  7638. *
  7639. * Licensed MIT © Zeno Rocha
  7640. */
  7641. (function webpackUniversalModuleDefinition(root, factory) {
  7642. if(true)
  7643. module.exports = factory();
  7644. else {}
  7645. })(this, function() {
  7646. return /******/ (function(modules) { // webpackBootstrap
  7647. /******/ // The module cache
  7648. /******/ var installedModules = {};
  7649. /******/
  7650. /******/ // The require function
  7651. /******/ function __webpack_require__(moduleId) {
  7652. /******/
  7653. /******/ // Check if module is in cache
  7654. /******/ if(installedModules[moduleId]) {
  7655. /******/ return installedModules[moduleId].exports;
  7656. /******/ }
  7657. /******/ // Create a new module (and put it into the cache)
  7658. /******/ var module = installedModules[moduleId] = {
  7659. /******/ i: moduleId,
  7660. /******/ l: false,
  7661. /******/ exports: {}
  7662. /******/ };
  7663. /******/
  7664. /******/ // Execute the module function
  7665. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7666. /******/
  7667. /******/ // Flag the module as loaded
  7668. /******/ module.l = true;
  7669. /******/
  7670. /******/ // Return the exports of the module
  7671. /******/ return module.exports;
  7672. /******/ }
  7673. /******/
  7674. /******/
  7675. /******/ // expose the modules object (__webpack_modules__)
  7676. /******/ __webpack_require__.m = modules;
  7677. /******/
  7678. /******/ // expose the module cache
  7679. /******/ __webpack_require__.c = installedModules;
  7680. /******/
  7681. /******/ // define getter function for harmony exports
  7682. /******/ __webpack_require__.d = function(exports, name, getter) {
  7683. /******/ if(!__webpack_require__.o(exports, name)) {
  7684. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7685. /******/ }
  7686. /******/ };
  7687. /******/
  7688. /******/ // define __esModule on exports
  7689. /******/ __webpack_require__.r = function(exports) {
  7690. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7691. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7692. /******/ }
  7693. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7694. /******/ };
  7695. /******/
  7696. /******/ // create a fake namespace object
  7697. /******/ // mode & 1: value is a module id, require it
  7698. /******/ // mode & 2: merge all properties of value into the ns
  7699. /******/ // mode & 4: return value when already ns object
  7700. /******/ // mode & 8|1: behave like require
  7701. /******/ __webpack_require__.t = function(value, mode) {
  7702. /******/ if(mode & 1) value = __webpack_require__(value);
  7703. /******/ if(mode & 8) return value;
  7704. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7705. /******/ var ns = Object.create(null);
  7706. /******/ __webpack_require__.r(ns);
  7707. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7708. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7709. /******/ return ns;
  7710. /******/ };
  7711. /******/
  7712. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7713. /******/ __webpack_require__.n = function(module) {
  7714. /******/ var getter = module && module.__esModule ?
  7715. /******/ function getDefault() { return module['default']; } :
  7716. /******/ function getModuleExports() { return module; };
  7717. /******/ __webpack_require__.d(getter, 'a', getter);
  7718. /******/ return getter;
  7719. /******/ };
  7720. /******/
  7721. /******/ // Object.prototype.hasOwnProperty.call
  7722. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7723. /******/
  7724. /******/ // __webpack_public_path__
  7725. /******/ __webpack_require__.p = "";
  7726. /******/
  7727. /******/
  7728. /******/ // Load entry module and return exports
  7729. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7730. /******/ })
  7731. /************************************************************************/
  7732. /******/ ([
  7733. /* 0 */
  7734. /***/ (function(module, exports, __webpack_require__) {
  7735. "use strict";
  7736. 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; };
  7737. 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; }; }();
  7738. var _clipboardAction = __webpack_require__(1);
  7739. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7740. var _tinyEmitter = __webpack_require__(3);
  7741. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7742. var _goodListener = __webpack_require__(4);
  7743. var _goodListener2 = _interopRequireDefault(_goodListener);
  7744. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7745. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7746. 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; }
  7747. 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; }
  7748. /**
  7749. * Base class which takes one or more elements, adds event listeners to them,
  7750. * and instantiates a new `ClipboardAction` on each click.
  7751. */
  7752. var Clipboard = function (_Emitter) {
  7753. _inherits(Clipboard, _Emitter);
  7754. /**
  7755. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7756. * @param {Object} options
  7757. */
  7758. function Clipboard(trigger, options) {
  7759. _classCallCheck(this, Clipboard);
  7760. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7761. _this.resolveOptions(options);
  7762. _this.listenClick(trigger);
  7763. return _this;
  7764. }
  7765. /**
  7766. * Defines if attributes would be resolved using internal setter functions
  7767. * or custom functions that were passed in the constructor.
  7768. * @param {Object} options
  7769. */
  7770. _createClass(Clipboard, [{
  7771. key: 'resolveOptions',
  7772. value: function resolveOptions() {
  7773. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7774. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7775. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7776. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7777. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7778. }
  7779. /**
  7780. * Adds a click event listener to the passed trigger.
  7781. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7782. */
  7783. }, {
  7784. key: 'listenClick',
  7785. value: function listenClick(trigger) {
  7786. var _this2 = this;
  7787. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7788. return _this2.onClick(e);
  7789. });
  7790. }
  7791. /**
  7792. * Defines a new `ClipboardAction` on each click event.
  7793. * @param {Event} e
  7794. */
  7795. }, {
  7796. key: 'onClick',
  7797. value: function onClick(e) {
  7798. var trigger = e.delegateTarget || e.currentTarget;
  7799. if (this.clipboardAction) {
  7800. this.clipboardAction = null;
  7801. }
  7802. this.clipboardAction = new _clipboardAction2.default({
  7803. action: this.action(trigger),
  7804. target: this.target(trigger),
  7805. text: this.text(trigger),
  7806. container: this.container,
  7807. trigger: trigger,
  7808. emitter: this
  7809. });
  7810. }
  7811. /**
  7812. * Default `action` lookup function.
  7813. * @param {Element} trigger
  7814. */
  7815. }, {
  7816. key: 'defaultAction',
  7817. value: function defaultAction(trigger) {
  7818. return getAttributeValue('action', trigger);
  7819. }
  7820. /**
  7821. * Default `target` lookup function.
  7822. * @param {Element} trigger
  7823. */
  7824. }, {
  7825. key: 'defaultTarget',
  7826. value: function defaultTarget(trigger) {
  7827. var selector = getAttributeValue('target', trigger);
  7828. if (selector) {
  7829. return document.querySelector(selector);
  7830. }
  7831. }
  7832. /**
  7833. * Returns the support of the given action, or all actions if no action is
  7834. * given.
  7835. * @param {String} [action]
  7836. */
  7837. }, {
  7838. key: 'defaultText',
  7839. /**
  7840. * Default `text` lookup function.
  7841. * @param {Element} trigger
  7842. */
  7843. value: function defaultText(trigger) {
  7844. return getAttributeValue('text', trigger);
  7845. }
  7846. /**
  7847. * Destroy lifecycle.
  7848. */
  7849. }, {
  7850. key: 'destroy',
  7851. value: function destroy() {
  7852. this.listener.destroy();
  7853. if (this.clipboardAction) {
  7854. this.clipboardAction.destroy();
  7855. this.clipboardAction = null;
  7856. }
  7857. }
  7858. }], [{
  7859. key: 'isSupported',
  7860. value: function isSupported() {
  7861. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7862. var actions = typeof action === 'string' ? [action] : action;
  7863. var support = !!document.queryCommandSupported;
  7864. actions.forEach(function (action) {
  7865. support = support && !!document.queryCommandSupported(action);
  7866. });
  7867. return support;
  7868. }
  7869. }]);
  7870. return Clipboard;
  7871. }(_tinyEmitter2.default);
  7872. /**
  7873. * Helper function to retrieve attribute value.
  7874. * @param {String} suffix
  7875. * @param {Element} element
  7876. */
  7877. function getAttributeValue(suffix, element) {
  7878. var attribute = 'data-clipboard-' + suffix;
  7879. if (!element.hasAttribute(attribute)) {
  7880. return;
  7881. }
  7882. return element.getAttribute(attribute);
  7883. }
  7884. module.exports = Clipboard;
  7885. /***/ }),
  7886. /* 1 */
  7887. /***/ (function(module, exports, __webpack_require__) {
  7888. "use strict";
  7889. 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; };
  7890. 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; }; }();
  7891. var _select = __webpack_require__(2);
  7892. var _select2 = _interopRequireDefault(_select);
  7893. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7894. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7895. /**
  7896. * Inner class which performs selection from either `text` or `target`
  7897. * properties and then executes copy or cut operations.
  7898. */
  7899. var ClipboardAction = function () {
  7900. /**
  7901. * @param {Object} options
  7902. */
  7903. function ClipboardAction(options) {
  7904. _classCallCheck(this, ClipboardAction);
  7905. this.resolveOptions(options);
  7906. this.initSelection();
  7907. }
  7908. /**
  7909. * Defines base properties passed from constructor.
  7910. * @param {Object} options
  7911. */
  7912. _createClass(ClipboardAction, [{
  7913. key: 'resolveOptions',
  7914. value: function resolveOptions() {
  7915. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7916. this.action = options.action;
  7917. this.container = options.container;
  7918. this.emitter = options.emitter;
  7919. this.target = options.target;
  7920. this.text = options.text;
  7921. this.trigger = options.trigger;
  7922. this.selectedText = '';
  7923. }
  7924. /**
  7925. * Decides which selection strategy is going to be applied based
  7926. * on the existence of `text` and `target` properties.
  7927. */
  7928. }, {
  7929. key: 'initSelection',
  7930. value: function initSelection() {
  7931. if (this.text) {
  7932. this.selectFake();
  7933. } else if (this.target) {
  7934. this.selectTarget();
  7935. }
  7936. }
  7937. /**
  7938. * Creates a fake textarea element, sets its value from `text` property,
  7939. * and makes a selection on it.
  7940. */
  7941. }, {
  7942. key: 'selectFake',
  7943. value: function selectFake() {
  7944. var _this = this;
  7945. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7946. this.removeFake();
  7947. this.fakeHandlerCallback = function () {
  7948. return _this.removeFake();
  7949. };
  7950. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7951. this.fakeElem = document.createElement('textarea');
  7952. // Prevent zooming on iOS
  7953. this.fakeElem.style.fontSize = '12pt';
  7954. // Reset box model
  7955. this.fakeElem.style.border = '0';
  7956. this.fakeElem.style.padding = '0';
  7957. this.fakeElem.style.margin = '0';
  7958. // Move element out of screen horizontally
  7959. this.fakeElem.style.position = 'absolute';
  7960. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7961. // Move element to the same position vertically
  7962. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7963. this.fakeElem.style.top = yPosition + 'px';
  7964. this.fakeElem.setAttribute('readonly', '');
  7965. this.fakeElem.value = this.text;
  7966. this.container.appendChild(this.fakeElem);
  7967. this.selectedText = (0, _select2.default)(this.fakeElem);
  7968. this.copyText();
  7969. }
  7970. /**
  7971. * Only removes the fake element after another click event, that way
  7972. * a user can hit `Ctrl+C` to copy because selection still exists.
  7973. */
  7974. }, {
  7975. key: 'removeFake',
  7976. value: function removeFake() {
  7977. if (this.fakeHandler) {
  7978. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7979. this.fakeHandler = null;
  7980. this.fakeHandlerCallback = null;
  7981. }
  7982. if (this.fakeElem) {
  7983. this.container.removeChild(this.fakeElem);
  7984. this.fakeElem = null;
  7985. }
  7986. }
  7987. /**
  7988. * Selects the content from element passed on `target` property.
  7989. */
  7990. }, {
  7991. key: 'selectTarget',
  7992. value: function selectTarget() {
  7993. this.selectedText = (0, _select2.default)(this.target);
  7994. this.copyText();
  7995. }
  7996. /**
  7997. * Executes the copy operation based on the current selection.
  7998. */
  7999. }, {
  8000. key: 'copyText',
  8001. value: function copyText() {
  8002. var succeeded = void 0;
  8003. try {
  8004. succeeded = document.execCommand(this.action);
  8005. } catch (err) {
  8006. succeeded = false;
  8007. }
  8008. this.handleResult(succeeded);
  8009. }
  8010. /**
  8011. * Fires an event based on the copy operation result.
  8012. * @param {Boolean} succeeded
  8013. */
  8014. }, {
  8015. key: 'handleResult',
  8016. value: function handleResult(succeeded) {
  8017. this.emitter.emit(succeeded ? 'success' : 'error', {
  8018. action: this.action,
  8019. text: this.selectedText,
  8020. trigger: this.trigger,
  8021. clearSelection: this.clearSelection.bind(this)
  8022. });
  8023. }
  8024. /**
  8025. * Moves focus away from `target` and back to the trigger, removes current selection.
  8026. */
  8027. }, {
  8028. key: 'clearSelection',
  8029. value: function clearSelection() {
  8030. if (this.trigger) {
  8031. this.trigger.focus();
  8032. }
  8033. window.getSelection().removeAllRanges();
  8034. }
  8035. /**
  8036. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8037. * @param {String} action
  8038. */
  8039. }, {
  8040. key: 'destroy',
  8041. /**
  8042. * Destroy lifecycle.
  8043. */
  8044. value: function destroy() {
  8045. this.removeFake();
  8046. }
  8047. }, {
  8048. key: 'action',
  8049. set: function set() {
  8050. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8051. this._action = action;
  8052. if (this._action !== 'copy' && this._action !== 'cut') {
  8053. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8054. }
  8055. }
  8056. /**
  8057. * Gets the `action` property.
  8058. * @return {String}
  8059. */
  8060. ,
  8061. get: function get() {
  8062. return this._action;
  8063. }
  8064. /**
  8065. * Sets the `target` property using an element
  8066. * that will be have its content copied.
  8067. * @param {Element} target
  8068. */
  8069. }, {
  8070. key: 'target',
  8071. set: function set(target) {
  8072. if (target !== undefined) {
  8073. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8074. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8075. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8076. }
  8077. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8078. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8079. }
  8080. this._target = target;
  8081. } else {
  8082. throw new Error('Invalid "target" value, use a valid Element');
  8083. }
  8084. }
  8085. }
  8086. /**
  8087. * Gets the `target` property.
  8088. * @return {String|HTMLElement}
  8089. */
  8090. ,
  8091. get: function get() {
  8092. return this._target;
  8093. }
  8094. }]);
  8095. return ClipboardAction;
  8096. }();
  8097. module.exports = ClipboardAction;
  8098. /***/ }),
  8099. /* 2 */
  8100. /***/ (function(module, exports) {
  8101. function select(element) {
  8102. var selectedText;
  8103. if (element.nodeName === 'SELECT') {
  8104. element.focus();
  8105. selectedText = element.value;
  8106. }
  8107. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8108. var isReadOnly = element.hasAttribute('readonly');
  8109. if (!isReadOnly) {
  8110. element.setAttribute('readonly', '');
  8111. }
  8112. element.select();
  8113. element.setSelectionRange(0, element.value.length);
  8114. if (!isReadOnly) {
  8115. element.removeAttribute('readonly');
  8116. }
  8117. selectedText = element.value;
  8118. }
  8119. else {
  8120. if (element.hasAttribute('contenteditable')) {
  8121. element.focus();
  8122. }
  8123. var selection = window.getSelection();
  8124. var range = document.createRange();
  8125. range.selectNodeContents(element);
  8126. selection.removeAllRanges();
  8127. selection.addRange(range);
  8128. selectedText = selection.toString();
  8129. }
  8130. return selectedText;
  8131. }
  8132. module.exports = select;
  8133. /***/ }),
  8134. /* 3 */
  8135. /***/ (function(module, exports) {
  8136. function E () {
  8137. // Keep this empty so it's easier to inherit from
  8138. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8139. }
  8140. E.prototype = {
  8141. on: function (name, callback, ctx) {
  8142. var e = this.e || (this.e = {});
  8143. (e[name] || (e[name] = [])).push({
  8144. fn: callback,
  8145. ctx: ctx
  8146. });
  8147. return this;
  8148. },
  8149. once: function (name, callback, ctx) {
  8150. var self = this;
  8151. function listener () {
  8152. self.off(name, listener);
  8153. callback.apply(ctx, arguments);
  8154. };
  8155. listener._ = callback
  8156. return this.on(name, listener, ctx);
  8157. },
  8158. emit: function (name) {
  8159. var data = [].slice.call(arguments, 1);
  8160. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8161. var i = 0;
  8162. var len = evtArr.length;
  8163. for (i; i < len; i++) {
  8164. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8165. }
  8166. return this;
  8167. },
  8168. off: function (name, callback) {
  8169. var e = this.e || (this.e = {});
  8170. var evts = e[name];
  8171. var liveEvents = [];
  8172. if (evts && callback) {
  8173. for (var i = 0, len = evts.length; i < len; i++) {
  8174. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8175. liveEvents.push(evts[i]);
  8176. }
  8177. }
  8178. // Remove event from queue to prevent memory leak
  8179. // Suggested by https://github.com/lazd
  8180. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8181. (liveEvents.length)
  8182. ? e[name] = liveEvents
  8183. : delete e[name];
  8184. return this;
  8185. }
  8186. };
  8187. module.exports = E;
  8188. /***/ }),
  8189. /* 4 */
  8190. /***/ (function(module, exports, __webpack_require__) {
  8191. var is = __webpack_require__(5);
  8192. var delegate = __webpack_require__(6);
  8193. /**
  8194. * Validates all params and calls the right
  8195. * listener function based on its target type.
  8196. *
  8197. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8198. * @param {String} type
  8199. * @param {Function} callback
  8200. * @return {Object}
  8201. */
  8202. function listen(target, type, callback) {
  8203. if (!target && !type && !callback) {
  8204. throw new Error('Missing required arguments');
  8205. }
  8206. if (!is.string(type)) {
  8207. throw new TypeError('Second argument must be a String');
  8208. }
  8209. if (!is.fn(callback)) {
  8210. throw new TypeError('Third argument must be a Function');
  8211. }
  8212. if (is.node(target)) {
  8213. return listenNode(target, type, callback);
  8214. }
  8215. else if (is.nodeList(target)) {
  8216. return listenNodeList(target, type, callback);
  8217. }
  8218. else if (is.string(target)) {
  8219. return listenSelector(target, type, callback);
  8220. }
  8221. else {
  8222. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8223. }
  8224. }
  8225. /**
  8226. * Adds an event listener to a HTML element
  8227. * and returns a remove listener function.
  8228. *
  8229. * @param {HTMLElement} node
  8230. * @param {String} type
  8231. * @param {Function} callback
  8232. * @return {Object}
  8233. */
  8234. function listenNode(node, type, callback) {
  8235. node.addEventListener(type, callback);
  8236. return {
  8237. destroy: function() {
  8238. node.removeEventListener(type, callback);
  8239. }
  8240. }
  8241. }
  8242. /**
  8243. * Add an event listener to a list of HTML elements
  8244. * and returns a remove listener function.
  8245. *
  8246. * @param {NodeList|HTMLCollection} nodeList
  8247. * @param {String} type
  8248. * @param {Function} callback
  8249. * @return {Object}
  8250. */
  8251. function listenNodeList(nodeList, type, callback) {
  8252. Array.prototype.forEach.call(nodeList, function(node) {
  8253. node.addEventListener(type, callback);
  8254. });
  8255. return {
  8256. destroy: function() {
  8257. Array.prototype.forEach.call(nodeList, function(node) {
  8258. node.removeEventListener(type, callback);
  8259. });
  8260. }
  8261. }
  8262. }
  8263. /**
  8264. * Add an event listener to a selector
  8265. * and returns a remove listener function.
  8266. *
  8267. * @param {String} selector
  8268. * @param {String} type
  8269. * @param {Function} callback
  8270. * @return {Object}
  8271. */
  8272. function listenSelector(selector, type, callback) {
  8273. return delegate(document.body, selector, type, callback);
  8274. }
  8275. module.exports = listen;
  8276. /***/ }),
  8277. /* 5 */
  8278. /***/ (function(module, exports) {
  8279. /**
  8280. * Check if argument is a HTML element.
  8281. *
  8282. * @param {Object} value
  8283. * @return {Boolean}
  8284. */
  8285. exports.node = function(value) {
  8286. return value !== undefined
  8287. && value instanceof HTMLElement
  8288. && value.nodeType === 1;
  8289. };
  8290. /**
  8291. * Check if argument is a list of HTML elements.
  8292. *
  8293. * @param {Object} value
  8294. * @return {Boolean}
  8295. */
  8296. exports.nodeList = function(value) {
  8297. var type = Object.prototype.toString.call(value);
  8298. return value !== undefined
  8299. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8300. && ('length' in value)
  8301. && (value.length === 0 || exports.node(value[0]));
  8302. };
  8303. /**
  8304. * Check if argument is a string.
  8305. *
  8306. * @param {Object} value
  8307. * @return {Boolean}
  8308. */
  8309. exports.string = function(value) {
  8310. return typeof value === 'string'
  8311. || value instanceof String;
  8312. };
  8313. /**
  8314. * Check if argument is a function.
  8315. *
  8316. * @param {Object} value
  8317. * @return {Boolean}
  8318. */
  8319. exports.fn = function(value) {
  8320. var type = Object.prototype.toString.call(value);
  8321. return type === '[object Function]';
  8322. };
  8323. /***/ }),
  8324. /* 6 */
  8325. /***/ (function(module, exports, __webpack_require__) {
  8326. var closest = __webpack_require__(7);
  8327. /**
  8328. * Delegates event to a selector.
  8329. *
  8330. * @param {Element} element
  8331. * @param {String} selector
  8332. * @param {String} type
  8333. * @param {Function} callback
  8334. * @param {Boolean} useCapture
  8335. * @return {Object}
  8336. */
  8337. function _delegate(element, selector, type, callback, useCapture) {
  8338. var listenerFn = listener.apply(this, arguments);
  8339. element.addEventListener(type, listenerFn, useCapture);
  8340. return {
  8341. destroy: function() {
  8342. element.removeEventListener(type, listenerFn, useCapture);
  8343. }
  8344. }
  8345. }
  8346. /**
  8347. * Delegates event to a selector.
  8348. *
  8349. * @param {Element|String|Array} [elements]
  8350. * @param {String} selector
  8351. * @param {String} type
  8352. * @param {Function} callback
  8353. * @param {Boolean} useCapture
  8354. * @return {Object}
  8355. */
  8356. function delegate(elements, selector, type, callback, useCapture) {
  8357. // Handle the regular Element usage
  8358. if (typeof elements.addEventListener === 'function') {
  8359. return _delegate.apply(null, arguments);
  8360. }
  8361. // Handle Element-less usage, it defaults to global delegation
  8362. if (typeof type === 'function') {
  8363. // Use `document` as the first parameter, then apply arguments
  8364. // This is a short way to .unshift `arguments` without running into deoptimizations
  8365. return _delegate.bind(null, document).apply(null, arguments);
  8366. }
  8367. // Handle Selector-based usage
  8368. if (typeof elements === 'string') {
  8369. elements = document.querySelectorAll(elements);
  8370. }
  8371. // Handle Array-like based usage
  8372. return Array.prototype.map.call(elements, function (element) {
  8373. return _delegate(element, selector, type, callback, useCapture);
  8374. });
  8375. }
  8376. /**
  8377. * Finds closest match and invokes callback.
  8378. *
  8379. * @param {Element} element
  8380. * @param {String} selector
  8381. * @param {String} type
  8382. * @param {Function} callback
  8383. * @return {Function}
  8384. */
  8385. function listener(element, selector, type, callback) {
  8386. return function(e) {
  8387. e.delegateTarget = closest(e.target, selector);
  8388. if (e.delegateTarget) {
  8389. callback.call(element, e);
  8390. }
  8391. }
  8392. }
  8393. module.exports = delegate;
  8394. /***/ }),
  8395. /* 7 */
  8396. /***/ (function(module, exports) {
  8397. var DOCUMENT_NODE_TYPE = 9;
  8398. /**
  8399. * A polyfill for Element.matches()
  8400. */
  8401. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8402. var proto = Element.prototype;
  8403. proto.matches = proto.matchesSelector ||
  8404. proto.mozMatchesSelector ||
  8405. proto.msMatchesSelector ||
  8406. proto.oMatchesSelector ||
  8407. proto.webkitMatchesSelector;
  8408. }
  8409. /**
  8410. * Finds the closest parent that matches a selector.
  8411. *
  8412. * @param {Element} element
  8413. * @param {String} selector
  8414. * @return {Function}
  8415. */
  8416. function closest (element, selector) {
  8417. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8418. if (typeof element.matches === 'function' &&
  8419. element.matches(selector)) {
  8420. return element;
  8421. }
  8422. element = element.parentNode;
  8423. }
  8424. }
  8425. module.exports = closest;
  8426. /***/ })
  8427. /******/ ]);
  8428. });
  8429. /***/ }),
  8430. /***/ "./node_modules/ieee754/index.js":
  8431. /*!***************************************!*\
  8432. !*** ./node_modules/ieee754/index.js ***!
  8433. \***************************************/
  8434. /*! no static exports found */
  8435. /***/ (function(module, exports) {
  8436. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8437. var e, m
  8438. var eLen = (nBytes * 8) - mLen - 1
  8439. var eMax = (1 << eLen) - 1
  8440. var eBias = eMax >> 1
  8441. var nBits = -7
  8442. var i = isLE ? (nBytes - 1) : 0
  8443. var d = isLE ? -1 : 1
  8444. var s = buffer[offset + i]
  8445. i += d
  8446. e = s & ((1 << (-nBits)) - 1)
  8447. s >>= (-nBits)
  8448. nBits += eLen
  8449. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8450. m = e & ((1 << (-nBits)) - 1)
  8451. e >>= (-nBits)
  8452. nBits += mLen
  8453. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8454. if (e === 0) {
  8455. e = 1 - eBias
  8456. } else if (e === eMax) {
  8457. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8458. } else {
  8459. m = m + Math.pow(2, mLen)
  8460. e = e - eBias
  8461. }
  8462. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8463. }
  8464. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8465. var e, m, c
  8466. var eLen = (nBytes * 8) - mLen - 1
  8467. var eMax = (1 << eLen) - 1
  8468. var eBias = eMax >> 1
  8469. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8470. var i = isLE ? 0 : (nBytes - 1)
  8471. var d = isLE ? 1 : -1
  8472. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8473. value = Math.abs(value)
  8474. if (isNaN(value) || value === Infinity) {
  8475. m = isNaN(value) ? 1 : 0
  8476. e = eMax
  8477. } else {
  8478. e = Math.floor(Math.log(value) / Math.LN2)
  8479. if (value * (c = Math.pow(2, -e)) < 1) {
  8480. e--
  8481. c *= 2
  8482. }
  8483. if (e + eBias >= 1) {
  8484. value += rt / c
  8485. } else {
  8486. value += rt * Math.pow(2, 1 - eBias)
  8487. }
  8488. if (value * c >= 2) {
  8489. e++
  8490. c /= 2
  8491. }
  8492. if (e + eBias >= eMax) {
  8493. m = 0
  8494. e = eMax
  8495. } else if (e + eBias >= 1) {
  8496. m = ((value * c) - 1) * Math.pow(2, mLen)
  8497. e = e + eBias
  8498. } else {
  8499. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8500. e = 0
  8501. }
  8502. }
  8503. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8504. e = (e << mLen) | m
  8505. eLen += mLen
  8506. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8507. buffer[offset + i - d] |= s * 128
  8508. }
  8509. /***/ }),
  8510. /***/ "./node_modules/isarray/index.js":
  8511. /*!***************************************!*\
  8512. !*** ./node_modules/isarray/index.js ***!
  8513. \***************************************/
  8514. /*! no static exports found */
  8515. /***/ (function(module, exports) {
  8516. var toString = {}.toString;
  8517. module.exports = Array.isArray || function (arr) {
  8518. return toString.call(arr) == '[object Array]';
  8519. };
  8520. /***/ }),
  8521. /***/ "./node_modules/jquery/dist/jquery.js":
  8522. /*!********************************************!*\
  8523. !*** ./node_modules/jquery/dist/jquery.js ***!
  8524. \********************************************/
  8525. /*! no static exports found */
  8526. /***/ (function(module, exports, __webpack_require__) {
  8527. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8528. * jQuery JavaScript Library v3.4.1
  8529. * https://jquery.com/
  8530. *
  8531. * Includes Sizzle.js
  8532. * https://sizzlejs.com/
  8533. *
  8534. * Copyright JS Foundation and other contributors
  8535. * Released under the MIT license
  8536. * https://jquery.org/license
  8537. *
  8538. * Date: 2019-05-01T21:04Z
  8539. */
  8540. ( function( global, factory ) {
  8541. "use strict";
  8542. if ( true && typeof module.exports === "object" ) {
  8543. // For CommonJS and CommonJS-like environments where a proper `window`
  8544. // is present, execute the factory and get jQuery.
  8545. // For environments that do not have a `window` with a `document`
  8546. // (such as Node.js), expose a factory as module.exports.
  8547. // This accentuates the need for the creation of a real `window`.
  8548. // e.g. var jQuery = require("jquery")(window);
  8549. // See ticket #14549 for more info.
  8550. module.exports = global.document ?
  8551. factory( global, true ) :
  8552. function( w ) {
  8553. if ( !w.document ) {
  8554. throw new Error( "jQuery requires a window with a document" );
  8555. }
  8556. return factory( w );
  8557. };
  8558. } else {
  8559. factory( global );
  8560. }
  8561. // Pass this if window is not defined yet
  8562. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8563. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8564. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8565. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8566. // enough that all such attempts are guarded in a try block.
  8567. "use strict";
  8568. var arr = [];
  8569. var document = window.document;
  8570. var getProto = Object.getPrototypeOf;
  8571. var slice = arr.slice;
  8572. var concat = arr.concat;
  8573. var push = arr.push;
  8574. var indexOf = arr.indexOf;
  8575. var class2type = {};
  8576. var toString = class2type.toString;
  8577. var hasOwn = class2type.hasOwnProperty;
  8578. var fnToString = hasOwn.toString;
  8579. var ObjectFunctionString = fnToString.call( Object );
  8580. var support = {};
  8581. var isFunction = function isFunction( obj ) {
  8582. // Support: Chrome <=57, Firefox <=52
  8583. // In some browsers, typeof returns "function" for HTML <object> elements
  8584. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8585. // We don't want to classify *any* DOM node as a function.
  8586. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8587. };
  8588. var isWindow = function isWindow( obj ) {
  8589. return obj != null && obj === obj.window;
  8590. };
  8591. var preservedScriptAttributes = {
  8592. type: true,
  8593. src: true,
  8594. nonce: true,
  8595. noModule: true
  8596. };
  8597. function DOMEval( code, node, doc ) {
  8598. doc = doc || document;
  8599. var i, val,
  8600. script = doc.createElement( "script" );
  8601. script.text = code;
  8602. if ( node ) {
  8603. for ( i in preservedScriptAttributes ) {
  8604. // Support: Firefox 64+, Edge 18+
  8605. // Some browsers don't support the "nonce" property on scripts.
  8606. // On the other hand, just using `getAttribute` is not enough as
  8607. // the `nonce` attribute is reset to an empty string whenever it
  8608. // becomes browsing-context connected.
  8609. // See https://github.com/whatwg/html/issues/2369
  8610. // See https://html.spec.whatwg.org/#nonce-attributes
  8611. // The `node.getAttribute` check was added for the sake of
  8612. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8613. // via an object.
  8614. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8615. if ( val ) {
  8616. script.setAttribute( i, val );
  8617. }
  8618. }
  8619. }
  8620. doc.head.appendChild( script ).parentNode.removeChild( script );
  8621. }
  8622. function toType( obj ) {
  8623. if ( obj == null ) {
  8624. return obj + "";
  8625. }
  8626. // Support: Android <=2.3 only (functionish RegExp)
  8627. return typeof obj === "object" || typeof obj === "function" ?
  8628. class2type[ toString.call( obj ) ] || "object" :
  8629. typeof obj;
  8630. }
  8631. /* global Symbol */
  8632. // Defining this global in .eslintrc.json would create a danger of using the global
  8633. // unguarded in another place, it seems safer to define global only for this module
  8634. var
  8635. version = "3.4.1",
  8636. // Define a local copy of jQuery
  8637. jQuery = function( selector, context ) {
  8638. // The jQuery object is actually just the init constructor 'enhanced'
  8639. // Need init if jQuery is called (just allow error to be thrown if not included)
  8640. return new jQuery.fn.init( selector, context );
  8641. },
  8642. // Support: Android <=4.0 only
  8643. // Make sure we trim BOM and NBSP
  8644. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8645. jQuery.fn = jQuery.prototype = {
  8646. // The current version of jQuery being used
  8647. jquery: version,
  8648. constructor: jQuery,
  8649. // The default length of a jQuery object is 0
  8650. length: 0,
  8651. toArray: function() {
  8652. return slice.call( this );
  8653. },
  8654. // Get the Nth element in the matched element set OR
  8655. // Get the whole matched element set as a clean array
  8656. get: function( num ) {
  8657. // Return all the elements in a clean array
  8658. if ( num == null ) {
  8659. return slice.call( this );
  8660. }
  8661. // Return just the one element from the set
  8662. return num < 0 ? this[ num + this.length ] : this[ num ];
  8663. },
  8664. // Take an array of elements and push it onto the stack
  8665. // (returning the new matched element set)
  8666. pushStack: function( elems ) {
  8667. // Build a new jQuery matched element set
  8668. var ret = jQuery.merge( this.constructor(), elems );
  8669. // Add the old object onto the stack (as a reference)
  8670. ret.prevObject = this;
  8671. // Return the newly-formed element set
  8672. return ret;
  8673. },
  8674. // Execute a callback for every element in the matched set.
  8675. each: function( callback ) {
  8676. return jQuery.each( this, callback );
  8677. },
  8678. map: function( callback ) {
  8679. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8680. return callback.call( elem, i, elem );
  8681. } ) );
  8682. },
  8683. slice: function() {
  8684. return this.pushStack( slice.apply( this, arguments ) );
  8685. },
  8686. first: function() {
  8687. return this.eq( 0 );
  8688. },
  8689. last: function() {
  8690. return this.eq( -1 );
  8691. },
  8692. eq: function( i ) {
  8693. var len = this.length,
  8694. j = +i + ( i < 0 ? len : 0 );
  8695. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8696. },
  8697. end: function() {
  8698. return this.prevObject || this.constructor();
  8699. },
  8700. // For internal use only.
  8701. // Behaves like an Array's method, not like a jQuery method.
  8702. push: push,
  8703. sort: arr.sort,
  8704. splice: arr.splice
  8705. };
  8706. jQuery.extend = jQuery.fn.extend = function() {
  8707. var options, name, src, copy, copyIsArray, clone,
  8708. target = arguments[ 0 ] || {},
  8709. i = 1,
  8710. length = arguments.length,
  8711. deep = false;
  8712. // Handle a deep copy situation
  8713. if ( typeof target === "boolean" ) {
  8714. deep = target;
  8715. // Skip the boolean and the target
  8716. target = arguments[ i ] || {};
  8717. i++;
  8718. }
  8719. // Handle case when target is a string or something (possible in deep copy)
  8720. if ( typeof target !== "object" && !isFunction( target ) ) {
  8721. target = {};
  8722. }
  8723. // Extend jQuery itself if only one argument is passed
  8724. if ( i === length ) {
  8725. target = this;
  8726. i--;
  8727. }
  8728. for ( ; i < length; i++ ) {
  8729. // Only deal with non-null/undefined values
  8730. if ( ( options = arguments[ i ] ) != null ) {
  8731. // Extend the base object
  8732. for ( name in options ) {
  8733. copy = options[ name ];
  8734. // Prevent Object.prototype pollution
  8735. // Prevent never-ending loop
  8736. if ( name === "__proto__" || target === copy ) {
  8737. continue;
  8738. }
  8739. // Recurse if we're merging plain objects or arrays
  8740. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8741. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8742. src = target[ name ];
  8743. // Ensure proper type for the source value
  8744. if ( copyIsArray && !Array.isArray( src ) ) {
  8745. clone = [];
  8746. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8747. clone = {};
  8748. } else {
  8749. clone = src;
  8750. }
  8751. copyIsArray = false;
  8752. // Never move original objects, clone them
  8753. target[ name ] = jQuery.extend( deep, clone, copy );
  8754. // Don't bring in undefined values
  8755. } else if ( copy !== undefined ) {
  8756. target[ name ] = copy;
  8757. }
  8758. }
  8759. }
  8760. }
  8761. // Return the modified object
  8762. return target;
  8763. };
  8764. jQuery.extend( {
  8765. // Unique for each copy of jQuery on the page
  8766. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8767. // Assume jQuery is ready without the ready module
  8768. isReady: true,
  8769. error: function( msg ) {
  8770. throw new Error( msg );
  8771. },
  8772. noop: function() {},
  8773. isPlainObject: function( obj ) {
  8774. var proto, Ctor;
  8775. // Detect obvious negatives
  8776. // Use toString instead of jQuery.type to catch host objects
  8777. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8778. return false;
  8779. }
  8780. proto = getProto( obj );
  8781. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8782. if ( !proto ) {
  8783. return true;
  8784. }
  8785. // Objects with prototype are plain iff they were constructed by a global Object function
  8786. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8787. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8788. },
  8789. isEmptyObject: function( obj ) {
  8790. var name;
  8791. for ( name in obj ) {
  8792. return false;
  8793. }
  8794. return true;
  8795. },
  8796. // Evaluates a script in a global context
  8797. globalEval: function( code, options ) {
  8798. DOMEval( code, { nonce: options && options.nonce } );
  8799. },
  8800. each: function( obj, callback ) {
  8801. var length, i = 0;
  8802. if ( isArrayLike( obj ) ) {
  8803. length = obj.length;
  8804. for ( ; i < length; i++ ) {
  8805. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8806. break;
  8807. }
  8808. }
  8809. } else {
  8810. for ( i in obj ) {
  8811. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8812. break;
  8813. }
  8814. }
  8815. }
  8816. return obj;
  8817. },
  8818. // Support: Android <=4.0 only
  8819. trim: function( text ) {
  8820. return text == null ?
  8821. "" :
  8822. ( text + "" ).replace( rtrim, "" );
  8823. },
  8824. // results is for internal usage only
  8825. makeArray: function( arr, results ) {
  8826. var ret = results || [];
  8827. if ( arr != null ) {
  8828. if ( isArrayLike( Object( arr ) ) ) {
  8829. jQuery.merge( ret,
  8830. typeof arr === "string" ?
  8831. [ arr ] : arr
  8832. );
  8833. } else {
  8834. push.call( ret, arr );
  8835. }
  8836. }
  8837. return ret;
  8838. },
  8839. inArray: function( elem, arr, i ) {
  8840. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8841. },
  8842. // Support: Android <=4.0 only, PhantomJS 1 only
  8843. // push.apply(_, arraylike) throws on ancient WebKit
  8844. merge: function( first, second ) {
  8845. var len = +second.length,
  8846. j = 0,
  8847. i = first.length;
  8848. for ( ; j < len; j++ ) {
  8849. first[ i++ ] = second[ j ];
  8850. }
  8851. first.length = i;
  8852. return first;
  8853. },
  8854. grep: function( elems, callback, invert ) {
  8855. var callbackInverse,
  8856. matches = [],
  8857. i = 0,
  8858. length = elems.length,
  8859. callbackExpect = !invert;
  8860. // Go through the array, only saving the items
  8861. // that pass the validator function
  8862. for ( ; i < length; i++ ) {
  8863. callbackInverse = !callback( elems[ i ], i );
  8864. if ( callbackInverse !== callbackExpect ) {
  8865. matches.push( elems[ i ] );
  8866. }
  8867. }
  8868. return matches;
  8869. },
  8870. // arg is for internal usage only
  8871. map: function( elems, callback, arg ) {
  8872. var length, value,
  8873. i = 0,
  8874. ret = [];
  8875. // Go through the array, translating each of the items to their new values
  8876. if ( isArrayLike( elems ) ) {
  8877. length = elems.length;
  8878. for ( ; i < length; i++ ) {
  8879. value = callback( elems[ i ], i, arg );
  8880. if ( value != null ) {
  8881. ret.push( value );
  8882. }
  8883. }
  8884. // Go through every key on the object,
  8885. } else {
  8886. for ( i in elems ) {
  8887. value = callback( elems[ i ], i, arg );
  8888. if ( value != null ) {
  8889. ret.push( value );
  8890. }
  8891. }
  8892. }
  8893. // Flatten any nested arrays
  8894. return concat.apply( [], ret );
  8895. },
  8896. // A global GUID counter for objects
  8897. guid: 1,
  8898. // jQuery.support is not used in Core but other projects attach their
  8899. // properties to it so it needs to exist.
  8900. support: support
  8901. } );
  8902. if ( typeof Symbol === "function" ) {
  8903. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8904. }
  8905. // Populate the class2type map
  8906. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8907. function( i, name ) {
  8908. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8909. } );
  8910. function isArrayLike( obj ) {
  8911. // Support: real iOS 8.2 only (not reproducible in simulator)
  8912. // `in` check used to prevent JIT error (gh-2145)
  8913. // hasOwn isn't used here due to false negatives
  8914. // regarding Nodelist length in IE
  8915. var length = !!obj && "length" in obj && obj.length,
  8916. type = toType( obj );
  8917. if ( isFunction( obj ) || isWindow( obj ) ) {
  8918. return false;
  8919. }
  8920. return type === "array" || length === 0 ||
  8921. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8922. }
  8923. var Sizzle =
  8924. /*!
  8925. * Sizzle CSS Selector Engine v2.3.4
  8926. * https://sizzlejs.com/
  8927. *
  8928. * Copyright JS Foundation and other contributors
  8929. * Released under the MIT license
  8930. * https://js.foundation/
  8931. *
  8932. * Date: 2019-04-08
  8933. */
  8934. (function( window ) {
  8935. var i,
  8936. support,
  8937. Expr,
  8938. getText,
  8939. isXML,
  8940. tokenize,
  8941. compile,
  8942. select,
  8943. outermostContext,
  8944. sortInput,
  8945. hasDuplicate,
  8946. // Local document vars
  8947. setDocument,
  8948. document,
  8949. docElem,
  8950. documentIsHTML,
  8951. rbuggyQSA,
  8952. rbuggyMatches,
  8953. matches,
  8954. contains,
  8955. // Instance-specific data
  8956. expando = "sizzle" + 1 * new Date(),
  8957. preferredDoc = window.document,
  8958. dirruns = 0,
  8959. done = 0,
  8960. classCache = createCache(),
  8961. tokenCache = createCache(),
  8962. compilerCache = createCache(),
  8963. nonnativeSelectorCache = createCache(),
  8964. sortOrder = function( a, b ) {
  8965. if ( a === b ) {
  8966. hasDuplicate = true;
  8967. }
  8968. return 0;
  8969. },
  8970. // Instance methods
  8971. hasOwn = ({}).hasOwnProperty,
  8972. arr = [],
  8973. pop = arr.pop,
  8974. push_native = arr.push,
  8975. push = arr.push,
  8976. slice = arr.slice,
  8977. // Use a stripped-down indexOf as it's faster than native
  8978. // https://jsperf.com/thor-indexof-vs-for/5
  8979. indexOf = function( list, elem ) {
  8980. var i = 0,
  8981. len = list.length;
  8982. for ( ; i < len; i++ ) {
  8983. if ( list[i] === elem ) {
  8984. return i;
  8985. }
  8986. }
  8987. return -1;
  8988. },
  8989. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8990. // Regular expressions
  8991. // http://www.w3.org/TR/css3-selectors/#whitespace
  8992. whitespace = "[\\x20\\t\\r\\n\\f]",
  8993. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8994. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8995. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8996. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8997. // Operator (capture 2)
  8998. "*([*^$|!~]?=)" + whitespace +
  8999. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9000. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9001. "*\\]",
  9002. pseudos = ":(" + identifier + ")(?:\\((" +
  9003. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9004. // 1. quoted (capture 3; capture 4 or capture 5)
  9005. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9006. // 2. simple (capture 6)
  9007. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9008. // 3. anything else (capture 2)
  9009. ".*" +
  9010. ")\\)|)",
  9011. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9012. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9013. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9014. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9015. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9016. rdescend = new RegExp( whitespace + "|>" ),
  9017. rpseudo = new RegExp( pseudos ),
  9018. ridentifier = new RegExp( "^" + identifier + "$" ),
  9019. matchExpr = {
  9020. "ID": new RegExp( "^#(" + identifier + ")" ),
  9021. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9022. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9023. "ATTR": new RegExp( "^" + attributes ),
  9024. "PSEUDO": new RegExp( "^" + pseudos ),
  9025. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9026. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9027. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9028. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9029. // For use in libraries implementing .is()
  9030. // We use this for POS matching in `select`
  9031. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9032. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9033. },
  9034. rhtml = /HTML$/i,
  9035. rinputs = /^(?:input|select|textarea|button)$/i,
  9036. rheader = /^h\d$/i,
  9037. rnative = /^[^{]+\{\s*\[native \w/,
  9038. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9039. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9040. rsibling = /[+~]/,
  9041. // CSS escapes
  9042. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9043. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9044. funescape = function( _, escaped, escapedWhitespace ) {
  9045. var high = "0x" + escaped - 0x10000;
  9046. // NaN means non-codepoint
  9047. // Support: Firefox<24
  9048. // Workaround erroneous numeric interpretation of +"0x"
  9049. return high !== high || escapedWhitespace ?
  9050. escaped :
  9051. high < 0 ?
  9052. // BMP codepoint
  9053. String.fromCharCode( high + 0x10000 ) :
  9054. // Supplemental Plane codepoint (surrogate pair)
  9055. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9056. },
  9057. // CSS string/identifier serialization
  9058. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9059. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9060. fcssescape = function( ch, asCodePoint ) {
  9061. if ( asCodePoint ) {
  9062. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9063. if ( ch === "\0" ) {
  9064. return "\uFFFD";
  9065. }
  9066. // Control characters and (dependent upon position) numbers get escaped as code points
  9067. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9068. }
  9069. // Other potentially-special ASCII characters get backslash-escaped
  9070. return "\\" + ch;
  9071. },
  9072. // Used for iframes
  9073. // See setDocument()
  9074. // Removing the function wrapper causes a "Permission Denied"
  9075. // error in IE
  9076. unloadHandler = function() {
  9077. setDocument();
  9078. },
  9079. inDisabledFieldset = addCombinator(
  9080. function( elem ) {
  9081. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9082. },
  9083. { dir: "parentNode", next: "legend" }
  9084. );
  9085. // Optimize for push.apply( _, NodeList )
  9086. try {
  9087. push.apply(
  9088. (arr = slice.call( preferredDoc.childNodes )),
  9089. preferredDoc.childNodes
  9090. );
  9091. // Support: Android<4.0
  9092. // Detect silently failing push.apply
  9093. arr[ preferredDoc.childNodes.length ].nodeType;
  9094. } catch ( e ) {
  9095. push = { apply: arr.length ?
  9096. // Leverage slice if possible
  9097. function( target, els ) {
  9098. push_native.apply( target, slice.call(els) );
  9099. } :
  9100. // Support: IE<9
  9101. // Otherwise append directly
  9102. function( target, els ) {
  9103. var j = target.length,
  9104. i = 0;
  9105. // Can't trust NodeList.length
  9106. while ( (target[j++] = els[i++]) ) {}
  9107. target.length = j - 1;
  9108. }
  9109. };
  9110. }
  9111. function Sizzle( selector, context, results, seed ) {
  9112. var m, i, elem, nid, match, groups, newSelector,
  9113. newContext = context && context.ownerDocument,
  9114. // nodeType defaults to 9, since context defaults to document
  9115. nodeType = context ? context.nodeType : 9;
  9116. results = results || [];
  9117. // Return early from calls with invalid selector or context
  9118. if ( typeof selector !== "string" || !selector ||
  9119. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9120. return results;
  9121. }
  9122. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9123. if ( !seed ) {
  9124. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9125. setDocument( context );
  9126. }
  9127. context = context || document;
  9128. if ( documentIsHTML ) {
  9129. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9130. // (excepting DocumentFragment context, where the methods don't exist)
  9131. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9132. // ID selector
  9133. if ( (m = match[1]) ) {
  9134. // Document context
  9135. if ( nodeType === 9 ) {
  9136. if ( (elem = context.getElementById( m )) ) {
  9137. // Support: IE, Opera, Webkit
  9138. // TODO: identify versions
  9139. // getElementById can match elements by name instead of ID
  9140. if ( elem.id === m ) {
  9141. results.push( elem );
  9142. return results;
  9143. }
  9144. } else {
  9145. return results;
  9146. }
  9147. // Element context
  9148. } else {
  9149. // Support: IE, Opera, Webkit
  9150. // TODO: identify versions
  9151. // getElementById can match elements by name instead of ID
  9152. if ( newContext && (elem = newContext.getElementById( m )) &&
  9153. contains( context, elem ) &&
  9154. elem.id === m ) {
  9155. results.push( elem );
  9156. return results;
  9157. }
  9158. }
  9159. // Type selector
  9160. } else if ( match[2] ) {
  9161. push.apply( results, context.getElementsByTagName( selector ) );
  9162. return results;
  9163. // Class selector
  9164. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9165. context.getElementsByClassName ) {
  9166. push.apply( results, context.getElementsByClassName( m ) );
  9167. return results;
  9168. }
  9169. }
  9170. // Take advantage of querySelectorAll
  9171. if ( support.qsa &&
  9172. !nonnativeSelectorCache[ selector + " " ] &&
  9173. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9174. // Support: IE 8 only
  9175. // Exclude object elements
  9176. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9177. newSelector = selector;
  9178. newContext = context;
  9179. // qSA considers elements outside a scoping root when evaluating child or
  9180. // descendant combinators, which is not what we want.
  9181. // In such cases, we work around the behavior by prefixing every selector in the
  9182. // list with an ID selector referencing the scope context.
  9183. // Thanks to Andrew Dupont for this technique.
  9184. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9185. // Capture the context ID, setting it first if necessary
  9186. if ( (nid = context.getAttribute( "id" )) ) {
  9187. nid = nid.replace( rcssescape, fcssescape );
  9188. } else {
  9189. context.setAttribute( "id", (nid = expando) );
  9190. }
  9191. // Prefix every selector in the list
  9192. groups = tokenize( selector );
  9193. i = groups.length;
  9194. while ( i-- ) {
  9195. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9196. }
  9197. newSelector = groups.join( "," );
  9198. // Expand context for sibling selectors
  9199. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9200. context;
  9201. }
  9202. try {
  9203. push.apply( results,
  9204. newContext.querySelectorAll( newSelector )
  9205. );
  9206. return results;
  9207. } catch ( qsaError ) {
  9208. nonnativeSelectorCache( selector, true );
  9209. } finally {
  9210. if ( nid === expando ) {
  9211. context.removeAttribute( "id" );
  9212. }
  9213. }
  9214. }
  9215. }
  9216. }
  9217. // All others
  9218. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9219. }
  9220. /**
  9221. * Create key-value caches of limited size
  9222. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9223. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9224. * deleting the oldest entry
  9225. */
  9226. function createCache() {
  9227. var keys = [];
  9228. function cache( key, value ) {
  9229. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9230. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9231. // Only keep the most recent entries
  9232. delete cache[ keys.shift() ];
  9233. }
  9234. return (cache[ key + " " ] = value);
  9235. }
  9236. return cache;
  9237. }
  9238. /**
  9239. * Mark a function for special use by Sizzle
  9240. * @param {Function} fn The function to mark
  9241. */
  9242. function markFunction( fn ) {
  9243. fn[ expando ] = true;
  9244. return fn;
  9245. }
  9246. /**
  9247. * Support testing using an element
  9248. * @param {Function} fn Passed the created element and returns a boolean result
  9249. */
  9250. function assert( fn ) {
  9251. var el = document.createElement("fieldset");
  9252. try {
  9253. return !!fn( el );
  9254. } catch (e) {
  9255. return false;
  9256. } finally {
  9257. // Remove from its parent by default
  9258. if ( el.parentNode ) {
  9259. el.parentNode.removeChild( el );
  9260. }
  9261. // release memory in IE
  9262. el = null;
  9263. }
  9264. }
  9265. /**
  9266. * Adds the same handler for all of the specified attrs
  9267. * @param {String} attrs Pipe-separated list of attributes
  9268. * @param {Function} handler The method that will be applied
  9269. */
  9270. function addHandle( attrs, handler ) {
  9271. var arr = attrs.split("|"),
  9272. i = arr.length;
  9273. while ( i-- ) {
  9274. Expr.attrHandle[ arr[i] ] = handler;
  9275. }
  9276. }
  9277. /**
  9278. * Checks document order of two siblings
  9279. * @param {Element} a
  9280. * @param {Element} b
  9281. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9282. */
  9283. function siblingCheck( a, b ) {
  9284. var cur = b && a,
  9285. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9286. a.sourceIndex - b.sourceIndex;
  9287. // Use IE sourceIndex if available on both nodes
  9288. if ( diff ) {
  9289. return diff;
  9290. }
  9291. // Check if b follows a
  9292. if ( cur ) {
  9293. while ( (cur = cur.nextSibling) ) {
  9294. if ( cur === b ) {
  9295. return -1;
  9296. }
  9297. }
  9298. }
  9299. return a ? 1 : -1;
  9300. }
  9301. /**
  9302. * Returns a function to use in pseudos for input types
  9303. * @param {String} type
  9304. */
  9305. function createInputPseudo( type ) {
  9306. return function( elem ) {
  9307. var name = elem.nodeName.toLowerCase();
  9308. return name === "input" && elem.type === type;
  9309. };
  9310. }
  9311. /**
  9312. * Returns a function to use in pseudos for buttons
  9313. * @param {String} type
  9314. */
  9315. function createButtonPseudo( type ) {
  9316. return function( elem ) {
  9317. var name = elem.nodeName.toLowerCase();
  9318. return (name === "input" || name === "button") && elem.type === type;
  9319. };
  9320. }
  9321. /**
  9322. * Returns a function to use in pseudos for :enabled/:disabled
  9323. * @param {Boolean} disabled true for :disabled; false for :enabled
  9324. */
  9325. function createDisabledPseudo( disabled ) {
  9326. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9327. return function( elem ) {
  9328. // Only certain elements can match :enabled or :disabled
  9329. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9330. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9331. if ( "form" in elem ) {
  9332. // Check for inherited disabledness on relevant non-disabled elements:
  9333. // * listed form-associated elements in a disabled fieldset
  9334. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9335. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9336. // * option elements in a disabled optgroup
  9337. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9338. // All such elements have a "form" property.
  9339. if ( elem.parentNode && elem.disabled === false ) {
  9340. // Option elements defer to a parent optgroup if present
  9341. if ( "label" in elem ) {
  9342. if ( "label" in elem.parentNode ) {
  9343. return elem.parentNode.disabled === disabled;
  9344. } else {
  9345. return elem.disabled === disabled;
  9346. }
  9347. }
  9348. // Support: IE 6 - 11
  9349. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9350. return elem.isDisabled === disabled ||
  9351. // Where there is no isDisabled, check manually
  9352. /* jshint -W018 */
  9353. elem.isDisabled !== !disabled &&
  9354. inDisabledFieldset( elem ) === disabled;
  9355. }
  9356. return elem.disabled === disabled;
  9357. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9358. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9359. // even exist on them, let alone have a boolean value.
  9360. } else if ( "label" in elem ) {
  9361. return elem.disabled === disabled;
  9362. }
  9363. // Remaining elements are neither :enabled nor :disabled
  9364. return false;
  9365. };
  9366. }
  9367. /**
  9368. * Returns a function to use in pseudos for positionals
  9369. * @param {Function} fn
  9370. */
  9371. function createPositionalPseudo( fn ) {
  9372. return markFunction(function( argument ) {
  9373. argument = +argument;
  9374. return markFunction(function( seed, matches ) {
  9375. var j,
  9376. matchIndexes = fn( [], seed.length, argument ),
  9377. i = matchIndexes.length;
  9378. // Match elements found at the specified indexes
  9379. while ( i-- ) {
  9380. if ( seed[ (j = matchIndexes[i]) ] ) {
  9381. seed[j] = !(matches[j] = seed[j]);
  9382. }
  9383. }
  9384. });
  9385. });
  9386. }
  9387. /**
  9388. * Checks a node for validity as a Sizzle context
  9389. * @param {Element|Object=} context
  9390. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9391. */
  9392. function testContext( context ) {
  9393. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9394. }
  9395. // Expose support vars for convenience
  9396. support = Sizzle.support = {};
  9397. /**
  9398. * Detects XML nodes
  9399. * @param {Element|Object} elem An element or a document
  9400. * @returns {Boolean} True iff elem is a non-HTML XML node
  9401. */
  9402. isXML = Sizzle.isXML = function( elem ) {
  9403. var namespace = elem.namespaceURI,
  9404. docElem = (elem.ownerDocument || elem).documentElement;
  9405. // Support: IE <=8
  9406. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9407. // https://bugs.jquery.com/ticket/4833
  9408. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9409. };
  9410. /**
  9411. * Sets document-related variables once based on the current document
  9412. * @param {Element|Object} [doc] An element or document object to use to set the document
  9413. * @returns {Object} Returns the current document
  9414. */
  9415. setDocument = Sizzle.setDocument = function( node ) {
  9416. var hasCompare, subWindow,
  9417. doc = node ? node.ownerDocument || node : preferredDoc;
  9418. // Return early if doc is invalid or already selected
  9419. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9420. return document;
  9421. }
  9422. // Update global variables
  9423. document = doc;
  9424. docElem = document.documentElement;
  9425. documentIsHTML = !isXML( document );
  9426. // Support: IE 9-11, Edge
  9427. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9428. if ( preferredDoc !== document &&
  9429. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9430. // Support: IE 11, Edge
  9431. if ( subWindow.addEventListener ) {
  9432. subWindow.addEventListener( "unload", unloadHandler, false );
  9433. // Support: IE 9 - 10 only
  9434. } else if ( subWindow.attachEvent ) {
  9435. subWindow.attachEvent( "onunload", unloadHandler );
  9436. }
  9437. }
  9438. /* Attributes
  9439. ---------------------------------------------------------------------- */
  9440. // Support: IE<8
  9441. // Verify that getAttribute really returns attributes and not properties
  9442. // (excepting IE8 booleans)
  9443. support.attributes = assert(function( el ) {
  9444. el.className = "i";
  9445. return !el.getAttribute("className");
  9446. });
  9447. /* getElement(s)By*
  9448. ---------------------------------------------------------------------- */
  9449. // Check if getElementsByTagName("*") returns only elements
  9450. support.getElementsByTagName = assert(function( el ) {
  9451. el.appendChild( document.createComment("") );
  9452. return !el.getElementsByTagName("*").length;
  9453. });
  9454. // Support: IE<9
  9455. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9456. // Support: IE<10
  9457. // Check if getElementById returns elements by name
  9458. // The broken getElementById methods don't pick up programmatically-set names,
  9459. // so use a roundabout getElementsByName test
  9460. support.getById = assert(function( el ) {
  9461. docElem.appendChild( el ).id = expando;
  9462. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9463. });
  9464. // ID filter and find
  9465. if ( support.getById ) {
  9466. Expr.filter["ID"] = function( id ) {
  9467. var attrId = id.replace( runescape, funescape );
  9468. return function( elem ) {
  9469. return elem.getAttribute("id") === attrId;
  9470. };
  9471. };
  9472. Expr.find["ID"] = function( id, context ) {
  9473. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9474. var elem = context.getElementById( id );
  9475. return elem ? [ elem ] : [];
  9476. }
  9477. };
  9478. } else {
  9479. Expr.filter["ID"] = function( id ) {
  9480. var attrId = id.replace( runescape, funescape );
  9481. return function( elem ) {
  9482. var node = typeof elem.getAttributeNode !== "undefined" &&
  9483. elem.getAttributeNode("id");
  9484. return node && node.value === attrId;
  9485. };
  9486. };
  9487. // Support: IE 6 - 7 only
  9488. // getElementById is not reliable as a find shortcut
  9489. Expr.find["ID"] = function( id, context ) {
  9490. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9491. var node, i, elems,
  9492. elem = context.getElementById( id );
  9493. if ( elem ) {
  9494. // Verify the id attribute
  9495. node = elem.getAttributeNode("id");
  9496. if ( node && node.value === id ) {
  9497. return [ elem ];
  9498. }
  9499. // Fall back on getElementsByName
  9500. elems = context.getElementsByName( id );
  9501. i = 0;
  9502. while ( (elem = elems[i++]) ) {
  9503. node = elem.getAttributeNode("id");
  9504. if ( node && node.value === id ) {
  9505. return [ elem ];
  9506. }
  9507. }
  9508. }
  9509. return [];
  9510. }
  9511. };
  9512. }
  9513. // Tag
  9514. Expr.find["TAG"] = support.getElementsByTagName ?
  9515. function( tag, context ) {
  9516. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9517. return context.getElementsByTagName( tag );
  9518. // DocumentFragment nodes don't have gEBTN
  9519. } else if ( support.qsa ) {
  9520. return context.querySelectorAll( tag );
  9521. }
  9522. } :
  9523. function( tag, context ) {
  9524. var elem,
  9525. tmp = [],
  9526. i = 0,
  9527. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9528. results = context.getElementsByTagName( tag );
  9529. // Filter out possible comments
  9530. if ( tag === "*" ) {
  9531. while ( (elem = results[i++]) ) {
  9532. if ( elem.nodeType === 1 ) {
  9533. tmp.push( elem );
  9534. }
  9535. }
  9536. return tmp;
  9537. }
  9538. return results;
  9539. };
  9540. // Class
  9541. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9542. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9543. return context.getElementsByClassName( className );
  9544. }
  9545. };
  9546. /* QSA/matchesSelector
  9547. ---------------------------------------------------------------------- */
  9548. // QSA and matchesSelector support
  9549. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9550. rbuggyMatches = [];
  9551. // qSa(:focus) reports false when true (Chrome 21)
  9552. // We allow this because of a bug in IE8/9 that throws an error
  9553. // whenever `document.activeElement` is accessed on an iframe
  9554. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9555. // See https://bugs.jquery.com/ticket/13378
  9556. rbuggyQSA = [];
  9557. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9558. // Build QSA regex
  9559. // Regex strategy adopted from Diego Perini
  9560. assert(function( el ) {
  9561. // Select is set to empty string on purpose
  9562. // This is to test IE's treatment of not explicitly
  9563. // setting a boolean content attribute,
  9564. // since its presence should be enough
  9565. // https://bugs.jquery.com/ticket/12359
  9566. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9567. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9568. "<option selected=''></option></select>";
  9569. // Support: IE8, Opera 11-12.16
  9570. // Nothing should be selected when empty strings follow ^= or $= or *=
  9571. // The test attribute must be unknown in Opera but "safe" for WinRT
  9572. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9573. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9574. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9575. }
  9576. // Support: IE8
  9577. // Boolean attributes and "value" are not treated correctly
  9578. if ( !el.querySelectorAll("[selected]").length ) {
  9579. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9580. }
  9581. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9582. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9583. rbuggyQSA.push("~=");
  9584. }
  9585. // Webkit/Opera - :checked should return selected option elements
  9586. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9587. // IE8 throws error here and will not see later tests
  9588. if ( !el.querySelectorAll(":checked").length ) {
  9589. rbuggyQSA.push(":checked");
  9590. }
  9591. // Support: Safari 8+, iOS 8+
  9592. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9593. // In-page `selector#id sibling-combinator selector` fails
  9594. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9595. rbuggyQSA.push(".#.+[+~]");
  9596. }
  9597. });
  9598. assert(function( el ) {
  9599. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9600. "<select disabled='disabled'><option/></select>";
  9601. // Support: Windows 8 Native Apps
  9602. // The type and name attributes are restricted during .innerHTML assignment
  9603. var input = document.createElement("input");
  9604. input.setAttribute( "type", "hidden" );
  9605. el.appendChild( input ).setAttribute( "name", "D" );
  9606. // Support: IE8
  9607. // Enforce case-sensitivity of name attribute
  9608. if ( el.querySelectorAll("[name=d]").length ) {
  9609. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9610. }
  9611. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9612. // IE8 throws error here and will not see later tests
  9613. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9614. rbuggyQSA.push( ":enabled", ":disabled" );
  9615. }
  9616. // Support: IE9-11+
  9617. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9618. docElem.appendChild( el ).disabled = true;
  9619. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9620. rbuggyQSA.push( ":enabled", ":disabled" );
  9621. }
  9622. // Opera 10-11 does not throw on post-comma invalid pseudos
  9623. el.querySelectorAll("*,:x");
  9624. rbuggyQSA.push(",.*:");
  9625. });
  9626. }
  9627. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9628. docElem.webkitMatchesSelector ||
  9629. docElem.mozMatchesSelector ||
  9630. docElem.oMatchesSelector ||
  9631. docElem.msMatchesSelector) )) ) {
  9632. assert(function( el ) {
  9633. // Check to see if it's possible to do matchesSelector
  9634. // on a disconnected node (IE 9)
  9635. support.disconnectedMatch = matches.call( el, "*" );
  9636. // This should fail with an exception
  9637. // Gecko does not error, returns false instead
  9638. matches.call( el, "[s!='']:x" );
  9639. rbuggyMatches.push( "!=", pseudos );
  9640. });
  9641. }
  9642. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9643. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9644. /* Contains
  9645. ---------------------------------------------------------------------- */
  9646. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9647. // Element contains another
  9648. // Purposefully self-exclusive
  9649. // As in, an element does not contain itself
  9650. contains = hasCompare || rnative.test( docElem.contains ) ?
  9651. function( a, b ) {
  9652. var adown = a.nodeType === 9 ? a.documentElement : a,
  9653. bup = b && b.parentNode;
  9654. return a === bup || !!( bup && bup.nodeType === 1 && (
  9655. adown.contains ?
  9656. adown.contains( bup ) :
  9657. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9658. ));
  9659. } :
  9660. function( a, b ) {
  9661. if ( b ) {
  9662. while ( (b = b.parentNode) ) {
  9663. if ( b === a ) {
  9664. return true;
  9665. }
  9666. }
  9667. }
  9668. return false;
  9669. };
  9670. /* Sorting
  9671. ---------------------------------------------------------------------- */
  9672. // Document order sorting
  9673. sortOrder = hasCompare ?
  9674. function( a, b ) {
  9675. // Flag for duplicate removal
  9676. if ( a === b ) {
  9677. hasDuplicate = true;
  9678. return 0;
  9679. }
  9680. // Sort on method existence if only one input has compareDocumentPosition
  9681. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9682. if ( compare ) {
  9683. return compare;
  9684. }
  9685. // Calculate position if both inputs belong to the same document
  9686. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9687. a.compareDocumentPosition( b ) :
  9688. // Otherwise we know they are disconnected
  9689. 1;
  9690. // Disconnected nodes
  9691. if ( compare & 1 ||
  9692. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9693. // Choose the first element that is related to our preferred document
  9694. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9695. return -1;
  9696. }
  9697. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9698. return 1;
  9699. }
  9700. // Maintain original order
  9701. return sortInput ?
  9702. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9703. 0;
  9704. }
  9705. return compare & 4 ? -1 : 1;
  9706. } :
  9707. function( a, b ) {
  9708. // Exit early if the nodes are identical
  9709. if ( a === b ) {
  9710. hasDuplicate = true;
  9711. return 0;
  9712. }
  9713. var cur,
  9714. i = 0,
  9715. aup = a.parentNode,
  9716. bup = b.parentNode,
  9717. ap = [ a ],
  9718. bp = [ b ];
  9719. // Parentless nodes are either documents or disconnected
  9720. if ( !aup || !bup ) {
  9721. return a === document ? -1 :
  9722. b === document ? 1 :
  9723. aup ? -1 :
  9724. bup ? 1 :
  9725. sortInput ?
  9726. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9727. 0;
  9728. // If the nodes are siblings, we can do a quick check
  9729. } else if ( aup === bup ) {
  9730. return siblingCheck( a, b );
  9731. }
  9732. // Otherwise we need full lists of their ancestors for comparison
  9733. cur = a;
  9734. while ( (cur = cur.parentNode) ) {
  9735. ap.unshift( cur );
  9736. }
  9737. cur = b;
  9738. while ( (cur = cur.parentNode) ) {
  9739. bp.unshift( cur );
  9740. }
  9741. // Walk down the tree looking for a discrepancy
  9742. while ( ap[i] === bp[i] ) {
  9743. i++;
  9744. }
  9745. return i ?
  9746. // Do a sibling check if the nodes have a common ancestor
  9747. siblingCheck( ap[i], bp[i] ) :
  9748. // Otherwise nodes in our document sort first
  9749. ap[i] === preferredDoc ? -1 :
  9750. bp[i] === preferredDoc ? 1 :
  9751. 0;
  9752. };
  9753. return document;
  9754. };
  9755. Sizzle.matches = function( expr, elements ) {
  9756. return Sizzle( expr, null, null, elements );
  9757. };
  9758. Sizzle.matchesSelector = function( elem, expr ) {
  9759. // Set document vars if needed
  9760. if ( ( elem.ownerDocument || elem ) !== document ) {
  9761. setDocument( elem );
  9762. }
  9763. if ( support.matchesSelector && documentIsHTML &&
  9764. !nonnativeSelectorCache[ expr + " " ] &&
  9765. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9766. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9767. try {
  9768. var ret = matches.call( elem, expr );
  9769. // IE 9's matchesSelector returns false on disconnected nodes
  9770. if ( ret || support.disconnectedMatch ||
  9771. // As well, disconnected nodes are said to be in a document
  9772. // fragment in IE 9
  9773. elem.document && elem.document.nodeType !== 11 ) {
  9774. return ret;
  9775. }
  9776. } catch (e) {
  9777. nonnativeSelectorCache( expr, true );
  9778. }
  9779. }
  9780. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9781. };
  9782. Sizzle.contains = function( context, elem ) {
  9783. // Set document vars if needed
  9784. if ( ( context.ownerDocument || context ) !== document ) {
  9785. setDocument( context );
  9786. }
  9787. return contains( context, elem );
  9788. };
  9789. Sizzle.attr = function( elem, name ) {
  9790. // Set document vars if needed
  9791. if ( ( elem.ownerDocument || elem ) !== document ) {
  9792. setDocument( elem );
  9793. }
  9794. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9795. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9796. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9797. fn( elem, name, !documentIsHTML ) :
  9798. undefined;
  9799. return val !== undefined ?
  9800. val :
  9801. support.attributes || !documentIsHTML ?
  9802. elem.getAttribute( name ) :
  9803. (val = elem.getAttributeNode(name)) && val.specified ?
  9804. val.value :
  9805. null;
  9806. };
  9807. Sizzle.escape = function( sel ) {
  9808. return (sel + "").replace( rcssescape, fcssescape );
  9809. };
  9810. Sizzle.error = function( msg ) {
  9811. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9812. };
  9813. /**
  9814. * Document sorting and removing duplicates
  9815. * @param {ArrayLike} results
  9816. */
  9817. Sizzle.uniqueSort = function( results ) {
  9818. var elem,
  9819. duplicates = [],
  9820. j = 0,
  9821. i = 0;
  9822. // Unless we *know* we can detect duplicates, assume their presence
  9823. hasDuplicate = !support.detectDuplicates;
  9824. sortInput = !support.sortStable && results.slice( 0 );
  9825. results.sort( sortOrder );
  9826. if ( hasDuplicate ) {
  9827. while ( (elem = results[i++]) ) {
  9828. if ( elem === results[ i ] ) {
  9829. j = duplicates.push( i );
  9830. }
  9831. }
  9832. while ( j-- ) {
  9833. results.splice( duplicates[ j ], 1 );
  9834. }
  9835. }
  9836. // Clear input after sorting to release objects
  9837. // See https://github.com/jquery/sizzle/pull/225
  9838. sortInput = null;
  9839. return results;
  9840. };
  9841. /**
  9842. * Utility function for retrieving the text value of an array of DOM nodes
  9843. * @param {Array|Element} elem
  9844. */
  9845. getText = Sizzle.getText = function( elem ) {
  9846. var node,
  9847. ret = "",
  9848. i = 0,
  9849. nodeType = elem.nodeType;
  9850. if ( !nodeType ) {
  9851. // If no nodeType, this is expected to be an array
  9852. while ( (node = elem[i++]) ) {
  9853. // Do not traverse comment nodes
  9854. ret += getText( node );
  9855. }
  9856. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9857. // Use textContent for elements
  9858. // innerText usage removed for consistency of new lines (jQuery #11153)
  9859. if ( typeof elem.textContent === "string" ) {
  9860. return elem.textContent;
  9861. } else {
  9862. // Traverse its children
  9863. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9864. ret += getText( elem );
  9865. }
  9866. }
  9867. } else if ( nodeType === 3 || nodeType === 4 ) {
  9868. return elem.nodeValue;
  9869. }
  9870. // Do not include comment or processing instruction nodes
  9871. return ret;
  9872. };
  9873. Expr = Sizzle.selectors = {
  9874. // Can be adjusted by the user
  9875. cacheLength: 50,
  9876. createPseudo: markFunction,
  9877. match: matchExpr,
  9878. attrHandle: {},
  9879. find: {},
  9880. relative: {
  9881. ">": { dir: "parentNode", first: true },
  9882. " ": { dir: "parentNode" },
  9883. "+": { dir: "previousSibling", first: true },
  9884. "~": { dir: "previousSibling" }
  9885. },
  9886. preFilter: {
  9887. "ATTR": function( match ) {
  9888. match[1] = match[1].replace( runescape, funescape );
  9889. // Move the given value to match[3] whether quoted or unquoted
  9890. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9891. if ( match[2] === "~=" ) {
  9892. match[3] = " " + match[3] + " ";
  9893. }
  9894. return match.slice( 0, 4 );
  9895. },
  9896. "CHILD": function( match ) {
  9897. /* matches from matchExpr["CHILD"]
  9898. 1 type (only|nth|...)
  9899. 2 what (child|of-type)
  9900. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9901. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9902. 5 sign of xn-component
  9903. 6 x of xn-component
  9904. 7 sign of y-component
  9905. 8 y of y-component
  9906. */
  9907. match[1] = match[1].toLowerCase();
  9908. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9909. // nth-* requires argument
  9910. if ( !match[3] ) {
  9911. Sizzle.error( match[0] );
  9912. }
  9913. // numeric x and y parameters for Expr.filter.CHILD
  9914. // remember that false/true cast respectively to 0/1
  9915. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9916. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9917. // other types prohibit arguments
  9918. } else if ( match[3] ) {
  9919. Sizzle.error( match[0] );
  9920. }
  9921. return match;
  9922. },
  9923. "PSEUDO": function( match ) {
  9924. var excess,
  9925. unquoted = !match[6] && match[2];
  9926. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9927. return null;
  9928. }
  9929. // Accept quoted arguments as-is
  9930. if ( match[3] ) {
  9931. match[2] = match[4] || match[5] || "";
  9932. // Strip excess characters from unquoted arguments
  9933. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9934. // Get excess from tokenize (recursively)
  9935. (excess = tokenize( unquoted, true )) &&
  9936. // advance to the next closing parenthesis
  9937. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9938. // excess is a negative index
  9939. match[0] = match[0].slice( 0, excess );
  9940. match[2] = unquoted.slice( 0, excess );
  9941. }
  9942. // Return only captures needed by the pseudo filter method (type and argument)
  9943. return match.slice( 0, 3 );
  9944. }
  9945. },
  9946. filter: {
  9947. "TAG": function( nodeNameSelector ) {
  9948. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9949. return nodeNameSelector === "*" ?
  9950. function() { return true; } :
  9951. function( elem ) {
  9952. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9953. };
  9954. },
  9955. "CLASS": function( className ) {
  9956. var pattern = classCache[ className + " " ];
  9957. return pattern ||
  9958. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9959. classCache( className, function( elem ) {
  9960. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9961. });
  9962. },
  9963. "ATTR": function( name, operator, check ) {
  9964. return function( elem ) {
  9965. var result = Sizzle.attr( elem, name );
  9966. if ( result == null ) {
  9967. return operator === "!=";
  9968. }
  9969. if ( !operator ) {
  9970. return true;
  9971. }
  9972. result += "";
  9973. return operator === "=" ? result === check :
  9974. operator === "!=" ? result !== check :
  9975. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9976. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9977. operator === "$=" ? check && result.slice( -check.length ) === check :
  9978. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9979. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9980. false;
  9981. };
  9982. },
  9983. "CHILD": function( type, what, argument, first, last ) {
  9984. var simple = type.slice( 0, 3 ) !== "nth",
  9985. forward = type.slice( -4 ) !== "last",
  9986. ofType = what === "of-type";
  9987. return first === 1 && last === 0 ?
  9988. // Shortcut for :nth-*(n)
  9989. function( elem ) {
  9990. return !!elem.parentNode;
  9991. } :
  9992. function( elem, context, xml ) {
  9993. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9994. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9995. parent = elem.parentNode,
  9996. name = ofType && elem.nodeName.toLowerCase(),
  9997. useCache = !xml && !ofType,
  9998. diff = false;
  9999. if ( parent ) {
  10000. // :(first|last|only)-(child|of-type)
  10001. if ( simple ) {
  10002. while ( dir ) {
  10003. node = elem;
  10004. while ( (node = node[ dir ]) ) {
  10005. if ( ofType ?
  10006. node.nodeName.toLowerCase() === name :
  10007. node.nodeType === 1 ) {
  10008. return false;
  10009. }
  10010. }
  10011. // Reverse direction for :only-* (if we haven't yet done so)
  10012. start = dir = type === "only" && !start && "nextSibling";
  10013. }
  10014. return true;
  10015. }
  10016. start = [ forward ? parent.firstChild : parent.lastChild ];
  10017. // non-xml :nth-child(...) stores cache data on `parent`
  10018. if ( forward && useCache ) {
  10019. // Seek `elem` from a previously-cached index
  10020. // ...in a gzip-friendly way
  10021. node = parent;
  10022. outerCache = node[ expando ] || (node[ expando ] = {});
  10023. // Support: IE <9 only
  10024. // Defend against cloned attroperties (jQuery gh-1709)
  10025. uniqueCache = outerCache[ node.uniqueID ] ||
  10026. (outerCache[ node.uniqueID ] = {});
  10027. cache = uniqueCache[ type ] || [];
  10028. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10029. diff = nodeIndex && cache[ 2 ];
  10030. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10031. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10032. // Fallback to seeking `elem` from the start
  10033. (diff = nodeIndex = 0) || start.pop()) ) {
  10034. // When found, cache indexes on `parent` and break
  10035. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10036. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10037. break;
  10038. }
  10039. }
  10040. } else {
  10041. // Use previously-cached element index if available
  10042. if ( useCache ) {
  10043. // ...in a gzip-friendly way
  10044. node = elem;
  10045. outerCache = node[ expando ] || (node[ expando ] = {});
  10046. // Support: IE <9 only
  10047. // Defend against cloned attroperties (jQuery gh-1709)
  10048. uniqueCache = outerCache[ node.uniqueID ] ||
  10049. (outerCache[ node.uniqueID ] = {});
  10050. cache = uniqueCache[ type ] || [];
  10051. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10052. diff = nodeIndex;
  10053. }
  10054. // xml :nth-child(...)
  10055. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10056. if ( diff === false ) {
  10057. // Use the same loop as above to seek `elem` from the start
  10058. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10059. (diff = nodeIndex = 0) || start.pop()) ) {
  10060. if ( ( ofType ?
  10061. node.nodeName.toLowerCase() === name :
  10062. node.nodeType === 1 ) &&
  10063. ++diff ) {
  10064. // Cache the index of each encountered element
  10065. if ( useCache ) {
  10066. outerCache = node[ expando ] || (node[ expando ] = {});
  10067. // Support: IE <9 only
  10068. // Defend against cloned attroperties (jQuery gh-1709)
  10069. uniqueCache = outerCache[ node.uniqueID ] ||
  10070. (outerCache[ node.uniqueID ] = {});
  10071. uniqueCache[ type ] = [ dirruns, diff ];
  10072. }
  10073. if ( node === elem ) {
  10074. break;
  10075. }
  10076. }
  10077. }
  10078. }
  10079. }
  10080. // Incorporate the offset, then check against cycle size
  10081. diff -= last;
  10082. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10083. }
  10084. };
  10085. },
  10086. "PSEUDO": function( pseudo, argument ) {
  10087. // pseudo-class names are case-insensitive
  10088. // http://www.w3.org/TR/selectors/#pseudo-classes
  10089. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10090. // Remember that setFilters inherits from pseudos
  10091. var args,
  10092. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10093. Sizzle.error( "unsupported pseudo: " + pseudo );
  10094. // The user may use createPseudo to indicate that
  10095. // arguments are needed to create the filter function
  10096. // just as Sizzle does
  10097. if ( fn[ expando ] ) {
  10098. return fn( argument );
  10099. }
  10100. // But maintain support for old signatures
  10101. if ( fn.length > 1 ) {
  10102. args = [ pseudo, pseudo, "", argument ];
  10103. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10104. markFunction(function( seed, matches ) {
  10105. var idx,
  10106. matched = fn( seed, argument ),
  10107. i = matched.length;
  10108. while ( i-- ) {
  10109. idx = indexOf( seed, matched[i] );
  10110. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10111. }
  10112. }) :
  10113. function( elem ) {
  10114. return fn( elem, 0, args );
  10115. };
  10116. }
  10117. return fn;
  10118. }
  10119. },
  10120. pseudos: {
  10121. // Potentially complex pseudos
  10122. "not": markFunction(function( selector ) {
  10123. // Trim the selector passed to compile
  10124. // to avoid treating leading and trailing
  10125. // spaces as combinators
  10126. var input = [],
  10127. results = [],
  10128. matcher = compile( selector.replace( rtrim, "$1" ) );
  10129. return matcher[ expando ] ?
  10130. markFunction(function( seed, matches, context, xml ) {
  10131. var elem,
  10132. unmatched = matcher( seed, null, xml, [] ),
  10133. i = seed.length;
  10134. // Match elements unmatched by `matcher`
  10135. while ( i-- ) {
  10136. if ( (elem = unmatched[i]) ) {
  10137. seed[i] = !(matches[i] = elem);
  10138. }
  10139. }
  10140. }) :
  10141. function( elem, context, xml ) {
  10142. input[0] = elem;
  10143. matcher( input, null, xml, results );
  10144. // Don't keep the element (issue #299)
  10145. input[0] = null;
  10146. return !results.pop();
  10147. };
  10148. }),
  10149. "has": markFunction(function( selector ) {
  10150. return function( elem ) {
  10151. return Sizzle( selector, elem ).length > 0;
  10152. };
  10153. }),
  10154. "contains": markFunction(function( text ) {
  10155. text = text.replace( runescape, funescape );
  10156. return function( elem ) {
  10157. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10158. };
  10159. }),
  10160. // "Whether an element is represented by a :lang() selector
  10161. // is based solely on the element's language value
  10162. // being equal to the identifier C,
  10163. // or beginning with the identifier C immediately followed by "-".
  10164. // The matching of C against the element's language value is performed case-insensitively.
  10165. // The identifier C does not have to be a valid language name."
  10166. // http://www.w3.org/TR/selectors/#lang-pseudo
  10167. "lang": markFunction( function( lang ) {
  10168. // lang value must be a valid identifier
  10169. if ( !ridentifier.test(lang || "") ) {
  10170. Sizzle.error( "unsupported lang: " + lang );
  10171. }
  10172. lang = lang.replace( runescape, funescape ).toLowerCase();
  10173. return function( elem ) {
  10174. var elemLang;
  10175. do {
  10176. if ( (elemLang = documentIsHTML ?
  10177. elem.lang :
  10178. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10179. elemLang = elemLang.toLowerCase();
  10180. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10181. }
  10182. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10183. return false;
  10184. };
  10185. }),
  10186. // Miscellaneous
  10187. "target": function( elem ) {
  10188. var hash = window.location && window.location.hash;
  10189. return hash && hash.slice( 1 ) === elem.id;
  10190. },
  10191. "root": function( elem ) {
  10192. return elem === docElem;
  10193. },
  10194. "focus": function( elem ) {
  10195. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10196. },
  10197. // Boolean properties
  10198. "enabled": createDisabledPseudo( false ),
  10199. "disabled": createDisabledPseudo( true ),
  10200. "checked": function( elem ) {
  10201. // In CSS3, :checked should return both checked and selected elements
  10202. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10203. var nodeName = elem.nodeName.toLowerCase();
  10204. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10205. },
  10206. "selected": function( elem ) {
  10207. // Accessing this property makes selected-by-default
  10208. // options in Safari work properly
  10209. if ( elem.parentNode ) {
  10210. elem.parentNode.selectedIndex;
  10211. }
  10212. return elem.selected === true;
  10213. },
  10214. // Contents
  10215. "empty": function( elem ) {
  10216. // http://www.w3.org/TR/selectors/#empty-pseudo
  10217. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10218. // but not by others (comment: 8; processing instruction: 7; etc.)
  10219. // nodeType < 6 works because attributes (2) do not appear as children
  10220. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10221. if ( elem.nodeType < 6 ) {
  10222. return false;
  10223. }
  10224. }
  10225. return true;
  10226. },
  10227. "parent": function( elem ) {
  10228. return !Expr.pseudos["empty"]( elem );
  10229. },
  10230. // Element/input types
  10231. "header": function( elem ) {
  10232. return rheader.test( elem.nodeName );
  10233. },
  10234. "input": function( elem ) {
  10235. return rinputs.test( elem.nodeName );
  10236. },
  10237. "button": function( elem ) {
  10238. var name = elem.nodeName.toLowerCase();
  10239. return name === "input" && elem.type === "button" || name === "button";
  10240. },
  10241. "text": function( elem ) {
  10242. var attr;
  10243. return elem.nodeName.toLowerCase() === "input" &&
  10244. elem.type === "text" &&
  10245. // Support: IE<8
  10246. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10247. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10248. },
  10249. // Position-in-collection
  10250. "first": createPositionalPseudo(function() {
  10251. return [ 0 ];
  10252. }),
  10253. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10254. return [ length - 1 ];
  10255. }),
  10256. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10257. return [ argument < 0 ? argument + length : argument ];
  10258. }),
  10259. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10260. var i = 0;
  10261. for ( ; i < length; i += 2 ) {
  10262. matchIndexes.push( i );
  10263. }
  10264. return matchIndexes;
  10265. }),
  10266. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10267. var i = 1;
  10268. for ( ; i < length; i += 2 ) {
  10269. matchIndexes.push( i );
  10270. }
  10271. return matchIndexes;
  10272. }),
  10273. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10274. var i = argument < 0 ?
  10275. argument + length :
  10276. argument > length ?
  10277. length :
  10278. argument;
  10279. for ( ; --i >= 0; ) {
  10280. matchIndexes.push( i );
  10281. }
  10282. return matchIndexes;
  10283. }),
  10284. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10285. var i = argument < 0 ? argument + length : argument;
  10286. for ( ; ++i < length; ) {
  10287. matchIndexes.push( i );
  10288. }
  10289. return matchIndexes;
  10290. })
  10291. }
  10292. };
  10293. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10294. // Add button/input type pseudos
  10295. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10296. Expr.pseudos[ i ] = createInputPseudo( i );
  10297. }
  10298. for ( i in { submit: true, reset: true } ) {
  10299. Expr.pseudos[ i ] = createButtonPseudo( i );
  10300. }
  10301. // Easy API for creating new setFilters
  10302. function setFilters() {}
  10303. setFilters.prototype = Expr.filters = Expr.pseudos;
  10304. Expr.setFilters = new setFilters();
  10305. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10306. var matched, match, tokens, type,
  10307. soFar, groups, preFilters,
  10308. cached = tokenCache[ selector + " " ];
  10309. if ( cached ) {
  10310. return parseOnly ? 0 : cached.slice( 0 );
  10311. }
  10312. soFar = selector;
  10313. groups = [];
  10314. preFilters = Expr.preFilter;
  10315. while ( soFar ) {
  10316. // Comma and first run
  10317. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10318. if ( match ) {
  10319. // Don't consume trailing commas as valid
  10320. soFar = soFar.slice( match[0].length ) || soFar;
  10321. }
  10322. groups.push( (tokens = []) );
  10323. }
  10324. matched = false;
  10325. // Combinators
  10326. if ( (match = rcombinators.exec( soFar )) ) {
  10327. matched = match.shift();
  10328. tokens.push({
  10329. value: matched,
  10330. // Cast descendant combinators to space
  10331. type: match[0].replace( rtrim, " " )
  10332. });
  10333. soFar = soFar.slice( matched.length );
  10334. }
  10335. // Filters
  10336. for ( type in Expr.filter ) {
  10337. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10338. (match = preFilters[ type ]( match ))) ) {
  10339. matched = match.shift();
  10340. tokens.push({
  10341. value: matched,
  10342. type: type,
  10343. matches: match
  10344. });
  10345. soFar = soFar.slice( matched.length );
  10346. }
  10347. }
  10348. if ( !matched ) {
  10349. break;
  10350. }
  10351. }
  10352. // Return the length of the invalid excess
  10353. // if we're just parsing
  10354. // Otherwise, throw an error or return tokens
  10355. return parseOnly ?
  10356. soFar.length :
  10357. soFar ?
  10358. Sizzle.error( selector ) :
  10359. // Cache the tokens
  10360. tokenCache( selector, groups ).slice( 0 );
  10361. };
  10362. function toSelector( tokens ) {
  10363. var i = 0,
  10364. len = tokens.length,
  10365. selector = "";
  10366. for ( ; i < len; i++ ) {
  10367. selector += tokens[i].value;
  10368. }
  10369. return selector;
  10370. }
  10371. function addCombinator( matcher, combinator, base ) {
  10372. var dir = combinator.dir,
  10373. skip = combinator.next,
  10374. key = skip || dir,
  10375. checkNonElements = base && key === "parentNode",
  10376. doneName = done++;
  10377. return combinator.first ?
  10378. // Check against closest ancestor/preceding element
  10379. function( elem, context, xml ) {
  10380. while ( (elem = elem[ dir ]) ) {
  10381. if ( elem.nodeType === 1 || checkNonElements ) {
  10382. return matcher( elem, context, xml );
  10383. }
  10384. }
  10385. return false;
  10386. } :
  10387. // Check against all ancestor/preceding elements
  10388. function( elem, context, xml ) {
  10389. var oldCache, uniqueCache, outerCache,
  10390. newCache = [ dirruns, doneName ];
  10391. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10392. if ( xml ) {
  10393. while ( (elem = elem[ dir ]) ) {
  10394. if ( elem.nodeType === 1 || checkNonElements ) {
  10395. if ( matcher( elem, context, xml ) ) {
  10396. return true;
  10397. }
  10398. }
  10399. }
  10400. } else {
  10401. while ( (elem = elem[ dir ]) ) {
  10402. if ( elem.nodeType === 1 || checkNonElements ) {
  10403. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10404. // Support: IE <9 only
  10405. // Defend against cloned attroperties (jQuery gh-1709)
  10406. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10407. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10408. elem = elem[ dir ] || elem;
  10409. } else if ( (oldCache = uniqueCache[ key ]) &&
  10410. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10411. // Assign to newCache so results back-propagate to previous elements
  10412. return (newCache[ 2 ] = oldCache[ 2 ]);
  10413. } else {
  10414. // Reuse newcache so results back-propagate to previous elements
  10415. uniqueCache[ key ] = newCache;
  10416. // A match means we're done; a fail means we have to keep checking
  10417. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10418. return true;
  10419. }
  10420. }
  10421. }
  10422. }
  10423. }
  10424. return false;
  10425. };
  10426. }
  10427. function elementMatcher( matchers ) {
  10428. return matchers.length > 1 ?
  10429. function( elem, context, xml ) {
  10430. var i = matchers.length;
  10431. while ( i-- ) {
  10432. if ( !matchers[i]( elem, context, xml ) ) {
  10433. return false;
  10434. }
  10435. }
  10436. return true;
  10437. } :
  10438. matchers[0];
  10439. }
  10440. function multipleContexts( selector, contexts, results ) {
  10441. var i = 0,
  10442. len = contexts.length;
  10443. for ( ; i < len; i++ ) {
  10444. Sizzle( selector, contexts[i], results );
  10445. }
  10446. return results;
  10447. }
  10448. function condense( unmatched, map, filter, context, xml ) {
  10449. var elem,
  10450. newUnmatched = [],
  10451. i = 0,
  10452. len = unmatched.length,
  10453. mapped = map != null;
  10454. for ( ; i < len; i++ ) {
  10455. if ( (elem = unmatched[i]) ) {
  10456. if ( !filter || filter( elem, context, xml ) ) {
  10457. newUnmatched.push( elem );
  10458. if ( mapped ) {
  10459. map.push( i );
  10460. }
  10461. }
  10462. }
  10463. }
  10464. return newUnmatched;
  10465. }
  10466. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10467. if ( postFilter && !postFilter[ expando ] ) {
  10468. postFilter = setMatcher( postFilter );
  10469. }
  10470. if ( postFinder && !postFinder[ expando ] ) {
  10471. postFinder = setMatcher( postFinder, postSelector );
  10472. }
  10473. return markFunction(function( seed, results, context, xml ) {
  10474. var temp, i, elem,
  10475. preMap = [],
  10476. postMap = [],
  10477. preexisting = results.length,
  10478. // Get initial elements from seed or context
  10479. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10480. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10481. matcherIn = preFilter && ( seed || !selector ) ?
  10482. condense( elems, preMap, preFilter, context, xml ) :
  10483. elems,
  10484. matcherOut = matcher ?
  10485. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10486. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10487. // ...intermediate processing is necessary
  10488. [] :
  10489. // ...otherwise use results directly
  10490. results :
  10491. matcherIn;
  10492. // Find primary matches
  10493. if ( matcher ) {
  10494. matcher( matcherIn, matcherOut, context, xml );
  10495. }
  10496. // Apply postFilter
  10497. if ( postFilter ) {
  10498. temp = condense( matcherOut, postMap );
  10499. postFilter( temp, [], context, xml );
  10500. // Un-match failing elements by moving them back to matcherIn
  10501. i = temp.length;
  10502. while ( i-- ) {
  10503. if ( (elem = temp[i]) ) {
  10504. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10505. }
  10506. }
  10507. }
  10508. if ( seed ) {
  10509. if ( postFinder || preFilter ) {
  10510. if ( postFinder ) {
  10511. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10512. temp = [];
  10513. i = matcherOut.length;
  10514. while ( i-- ) {
  10515. if ( (elem = matcherOut[i]) ) {
  10516. // Restore matcherIn since elem is not yet a final match
  10517. temp.push( (matcherIn[i] = elem) );
  10518. }
  10519. }
  10520. postFinder( null, (matcherOut = []), temp, xml );
  10521. }
  10522. // Move matched elements from seed to results to keep them synchronized
  10523. i = matcherOut.length;
  10524. while ( i-- ) {
  10525. if ( (elem = matcherOut[i]) &&
  10526. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10527. seed[temp] = !(results[temp] = elem);
  10528. }
  10529. }
  10530. }
  10531. // Add elements to results, through postFinder if defined
  10532. } else {
  10533. matcherOut = condense(
  10534. matcherOut === results ?
  10535. matcherOut.splice( preexisting, matcherOut.length ) :
  10536. matcherOut
  10537. );
  10538. if ( postFinder ) {
  10539. postFinder( null, results, matcherOut, xml );
  10540. } else {
  10541. push.apply( results, matcherOut );
  10542. }
  10543. }
  10544. });
  10545. }
  10546. function matcherFromTokens( tokens ) {
  10547. var checkContext, matcher, j,
  10548. len = tokens.length,
  10549. leadingRelative = Expr.relative[ tokens[0].type ],
  10550. implicitRelative = leadingRelative || Expr.relative[" "],
  10551. i = leadingRelative ? 1 : 0,
  10552. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10553. matchContext = addCombinator( function( elem ) {
  10554. return elem === checkContext;
  10555. }, implicitRelative, true ),
  10556. matchAnyContext = addCombinator( function( elem ) {
  10557. return indexOf( checkContext, elem ) > -1;
  10558. }, implicitRelative, true ),
  10559. matchers = [ function( elem, context, xml ) {
  10560. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10561. (checkContext = context).nodeType ?
  10562. matchContext( elem, context, xml ) :
  10563. matchAnyContext( elem, context, xml ) );
  10564. // Avoid hanging onto element (issue #299)
  10565. checkContext = null;
  10566. return ret;
  10567. } ];
  10568. for ( ; i < len; i++ ) {
  10569. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10570. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10571. } else {
  10572. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10573. // Return special upon seeing a positional matcher
  10574. if ( matcher[ expando ] ) {
  10575. // Find the next relative operator (if any) for proper handling
  10576. j = ++i;
  10577. for ( ; j < len; j++ ) {
  10578. if ( Expr.relative[ tokens[j].type ] ) {
  10579. break;
  10580. }
  10581. }
  10582. return setMatcher(
  10583. i > 1 && elementMatcher( matchers ),
  10584. i > 1 && toSelector(
  10585. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10586. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10587. ).replace( rtrim, "$1" ),
  10588. matcher,
  10589. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10590. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10591. j < len && toSelector( tokens )
  10592. );
  10593. }
  10594. matchers.push( matcher );
  10595. }
  10596. }
  10597. return elementMatcher( matchers );
  10598. }
  10599. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10600. var bySet = setMatchers.length > 0,
  10601. byElement = elementMatchers.length > 0,
  10602. superMatcher = function( seed, context, xml, results, outermost ) {
  10603. var elem, j, matcher,
  10604. matchedCount = 0,
  10605. i = "0",
  10606. unmatched = seed && [],
  10607. setMatched = [],
  10608. contextBackup = outermostContext,
  10609. // We must always have either seed elements or outermost context
  10610. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10611. // Use integer dirruns iff this is the outermost matcher
  10612. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10613. len = elems.length;
  10614. if ( outermost ) {
  10615. outermostContext = context === document || context || outermost;
  10616. }
  10617. // Add elements passing elementMatchers directly to results
  10618. // Support: IE<9, Safari
  10619. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10620. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10621. if ( byElement && elem ) {
  10622. j = 0;
  10623. if ( !context && elem.ownerDocument !== document ) {
  10624. setDocument( elem );
  10625. xml = !documentIsHTML;
  10626. }
  10627. while ( (matcher = elementMatchers[j++]) ) {
  10628. if ( matcher( elem, context || document, xml) ) {
  10629. results.push( elem );
  10630. break;
  10631. }
  10632. }
  10633. if ( outermost ) {
  10634. dirruns = dirrunsUnique;
  10635. }
  10636. }
  10637. // Track unmatched elements for set filters
  10638. if ( bySet ) {
  10639. // They will have gone through all possible matchers
  10640. if ( (elem = !matcher && elem) ) {
  10641. matchedCount--;
  10642. }
  10643. // Lengthen the array for every element, matched or not
  10644. if ( seed ) {
  10645. unmatched.push( elem );
  10646. }
  10647. }
  10648. }
  10649. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10650. // makes the latter nonnegative.
  10651. matchedCount += i;
  10652. // Apply set filters to unmatched elements
  10653. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10654. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10655. // no element matchers and no seed.
  10656. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10657. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10658. // numerically zero.
  10659. if ( bySet && i !== matchedCount ) {
  10660. j = 0;
  10661. while ( (matcher = setMatchers[j++]) ) {
  10662. matcher( unmatched, setMatched, context, xml );
  10663. }
  10664. if ( seed ) {
  10665. // Reintegrate element matches to eliminate the need for sorting
  10666. if ( matchedCount > 0 ) {
  10667. while ( i-- ) {
  10668. if ( !(unmatched[i] || setMatched[i]) ) {
  10669. setMatched[i] = pop.call( results );
  10670. }
  10671. }
  10672. }
  10673. // Discard index placeholder values to get only actual matches
  10674. setMatched = condense( setMatched );
  10675. }
  10676. // Add matches to results
  10677. push.apply( results, setMatched );
  10678. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10679. if ( outermost && !seed && setMatched.length > 0 &&
  10680. ( matchedCount + setMatchers.length ) > 1 ) {
  10681. Sizzle.uniqueSort( results );
  10682. }
  10683. }
  10684. // Override manipulation of globals by nested matchers
  10685. if ( outermost ) {
  10686. dirruns = dirrunsUnique;
  10687. outermostContext = contextBackup;
  10688. }
  10689. return unmatched;
  10690. };
  10691. return bySet ?
  10692. markFunction( superMatcher ) :
  10693. superMatcher;
  10694. }
  10695. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10696. var i,
  10697. setMatchers = [],
  10698. elementMatchers = [],
  10699. cached = compilerCache[ selector + " " ];
  10700. if ( !cached ) {
  10701. // Generate a function of recursive functions that can be used to check each element
  10702. if ( !match ) {
  10703. match = tokenize( selector );
  10704. }
  10705. i = match.length;
  10706. while ( i-- ) {
  10707. cached = matcherFromTokens( match[i] );
  10708. if ( cached[ expando ] ) {
  10709. setMatchers.push( cached );
  10710. } else {
  10711. elementMatchers.push( cached );
  10712. }
  10713. }
  10714. // Cache the compiled function
  10715. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10716. // Save selector and tokenization
  10717. cached.selector = selector;
  10718. }
  10719. return cached;
  10720. };
  10721. /**
  10722. * A low-level selection function that works with Sizzle's compiled
  10723. * selector functions
  10724. * @param {String|Function} selector A selector or a pre-compiled
  10725. * selector function built with Sizzle.compile
  10726. * @param {Element} context
  10727. * @param {Array} [results]
  10728. * @param {Array} [seed] A set of elements to match against
  10729. */
  10730. select = Sizzle.select = function( selector, context, results, seed ) {
  10731. var i, tokens, token, type, find,
  10732. compiled = typeof selector === "function" && selector,
  10733. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10734. results = results || [];
  10735. // Try to minimize operations if there is only one selector in the list and no seed
  10736. // (the latter of which guarantees us context)
  10737. if ( match.length === 1 ) {
  10738. // Reduce context if the leading compound selector is an ID
  10739. tokens = match[0] = match[0].slice( 0 );
  10740. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10741. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10742. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10743. if ( !context ) {
  10744. return results;
  10745. // Precompiled matchers will still verify ancestry, so step up a level
  10746. } else if ( compiled ) {
  10747. context = context.parentNode;
  10748. }
  10749. selector = selector.slice( tokens.shift().value.length );
  10750. }
  10751. // Fetch a seed set for right-to-left matching
  10752. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10753. while ( i-- ) {
  10754. token = tokens[i];
  10755. // Abort if we hit a combinator
  10756. if ( Expr.relative[ (type = token.type) ] ) {
  10757. break;
  10758. }
  10759. if ( (find = Expr.find[ type ]) ) {
  10760. // Search, expanding context for leading sibling combinators
  10761. if ( (seed = find(
  10762. token.matches[0].replace( runescape, funescape ),
  10763. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10764. )) ) {
  10765. // If seed is empty or no tokens remain, we can return early
  10766. tokens.splice( i, 1 );
  10767. selector = seed.length && toSelector( tokens );
  10768. if ( !selector ) {
  10769. push.apply( results, seed );
  10770. return results;
  10771. }
  10772. break;
  10773. }
  10774. }
  10775. }
  10776. }
  10777. // Compile and execute a filtering function if one is not provided
  10778. // Provide `match` to avoid retokenization if we modified the selector above
  10779. ( compiled || compile( selector, match ) )(
  10780. seed,
  10781. context,
  10782. !documentIsHTML,
  10783. results,
  10784. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10785. );
  10786. return results;
  10787. };
  10788. // One-time assignments
  10789. // Sort stability
  10790. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10791. // Support: Chrome 14-35+
  10792. // Always assume duplicates if they aren't passed to the comparison function
  10793. support.detectDuplicates = !!hasDuplicate;
  10794. // Initialize against the default document
  10795. setDocument();
  10796. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10797. // Detached nodes confoundingly follow *each other*
  10798. support.sortDetached = assert(function( el ) {
  10799. // Should return 1, but returns 4 (following)
  10800. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10801. });
  10802. // Support: IE<8
  10803. // Prevent attribute/property "interpolation"
  10804. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10805. if ( !assert(function( el ) {
  10806. el.innerHTML = "<a href='#'></a>";
  10807. return el.firstChild.getAttribute("href") === "#" ;
  10808. }) ) {
  10809. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10810. if ( !isXML ) {
  10811. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10812. }
  10813. });
  10814. }
  10815. // Support: IE<9
  10816. // Use defaultValue in place of getAttribute("value")
  10817. if ( !support.attributes || !assert(function( el ) {
  10818. el.innerHTML = "<input/>";
  10819. el.firstChild.setAttribute( "value", "" );
  10820. return el.firstChild.getAttribute( "value" ) === "";
  10821. }) ) {
  10822. addHandle( "value", function( elem, name, isXML ) {
  10823. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10824. return elem.defaultValue;
  10825. }
  10826. });
  10827. }
  10828. // Support: IE<9
  10829. // Use getAttributeNode to fetch booleans when getAttribute lies
  10830. if ( !assert(function( el ) {
  10831. return el.getAttribute("disabled") == null;
  10832. }) ) {
  10833. addHandle( booleans, function( elem, name, isXML ) {
  10834. var val;
  10835. if ( !isXML ) {
  10836. return elem[ name ] === true ? name.toLowerCase() :
  10837. (val = elem.getAttributeNode( name )) && val.specified ?
  10838. val.value :
  10839. null;
  10840. }
  10841. });
  10842. }
  10843. return Sizzle;
  10844. })( window );
  10845. jQuery.find = Sizzle;
  10846. jQuery.expr = Sizzle.selectors;
  10847. // Deprecated
  10848. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10849. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10850. jQuery.text = Sizzle.getText;
  10851. jQuery.isXMLDoc = Sizzle.isXML;
  10852. jQuery.contains = Sizzle.contains;
  10853. jQuery.escapeSelector = Sizzle.escape;
  10854. var dir = function( elem, dir, until ) {
  10855. var matched = [],
  10856. truncate = until !== undefined;
  10857. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10858. if ( elem.nodeType === 1 ) {
  10859. if ( truncate && jQuery( elem ).is( until ) ) {
  10860. break;
  10861. }
  10862. matched.push( elem );
  10863. }
  10864. }
  10865. return matched;
  10866. };
  10867. var siblings = function( n, elem ) {
  10868. var matched = [];
  10869. for ( ; n; n = n.nextSibling ) {
  10870. if ( n.nodeType === 1 && n !== elem ) {
  10871. matched.push( n );
  10872. }
  10873. }
  10874. return matched;
  10875. };
  10876. var rneedsContext = jQuery.expr.match.needsContext;
  10877. function nodeName( elem, name ) {
  10878. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10879. };
  10880. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10881. // Implement the identical functionality for filter and not
  10882. function winnow( elements, qualifier, not ) {
  10883. if ( isFunction( qualifier ) ) {
  10884. return jQuery.grep( elements, function( elem, i ) {
  10885. return !!qualifier.call( elem, i, elem ) !== not;
  10886. } );
  10887. }
  10888. // Single element
  10889. if ( qualifier.nodeType ) {
  10890. return jQuery.grep( elements, function( elem ) {
  10891. return ( elem === qualifier ) !== not;
  10892. } );
  10893. }
  10894. // Arraylike of elements (jQuery, arguments, Array)
  10895. if ( typeof qualifier !== "string" ) {
  10896. return jQuery.grep( elements, function( elem ) {
  10897. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10898. } );
  10899. }
  10900. // Filtered directly for both simple and complex selectors
  10901. return jQuery.filter( qualifier, elements, not );
  10902. }
  10903. jQuery.filter = function( expr, elems, not ) {
  10904. var elem = elems[ 0 ];
  10905. if ( not ) {
  10906. expr = ":not(" + expr + ")";
  10907. }
  10908. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10909. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10910. }
  10911. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10912. return elem.nodeType === 1;
  10913. } ) );
  10914. };
  10915. jQuery.fn.extend( {
  10916. find: function( selector ) {
  10917. var i, ret,
  10918. len = this.length,
  10919. self = this;
  10920. if ( typeof selector !== "string" ) {
  10921. return this.pushStack( jQuery( selector ).filter( function() {
  10922. for ( i = 0; i < len; i++ ) {
  10923. if ( jQuery.contains( self[ i ], this ) ) {
  10924. return true;
  10925. }
  10926. }
  10927. } ) );
  10928. }
  10929. ret = this.pushStack( [] );
  10930. for ( i = 0; i < len; i++ ) {
  10931. jQuery.find( selector, self[ i ], ret );
  10932. }
  10933. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10934. },
  10935. filter: function( selector ) {
  10936. return this.pushStack( winnow( this, selector || [], false ) );
  10937. },
  10938. not: function( selector ) {
  10939. return this.pushStack( winnow( this, selector || [], true ) );
  10940. },
  10941. is: function( selector ) {
  10942. return !!winnow(
  10943. this,
  10944. // If this is a positional/relative selector, check membership in the returned set
  10945. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10946. typeof selector === "string" && rneedsContext.test( selector ) ?
  10947. jQuery( selector ) :
  10948. selector || [],
  10949. false
  10950. ).length;
  10951. }
  10952. } );
  10953. // Initialize a jQuery object
  10954. // A central reference to the root jQuery(document)
  10955. var rootjQuery,
  10956. // A simple way to check for HTML strings
  10957. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10958. // Strict HTML recognition (#11290: must start with <)
  10959. // Shortcut simple #id case for speed
  10960. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10961. init = jQuery.fn.init = function( selector, context, root ) {
  10962. var match, elem;
  10963. // HANDLE: $(""), $(null), $(undefined), $(false)
  10964. if ( !selector ) {
  10965. return this;
  10966. }
  10967. // Method init() accepts an alternate rootjQuery
  10968. // so migrate can support jQuery.sub (gh-2101)
  10969. root = root || rootjQuery;
  10970. // Handle HTML strings
  10971. if ( typeof selector === "string" ) {
  10972. if ( selector[ 0 ] === "<" &&
  10973. selector[ selector.length - 1 ] === ">" &&
  10974. selector.length >= 3 ) {
  10975. // Assume that strings that start and end with <> are HTML and skip the regex check
  10976. match = [ null, selector, null ];
  10977. } else {
  10978. match = rquickExpr.exec( selector );
  10979. }
  10980. // Match html or make sure no context is specified for #id
  10981. if ( match && ( match[ 1 ] || !context ) ) {
  10982. // HANDLE: $(html) -> $(array)
  10983. if ( match[ 1 ] ) {
  10984. context = context instanceof jQuery ? context[ 0 ] : context;
  10985. // Option to run scripts is true for back-compat
  10986. // Intentionally let the error be thrown if parseHTML is not present
  10987. jQuery.merge( this, jQuery.parseHTML(
  10988. match[ 1 ],
  10989. context && context.nodeType ? context.ownerDocument || context : document,
  10990. true
  10991. ) );
  10992. // HANDLE: $(html, props)
  10993. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10994. for ( match in context ) {
  10995. // Properties of context are called as methods if possible
  10996. if ( isFunction( this[ match ] ) ) {
  10997. this[ match ]( context[ match ] );
  10998. // ...and otherwise set as attributes
  10999. } else {
  11000. this.attr( match, context[ match ] );
  11001. }
  11002. }
  11003. }
  11004. return this;
  11005. // HANDLE: $(#id)
  11006. } else {
  11007. elem = document.getElementById( match[ 2 ] );
  11008. if ( elem ) {
  11009. // Inject the element directly into the jQuery object
  11010. this[ 0 ] = elem;
  11011. this.length = 1;
  11012. }
  11013. return this;
  11014. }
  11015. // HANDLE: $(expr, $(...))
  11016. } else if ( !context || context.jquery ) {
  11017. return ( context || root ).find( selector );
  11018. // HANDLE: $(expr, context)
  11019. // (which is just equivalent to: $(context).find(expr)
  11020. } else {
  11021. return this.constructor( context ).find( selector );
  11022. }
  11023. // HANDLE: $(DOMElement)
  11024. } else if ( selector.nodeType ) {
  11025. this[ 0 ] = selector;
  11026. this.length = 1;
  11027. return this;
  11028. // HANDLE: $(function)
  11029. // Shortcut for document ready
  11030. } else if ( isFunction( selector ) ) {
  11031. return root.ready !== undefined ?
  11032. root.ready( selector ) :
  11033. // Execute immediately if ready is not present
  11034. selector( jQuery );
  11035. }
  11036. return jQuery.makeArray( selector, this );
  11037. };
  11038. // Give the init function the jQuery prototype for later instantiation
  11039. init.prototype = jQuery.fn;
  11040. // Initialize central reference
  11041. rootjQuery = jQuery( document );
  11042. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11043. // Methods guaranteed to produce a unique set when starting from a unique set
  11044. guaranteedUnique = {
  11045. children: true,
  11046. contents: true,
  11047. next: true,
  11048. prev: true
  11049. };
  11050. jQuery.fn.extend( {
  11051. has: function( target ) {
  11052. var targets = jQuery( target, this ),
  11053. l = targets.length;
  11054. return this.filter( function() {
  11055. var i = 0;
  11056. for ( ; i < l; i++ ) {
  11057. if ( jQuery.contains( this, targets[ i ] ) ) {
  11058. return true;
  11059. }
  11060. }
  11061. } );
  11062. },
  11063. closest: function( selectors, context ) {
  11064. var cur,
  11065. i = 0,
  11066. l = this.length,
  11067. matched = [],
  11068. targets = typeof selectors !== "string" && jQuery( selectors );
  11069. // Positional selectors never match, since there's no _selection_ context
  11070. if ( !rneedsContext.test( selectors ) ) {
  11071. for ( ; i < l; i++ ) {
  11072. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11073. // Always skip document fragments
  11074. if ( cur.nodeType < 11 && ( targets ?
  11075. targets.index( cur ) > -1 :
  11076. // Don't pass non-elements to Sizzle
  11077. cur.nodeType === 1 &&
  11078. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11079. matched.push( cur );
  11080. break;
  11081. }
  11082. }
  11083. }
  11084. }
  11085. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11086. },
  11087. // Determine the position of an element within the set
  11088. index: function( elem ) {
  11089. // No argument, return index in parent
  11090. if ( !elem ) {
  11091. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11092. }
  11093. // Index in selector
  11094. if ( typeof elem === "string" ) {
  11095. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11096. }
  11097. // Locate the position of the desired element
  11098. return indexOf.call( this,
  11099. // If it receives a jQuery object, the first element is used
  11100. elem.jquery ? elem[ 0 ] : elem
  11101. );
  11102. },
  11103. add: function( selector, context ) {
  11104. return this.pushStack(
  11105. jQuery.uniqueSort(
  11106. jQuery.merge( this.get(), jQuery( selector, context ) )
  11107. )
  11108. );
  11109. },
  11110. addBack: function( selector ) {
  11111. return this.add( selector == null ?
  11112. this.prevObject : this.prevObject.filter( selector )
  11113. );
  11114. }
  11115. } );
  11116. function sibling( cur, dir ) {
  11117. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11118. return cur;
  11119. }
  11120. jQuery.each( {
  11121. parent: function( elem ) {
  11122. var parent = elem.parentNode;
  11123. return parent && parent.nodeType !== 11 ? parent : null;
  11124. },
  11125. parents: function( elem ) {
  11126. return dir( elem, "parentNode" );
  11127. },
  11128. parentsUntil: function( elem, i, until ) {
  11129. return dir( elem, "parentNode", until );
  11130. },
  11131. next: function( elem ) {
  11132. return sibling( elem, "nextSibling" );
  11133. },
  11134. prev: function( elem ) {
  11135. return sibling( elem, "previousSibling" );
  11136. },
  11137. nextAll: function( elem ) {
  11138. return dir( elem, "nextSibling" );
  11139. },
  11140. prevAll: function( elem ) {
  11141. return dir( elem, "previousSibling" );
  11142. },
  11143. nextUntil: function( elem, i, until ) {
  11144. return dir( elem, "nextSibling", until );
  11145. },
  11146. prevUntil: function( elem, i, until ) {
  11147. return dir( elem, "previousSibling", until );
  11148. },
  11149. siblings: function( elem ) {
  11150. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11151. },
  11152. children: function( elem ) {
  11153. return siblings( elem.firstChild );
  11154. },
  11155. contents: function( elem ) {
  11156. if ( typeof elem.contentDocument !== "undefined" ) {
  11157. return elem.contentDocument;
  11158. }
  11159. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11160. // Treat the template element as a regular one in browsers that
  11161. // don't support it.
  11162. if ( nodeName( elem, "template" ) ) {
  11163. elem = elem.content || elem;
  11164. }
  11165. return jQuery.merge( [], elem.childNodes );
  11166. }
  11167. }, function( name, fn ) {
  11168. jQuery.fn[ name ] = function( until, selector ) {
  11169. var matched = jQuery.map( this, fn, until );
  11170. if ( name.slice( -5 ) !== "Until" ) {
  11171. selector = until;
  11172. }
  11173. if ( selector && typeof selector === "string" ) {
  11174. matched = jQuery.filter( selector, matched );
  11175. }
  11176. if ( this.length > 1 ) {
  11177. // Remove duplicates
  11178. if ( !guaranteedUnique[ name ] ) {
  11179. jQuery.uniqueSort( matched );
  11180. }
  11181. // Reverse order for parents* and prev-derivatives
  11182. if ( rparentsprev.test( name ) ) {
  11183. matched.reverse();
  11184. }
  11185. }
  11186. return this.pushStack( matched );
  11187. };
  11188. } );
  11189. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11190. // Convert String-formatted options into Object-formatted ones
  11191. function createOptions( options ) {
  11192. var object = {};
  11193. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11194. object[ flag ] = true;
  11195. } );
  11196. return object;
  11197. }
  11198. /*
  11199. * Create a callback list using the following parameters:
  11200. *
  11201. * options: an optional list of space-separated options that will change how
  11202. * the callback list behaves or a more traditional option object
  11203. *
  11204. * By default a callback list will act like an event callback list and can be
  11205. * "fired" multiple times.
  11206. *
  11207. * Possible options:
  11208. *
  11209. * once: will ensure the callback list can only be fired once (like a Deferred)
  11210. *
  11211. * memory: will keep track of previous values and will call any callback added
  11212. * after the list has been fired right away with the latest "memorized"
  11213. * values (like a Deferred)
  11214. *
  11215. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11216. *
  11217. * stopOnFalse: interrupt callings when a callback returns false
  11218. *
  11219. */
  11220. jQuery.Callbacks = function( options ) {
  11221. // Convert options from String-formatted to Object-formatted if needed
  11222. // (we check in cache first)
  11223. options = typeof options === "string" ?
  11224. createOptions( options ) :
  11225. jQuery.extend( {}, options );
  11226. var // Flag to know if list is currently firing
  11227. firing,
  11228. // Last fire value for non-forgettable lists
  11229. memory,
  11230. // Flag to know if list was already fired
  11231. fired,
  11232. // Flag to prevent firing
  11233. locked,
  11234. // Actual callback list
  11235. list = [],
  11236. // Queue of execution data for repeatable lists
  11237. queue = [],
  11238. // Index of currently firing callback (modified by add/remove as needed)
  11239. firingIndex = -1,
  11240. // Fire callbacks
  11241. fire = function() {
  11242. // Enforce single-firing
  11243. locked = locked || options.once;
  11244. // Execute callbacks for all pending executions,
  11245. // respecting firingIndex overrides and runtime changes
  11246. fired = firing = true;
  11247. for ( ; queue.length; firingIndex = -1 ) {
  11248. memory = queue.shift();
  11249. while ( ++firingIndex < list.length ) {
  11250. // Run callback and check for early termination
  11251. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11252. options.stopOnFalse ) {
  11253. // Jump to end and forget the data so .add doesn't re-fire
  11254. firingIndex = list.length;
  11255. memory = false;
  11256. }
  11257. }
  11258. }
  11259. // Forget the data if we're done with it
  11260. if ( !options.memory ) {
  11261. memory = false;
  11262. }
  11263. firing = false;
  11264. // Clean up if we're done firing for good
  11265. if ( locked ) {
  11266. // Keep an empty list if we have data for future add calls
  11267. if ( memory ) {
  11268. list = [];
  11269. // Otherwise, this object is spent
  11270. } else {
  11271. list = "";
  11272. }
  11273. }
  11274. },
  11275. // Actual Callbacks object
  11276. self = {
  11277. // Add a callback or a collection of callbacks to the list
  11278. add: function() {
  11279. if ( list ) {
  11280. // If we have memory from a past run, we should fire after adding
  11281. if ( memory && !firing ) {
  11282. firingIndex = list.length - 1;
  11283. queue.push( memory );
  11284. }
  11285. ( function add( args ) {
  11286. jQuery.each( args, function( _, arg ) {
  11287. if ( isFunction( arg ) ) {
  11288. if ( !options.unique || !self.has( arg ) ) {
  11289. list.push( arg );
  11290. }
  11291. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11292. // Inspect recursively
  11293. add( arg );
  11294. }
  11295. } );
  11296. } )( arguments );
  11297. if ( memory && !firing ) {
  11298. fire();
  11299. }
  11300. }
  11301. return this;
  11302. },
  11303. // Remove a callback from the list
  11304. remove: function() {
  11305. jQuery.each( arguments, function( _, arg ) {
  11306. var index;
  11307. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11308. list.splice( index, 1 );
  11309. // Handle firing indexes
  11310. if ( index <= firingIndex ) {
  11311. firingIndex--;
  11312. }
  11313. }
  11314. } );
  11315. return this;
  11316. },
  11317. // Check if a given callback is in the list.
  11318. // If no argument is given, return whether or not list has callbacks attached.
  11319. has: function( fn ) {
  11320. return fn ?
  11321. jQuery.inArray( fn, list ) > -1 :
  11322. list.length > 0;
  11323. },
  11324. // Remove all callbacks from the list
  11325. empty: function() {
  11326. if ( list ) {
  11327. list = [];
  11328. }
  11329. return this;
  11330. },
  11331. // Disable .fire and .add
  11332. // Abort any current/pending executions
  11333. // Clear all callbacks and values
  11334. disable: function() {
  11335. locked = queue = [];
  11336. list = memory = "";
  11337. return this;
  11338. },
  11339. disabled: function() {
  11340. return !list;
  11341. },
  11342. // Disable .fire
  11343. // Also disable .add unless we have memory (since it would have no effect)
  11344. // Abort any pending executions
  11345. lock: function() {
  11346. locked = queue = [];
  11347. if ( !memory && !firing ) {
  11348. list = memory = "";
  11349. }
  11350. return this;
  11351. },
  11352. locked: function() {
  11353. return !!locked;
  11354. },
  11355. // Call all callbacks with the given context and arguments
  11356. fireWith: function( context, args ) {
  11357. if ( !locked ) {
  11358. args = args || [];
  11359. args = [ context, args.slice ? args.slice() : args ];
  11360. queue.push( args );
  11361. if ( !firing ) {
  11362. fire();
  11363. }
  11364. }
  11365. return this;
  11366. },
  11367. // Call all the callbacks with the given arguments
  11368. fire: function() {
  11369. self.fireWith( this, arguments );
  11370. return this;
  11371. },
  11372. // To know if the callbacks have already been called at least once
  11373. fired: function() {
  11374. return !!fired;
  11375. }
  11376. };
  11377. return self;
  11378. };
  11379. function Identity( v ) {
  11380. return v;
  11381. }
  11382. function Thrower( ex ) {
  11383. throw ex;
  11384. }
  11385. function adoptValue( value, resolve, reject, noValue ) {
  11386. var method;
  11387. try {
  11388. // Check for promise aspect first to privilege synchronous behavior
  11389. if ( value && isFunction( ( method = value.promise ) ) ) {
  11390. method.call( value ).done( resolve ).fail( reject );
  11391. // Other thenables
  11392. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11393. method.call( value, resolve, reject );
  11394. // Other non-thenables
  11395. } else {
  11396. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11397. // * false: [ value ].slice( 0 ) => resolve( value )
  11398. // * true: [ value ].slice( 1 ) => resolve()
  11399. resolve.apply( undefined, [ value ].slice( noValue ) );
  11400. }
  11401. // For Promises/A+, convert exceptions into rejections
  11402. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11403. // Deferred#then to conditionally suppress rejection.
  11404. } catch ( value ) {
  11405. // Support: Android 4.0 only
  11406. // Strict mode functions invoked without .call/.apply get global-object context
  11407. reject.apply( undefined, [ value ] );
  11408. }
  11409. }
  11410. jQuery.extend( {
  11411. Deferred: function( func ) {
  11412. var tuples = [
  11413. // action, add listener, callbacks,
  11414. // ... .then handlers, argument index, [final state]
  11415. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11416. jQuery.Callbacks( "memory" ), 2 ],
  11417. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11418. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11419. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11420. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11421. ],
  11422. state = "pending",
  11423. promise = {
  11424. state: function() {
  11425. return state;
  11426. },
  11427. always: function() {
  11428. deferred.done( arguments ).fail( arguments );
  11429. return this;
  11430. },
  11431. "catch": function( fn ) {
  11432. return promise.then( null, fn );
  11433. },
  11434. // Keep pipe for back-compat
  11435. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11436. var fns = arguments;
  11437. return jQuery.Deferred( function( newDefer ) {
  11438. jQuery.each( tuples, function( i, tuple ) {
  11439. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11440. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11441. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11442. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11443. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11444. deferred[ tuple[ 1 ] ]( function() {
  11445. var returned = fn && fn.apply( this, arguments );
  11446. if ( returned && isFunction( returned.promise ) ) {
  11447. returned.promise()
  11448. .progress( newDefer.notify )
  11449. .done( newDefer.resolve )
  11450. .fail( newDefer.reject );
  11451. } else {
  11452. newDefer[ tuple[ 0 ] + "With" ](
  11453. this,
  11454. fn ? [ returned ] : arguments
  11455. );
  11456. }
  11457. } );
  11458. } );
  11459. fns = null;
  11460. } ).promise();
  11461. },
  11462. then: function( onFulfilled, onRejected, onProgress ) {
  11463. var maxDepth = 0;
  11464. function resolve( depth, deferred, handler, special ) {
  11465. return function() {
  11466. var that = this,
  11467. args = arguments,
  11468. mightThrow = function() {
  11469. var returned, then;
  11470. // Support: Promises/A+ section 2.3.3.3.3
  11471. // https://promisesaplus.com/#point-59
  11472. // Ignore double-resolution attempts
  11473. if ( depth < maxDepth ) {
  11474. return;
  11475. }
  11476. returned = handler.apply( that, args );
  11477. // Support: Promises/A+ section 2.3.1
  11478. // https://promisesaplus.com/#point-48
  11479. if ( returned === deferred.promise() ) {
  11480. throw new TypeError( "Thenable self-resolution" );
  11481. }
  11482. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11483. // https://promisesaplus.com/#point-54
  11484. // https://promisesaplus.com/#point-75
  11485. // Retrieve `then` only once
  11486. then = returned &&
  11487. // Support: Promises/A+ section 2.3.4
  11488. // https://promisesaplus.com/#point-64
  11489. // Only check objects and functions for thenability
  11490. ( typeof returned === "object" ||
  11491. typeof returned === "function" ) &&
  11492. returned.then;
  11493. // Handle a returned thenable
  11494. if ( isFunction( then ) ) {
  11495. // Special processors (notify) just wait for resolution
  11496. if ( special ) {
  11497. then.call(
  11498. returned,
  11499. resolve( maxDepth, deferred, Identity, special ),
  11500. resolve( maxDepth, deferred, Thrower, special )
  11501. );
  11502. // Normal processors (resolve) also hook into progress
  11503. } else {
  11504. // ...and disregard older resolution values
  11505. maxDepth++;
  11506. then.call(
  11507. returned,
  11508. resolve( maxDepth, deferred, Identity, special ),
  11509. resolve( maxDepth, deferred, Thrower, special ),
  11510. resolve( maxDepth, deferred, Identity,
  11511. deferred.notifyWith )
  11512. );
  11513. }
  11514. // Handle all other returned values
  11515. } else {
  11516. // Only substitute handlers pass on context
  11517. // and multiple values (non-spec behavior)
  11518. if ( handler !== Identity ) {
  11519. that = undefined;
  11520. args = [ returned ];
  11521. }
  11522. // Process the value(s)
  11523. // Default process is resolve
  11524. ( special || deferred.resolveWith )( that, args );
  11525. }
  11526. },
  11527. // Only normal processors (resolve) catch and reject exceptions
  11528. process = special ?
  11529. mightThrow :
  11530. function() {
  11531. try {
  11532. mightThrow();
  11533. } catch ( e ) {
  11534. if ( jQuery.Deferred.exceptionHook ) {
  11535. jQuery.Deferred.exceptionHook( e,
  11536. process.stackTrace );
  11537. }
  11538. // Support: Promises/A+ section 2.3.3.3.4.1
  11539. // https://promisesaplus.com/#point-61
  11540. // Ignore post-resolution exceptions
  11541. if ( depth + 1 >= maxDepth ) {
  11542. // Only substitute handlers pass on context
  11543. // and multiple values (non-spec behavior)
  11544. if ( handler !== Thrower ) {
  11545. that = undefined;
  11546. args = [ e ];
  11547. }
  11548. deferred.rejectWith( that, args );
  11549. }
  11550. }
  11551. };
  11552. // Support: Promises/A+ section 2.3.3.3.1
  11553. // https://promisesaplus.com/#point-57
  11554. // Re-resolve promises immediately to dodge false rejection from
  11555. // subsequent errors
  11556. if ( depth ) {
  11557. process();
  11558. } else {
  11559. // Call an optional hook to record the stack, in case of exception
  11560. // since it's otherwise lost when execution goes async
  11561. if ( jQuery.Deferred.getStackHook ) {
  11562. process.stackTrace = jQuery.Deferred.getStackHook();
  11563. }
  11564. window.setTimeout( process );
  11565. }
  11566. };
  11567. }
  11568. return jQuery.Deferred( function( newDefer ) {
  11569. // progress_handlers.add( ... )
  11570. tuples[ 0 ][ 3 ].add(
  11571. resolve(
  11572. 0,
  11573. newDefer,
  11574. isFunction( onProgress ) ?
  11575. onProgress :
  11576. Identity,
  11577. newDefer.notifyWith
  11578. )
  11579. );
  11580. // fulfilled_handlers.add( ... )
  11581. tuples[ 1 ][ 3 ].add(
  11582. resolve(
  11583. 0,
  11584. newDefer,
  11585. isFunction( onFulfilled ) ?
  11586. onFulfilled :
  11587. Identity
  11588. )
  11589. );
  11590. // rejected_handlers.add( ... )
  11591. tuples[ 2 ][ 3 ].add(
  11592. resolve(
  11593. 0,
  11594. newDefer,
  11595. isFunction( onRejected ) ?
  11596. onRejected :
  11597. Thrower
  11598. )
  11599. );
  11600. } ).promise();
  11601. },
  11602. // Get a promise for this deferred
  11603. // If obj is provided, the promise aspect is added to the object
  11604. promise: function( obj ) {
  11605. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11606. }
  11607. },
  11608. deferred = {};
  11609. // Add list-specific methods
  11610. jQuery.each( tuples, function( i, tuple ) {
  11611. var list = tuple[ 2 ],
  11612. stateString = tuple[ 5 ];
  11613. // promise.progress = list.add
  11614. // promise.done = list.add
  11615. // promise.fail = list.add
  11616. promise[ tuple[ 1 ] ] = list.add;
  11617. // Handle state
  11618. if ( stateString ) {
  11619. list.add(
  11620. function() {
  11621. // state = "resolved" (i.e., fulfilled)
  11622. // state = "rejected"
  11623. state = stateString;
  11624. },
  11625. // rejected_callbacks.disable
  11626. // fulfilled_callbacks.disable
  11627. tuples[ 3 - i ][ 2 ].disable,
  11628. // rejected_handlers.disable
  11629. // fulfilled_handlers.disable
  11630. tuples[ 3 - i ][ 3 ].disable,
  11631. // progress_callbacks.lock
  11632. tuples[ 0 ][ 2 ].lock,
  11633. // progress_handlers.lock
  11634. tuples[ 0 ][ 3 ].lock
  11635. );
  11636. }
  11637. // progress_handlers.fire
  11638. // fulfilled_handlers.fire
  11639. // rejected_handlers.fire
  11640. list.add( tuple[ 3 ].fire );
  11641. // deferred.notify = function() { deferred.notifyWith(...) }
  11642. // deferred.resolve = function() { deferred.resolveWith(...) }
  11643. // deferred.reject = function() { deferred.rejectWith(...) }
  11644. deferred[ tuple[ 0 ] ] = function() {
  11645. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11646. return this;
  11647. };
  11648. // deferred.notifyWith = list.fireWith
  11649. // deferred.resolveWith = list.fireWith
  11650. // deferred.rejectWith = list.fireWith
  11651. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11652. } );
  11653. // Make the deferred a promise
  11654. promise.promise( deferred );
  11655. // Call given func if any
  11656. if ( func ) {
  11657. func.call( deferred, deferred );
  11658. }
  11659. // All done!
  11660. return deferred;
  11661. },
  11662. // Deferred helper
  11663. when: function( singleValue ) {
  11664. var
  11665. // count of uncompleted subordinates
  11666. remaining = arguments.length,
  11667. // count of unprocessed arguments
  11668. i = remaining,
  11669. // subordinate fulfillment data
  11670. resolveContexts = Array( i ),
  11671. resolveValues = slice.call( arguments ),
  11672. // the master Deferred
  11673. master = jQuery.Deferred(),
  11674. // subordinate callback factory
  11675. updateFunc = function( i ) {
  11676. return function( value ) {
  11677. resolveContexts[ i ] = this;
  11678. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11679. if ( !( --remaining ) ) {
  11680. master.resolveWith( resolveContexts, resolveValues );
  11681. }
  11682. };
  11683. };
  11684. // Single- and empty arguments are adopted like Promise.resolve
  11685. if ( remaining <= 1 ) {
  11686. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11687. !remaining );
  11688. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11689. if ( master.state() === "pending" ||
  11690. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11691. return master.then();
  11692. }
  11693. }
  11694. // Multiple arguments are aggregated like Promise.all array elements
  11695. while ( i-- ) {
  11696. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11697. }
  11698. return master.promise();
  11699. }
  11700. } );
  11701. // These usually indicate a programmer mistake during development,
  11702. // warn about them ASAP rather than swallowing them by default.
  11703. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11704. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11705. // Support: IE 8 - 9 only
  11706. // Console exists when dev tools are open, which can happen at any time
  11707. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11708. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11709. }
  11710. };
  11711. jQuery.readyException = function( error ) {
  11712. window.setTimeout( function() {
  11713. throw error;
  11714. } );
  11715. };
  11716. // The deferred used on DOM ready
  11717. var readyList = jQuery.Deferred();
  11718. jQuery.fn.ready = function( fn ) {
  11719. readyList
  11720. .then( fn )
  11721. // Wrap jQuery.readyException in a function so that the lookup
  11722. // happens at the time of error handling instead of callback
  11723. // registration.
  11724. .catch( function( error ) {
  11725. jQuery.readyException( error );
  11726. } );
  11727. return this;
  11728. };
  11729. jQuery.extend( {
  11730. // Is the DOM ready to be used? Set to true once it occurs.
  11731. isReady: false,
  11732. // A counter to track how many items to wait for before
  11733. // the ready event fires. See #6781
  11734. readyWait: 1,
  11735. // Handle when the DOM is ready
  11736. ready: function( wait ) {
  11737. // Abort if there are pending holds or we're already ready
  11738. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11739. return;
  11740. }
  11741. // Remember that the DOM is ready
  11742. jQuery.isReady = true;
  11743. // If a normal DOM Ready event fired, decrement, and wait if need be
  11744. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11745. return;
  11746. }
  11747. // If there are functions bound, to execute
  11748. readyList.resolveWith( document, [ jQuery ] );
  11749. }
  11750. } );
  11751. jQuery.ready.then = readyList.then;
  11752. // The ready event handler and self cleanup method
  11753. function completed() {
  11754. document.removeEventListener( "DOMContentLoaded", completed );
  11755. window.removeEventListener( "load", completed );
  11756. jQuery.ready();
  11757. }
  11758. // Catch cases where $(document).ready() is called
  11759. // after the browser event has already occurred.
  11760. // Support: IE <=9 - 10 only
  11761. // Older IE sometimes signals "interactive" too soon
  11762. if ( document.readyState === "complete" ||
  11763. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11764. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11765. window.setTimeout( jQuery.ready );
  11766. } else {
  11767. // Use the handy event callback
  11768. document.addEventListener( "DOMContentLoaded", completed );
  11769. // A fallback to window.onload, that will always work
  11770. window.addEventListener( "load", completed );
  11771. }
  11772. // Multifunctional method to get and set values of a collection
  11773. // The value/s can optionally be executed if it's a function
  11774. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11775. var i = 0,
  11776. len = elems.length,
  11777. bulk = key == null;
  11778. // Sets many values
  11779. if ( toType( key ) === "object" ) {
  11780. chainable = true;
  11781. for ( i in key ) {
  11782. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11783. }
  11784. // Sets one value
  11785. } else if ( value !== undefined ) {
  11786. chainable = true;
  11787. if ( !isFunction( value ) ) {
  11788. raw = true;
  11789. }
  11790. if ( bulk ) {
  11791. // Bulk operations run against the entire set
  11792. if ( raw ) {
  11793. fn.call( elems, value );
  11794. fn = null;
  11795. // ...except when executing function values
  11796. } else {
  11797. bulk = fn;
  11798. fn = function( elem, key, value ) {
  11799. return bulk.call( jQuery( elem ), value );
  11800. };
  11801. }
  11802. }
  11803. if ( fn ) {
  11804. for ( ; i < len; i++ ) {
  11805. fn(
  11806. elems[ i ], key, raw ?
  11807. value :
  11808. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11809. );
  11810. }
  11811. }
  11812. }
  11813. if ( chainable ) {
  11814. return elems;
  11815. }
  11816. // Gets
  11817. if ( bulk ) {
  11818. return fn.call( elems );
  11819. }
  11820. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11821. };
  11822. // Matches dashed string for camelizing
  11823. var rmsPrefix = /^-ms-/,
  11824. rdashAlpha = /-([a-z])/g;
  11825. // Used by camelCase as callback to replace()
  11826. function fcamelCase( all, letter ) {
  11827. return letter.toUpperCase();
  11828. }
  11829. // Convert dashed to camelCase; used by the css and data modules
  11830. // Support: IE <=9 - 11, Edge 12 - 15
  11831. // Microsoft forgot to hump their vendor prefix (#9572)
  11832. function camelCase( string ) {
  11833. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11834. }
  11835. var acceptData = function( owner ) {
  11836. // Accepts only:
  11837. // - Node
  11838. // - Node.ELEMENT_NODE
  11839. // - Node.DOCUMENT_NODE
  11840. // - Object
  11841. // - Any
  11842. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11843. };
  11844. function Data() {
  11845. this.expando = jQuery.expando + Data.uid++;
  11846. }
  11847. Data.uid = 1;
  11848. Data.prototype = {
  11849. cache: function( owner ) {
  11850. // Check if the owner object already has a cache
  11851. var value = owner[ this.expando ];
  11852. // If not, create one
  11853. if ( !value ) {
  11854. value = {};
  11855. // We can accept data for non-element nodes in modern browsers,
  11856. // but we should not, see #8335.
  11857. // Always return an empty object.
  11858. if ( acceptData( owner ) ) {
  11859. // If it is a node unlikely to be stringify-ed or looped over
  11860. // use plain assignment
  11861. if ( owner.nodeType ) {
  11862. owner[ this.expando ] = value;
  11863. // Otherwise secure it in a non-enumerable property
  11864. // configurable must be true to allow the property to be
  11865. // deleted when data is removed
  11866. } else {
  11867. Object.defineProperty( owner, this.expando, {
  11868. value: value,
  11869. configurable: true
  11870. } );
  11871. }
  11872. }
  11873. }
  11874. return value;
  11875. },
  11876. set: function( owner, data, value ) {
  11877. var prop,
  11878. cache = this.cache( owner );
  11879. // Handle: [ owner, key, value ] args
  11880. // Always use camelCase key (gh-2257)
  11881. if ( typeof data === "string" ) {
  11882. cache[ camelCase( data ) ] = value;
  11883. // Handle: [ owner, { properties } ] args
  11884. } else {
  11885. // Copy the properties one-by-one to the cache object
  11886. for ( prop in data ) {
  11887. cache[ camelCase( prop ) ] = data[ prop ];
  11888. }
  11889. }
  11890. return cache;
  11891. },
  11892. get: function( owner, key ) {
  11893. return key === undefined ?
  11894. this.cache( owner ) :
  11895. // Always use camelCase key (gh-2257)
  11896. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11897. },
  11898. access: function( owner, key, value ) {
  11899. // In cases where either:
  11900. //
  11901. // 1. No key was specified
  11902. // 2. A string key was specified, but no value provided
  11903. //
  11904. // Take the "read" path and allow the get method to determine
  11905. // which value to return, respectively either:
  11906. //
  11907. // 1. The entire cache object
  11908. // 2. The data stored at the key
  11909. //
  11910. if ( key === undefined ||
  11911. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11912. return this.get( owner, key );
  11913. }
  11914. // When the key is not a string, or both a key and value
  11915. // are specified, set or extend (existing objects) with either:
  11916. //
  11917. // 1. An object of properties
  11918. // 2. A key and value
  11919. //
  11920. this.set( owner, key, value );
  11921. // Since the "set" path can have two possible entry points
  11922. // return the expected data based on which path was taken[*]
  11923. return value !== undefined ? value : key;
  11924. },
  11925. remove: function( owner, key ) {
  11926. var i,
  11927. cache = owner[ this.expando ];
  11928. if ( cache === undefined ) {
  11929. return;
  11930. }
  11931. if ( key !== undefined ) {
  11932. // Support array or space separated string of keys
  11933. if ( Array.isArray( key ) ) {
  11934. // If key is an array of keys...
  11935. // We always set camelCase keys, so remove that.
  11936. key = key.map( camelCase );
  11937. } else {
  11938. key = camelCase( key );
  11939. // If a key with the spaces exists, use it.
  11940. // Otherwise, create an array by matching non-whitespace
  11941. key = key in cache ?
  11942. [ key ] :
  11943. ( key.match( rnothtmlwhite ) || [] );
  11944. }
  11945. i = key.length;
  11946. while ( i-- ) {
  11947. delete cache[ key[ i ] ];
  11948. }
  11949. }
  11950. // Remove the expando if there's no more data
  11951. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11952. // Support: Chrome <=35 - 45
  11953. // Webkit & Blink performance suffers when deleting properties
  11954. // from DOM nodes, so set to undefined instead
  11955. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11956. if ( owner.nodeType ) {
  11957. owner[ this.expando ] = undefined;
  11958. } else {
  11959. delete owner[ this.expando ];
  11960. }
  11961. }
  11962. },
  11963. hasData: function( owner ) {
  11964. var cache = owner[ this.expando ];
  11965. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11966. }
  11967. };
  11968. var dataPriv = new Data();
  11969. var dataUser = new Data();
  11970. // Implementation Summary
  11971. //
  11972. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11973. // 2. Improve the module's maintainability by reducing the storage
  11974. // paths to a single mechanism.
  11975. // 3. Use the same single mechanism to support "private" and "user" data.
  11976. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11977. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11978. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11979. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11980. rmultiDash = /[A-Z]/g;
  11981. function getData( data ) {
  11982. if ( data === "true" ) {
  11983. return true;
  11984. }
  11985. if ( data === "false" ) {
  11986. return false;
  11987. }
  11988. if ( data === "null" ) {
  11989. return null;
  11990. }
  11991. // Only convert to a number if it doesn't change the string
  11992. if ( data === +data + "" ) {
  11993. return +data;
  11994. }
  11995. if ( rbrace.test( data ) ) {
  11996. return JSON.parse( data );
  11997. }
  11998. return data;
  11999. }
  12000. function dataAttr( elem, key, data ) {
  12001. var name;
  12002. // If nothing was found internally, try to fetch any
  12003. // data from the HTML5 data-* attribute
  12004. if ( data === undefined && elem.nodeType === 1 ) {
  12005. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12006. data = elem.getAttribute( name );
  12007. if ( typeof data === "string" ) {
  12008. try {
  12009. data = getData( data );
  12010. } catch ( e ) {}
  12011. // Make sure we set the data so it isn't changed later
  12012. dataUser.set( elem, key, data );
  12013. } else {
  12014. data = undefined;
  12015. }
  12016. }
  12017. return data;
  12018. }
  12019. jQuery.extend( {
  12020. hasData: function( elem ) {
  12021. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12022. },
  12023. data: function( elem, name, data ) {
  12024. return dataUser.access( elem, name, data );
  12025. },
  12026. removeData: function( elem, name ) {
  12027. dataUser.remove( elem, name );
  12028. },
  12029. // TODO: Now that all calls to _data and _removeData have been replaced
  12030. // with direct calls to dataPriv methods, these can be deprecated.
  12031. _data: function( elem, name, data ) {
  12032. return dataPriv.access( elem, name, data );
  12033. },
  12034. _removeData: function( elem, name ) {
  12035. dataPriv.remove( elem, name );
  12036. }
  12037. } );
  12038. jQuery.fn.extend( {
  12039. data: function( key, value ) {
  12040. var i, name, data,
  12041. elem = this[ 0 ],
  12042. attrs = elem && elem.attributes;
  12043. // Gets all values
  12044. if ( key === undefined ) {
  12045. if ( this.length ) {
  12046. data = dataUser.get( elem );
  12047. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12048. i = attrs.length;
  12049. while ( i-- ) {
  12050. // Support: IE 11 only
  12051. // The attrs elements can be null (#14894)
  12052. if ( attrs[ i ] ) {
  12053. name = attrs[ i ].name;
  12054. if ( name.indexOf( "data-" ) === 0 ) {
  12055. name = camelCase( name.slice( 5 ) );
  12056. dataAttr( elem, name, data[ name ] );
  12057. }
  12058. }
  12059. }
  12060. dataPriv.set( elem, "hasDataAttrs", true );
  12061. }
  12062. }
  12063. return data;
  12064. }
  12065. // Sets multiple values
  12066. if ( typeof key === "object" ) {
  12067. return this.each( function() {
  12068. dataUser.set( this, key );
  12069. } );
  12070. }
  12071. return access( this, function( value ) {
  12072. var data;
  12073. // The calling jQuery object (element matches) is not empty
  12074. // (and therefore has an element appears at this[ 0 ]) and the
  12075. // `value` parameter was not undefined. An empty jQuery object
  12076. // will result in `undefined` for elem = this[ 0 ] which will
  12077. // throw an exception if an attempt to read a data cache is made.
  12078. if ( elem && value === undefined ) {
  12079. // Attempt to get data from the cache
  12080. // The key will always be camelCased in Data
  12081. data = dataUser.get( elem, key );
  12082. if ( data !== undefined ) {
  12083. return data;
  12084. }
  12085. // Attempt to "discover" the data in
  12086. // HTML5 custom data-* attrs
  12087. data = dataAttr( elem, key );
  12088. if ( data !== undefined ) {
  12089. return data;
  12090. }
  12091. // We tried really hard, but the data doesn't exist.
  12092. return;
  12093. }
  12094. // Set the data...
  12095. this.each( function() {
  12096. // We always store the camelCased key
  12097. dataUser.set( this, key, value );
  12098. } );
  12099. }, null, value, arguments.length > 1, null, true );
  12100. },
  12101. removeData: function( key ) {
  12102. return this.each( function() {
  12103. dataUser.remove( this, key );
  12104. } );
  12105. }
  12106. } );
  12107. jQuery.extend( {
  12108. queue: function( elem, type, data ) {
  12109. var queue;
  12110. if ( elem ) {
  12111. type = ( type || "fx" ) + "queue";
  12112. queue = dataPriv.get( elem, type );
  12113. // Speed up dequeue by getting out quickly if this is just a lookup
  12114. if ( data ) {
  12115. if ( !queue || Array.isArray( data ) ) {
  12116. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12117. } else {
  12118. queue.push( data );
  12119. }
  12120. }
  12121. return queue || [];
  12122. }
  12123. },
  12124. dequeue: function( elem, type ) {
  12125. type = type || "fx";
  12126. var queue = jQuery.queue( elem, type ),
  12127. startLength = queue.length,
  12128. fn = queue.shift(),
  12129. hooks = jQuery._queueHooks( elem, type ),
  12130. next = function() {
  12131. jQuery.dequeue( elem, type );
  12132. };
  12133. // If the fx queue is dequeued, always remove the progress sentinel
  12134. if ( fn === "inprogress" ) {
  12135. fn = queue.shift();
  12136. startLength--;
  12137. }
  12138. if ( fn ) {
  12139. // Add a progress sentinel to prevent the fx queue from being
  12140. // automatically dequeued
  12141. if ( type === "fx" ) {
  12142. queue.unshift( "inprogress" );
  12143. }
  12144. // Clear up the last queue stop function
  12145. delete hooks.stop;
  12146. fn.call( elem, next, hooks );
  12147. }
  12148. if ( !startLength && hooks ) {
  12149. hooks.empty.fire();
  12150. }
  12151. },
  12152. // Not public - generate a queueHooks object, or return the current one
  12153. _queueHooks: function( elem, type ) {
  12154. var key = type + "queueHooks";
  12155. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12156. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12157. dataPriv.remove( elem, [ type + "queue", key ] );
  12158. } )
  12159. } );
  12160. }
  12161. } );
  12162. jQuery.fn.extend( {
  12163. queue: function( type, data ) {
  12164. var setter = 2;
  12165. if ( typeof type !== "string" ) {
  12166. data = type;
  12167. type = "fx";
  12168. setter--;
  12169. }
  12170. if ( arguments.length < setter ) {
  12171. return jQuery.queue( this[ 0 ], type );
  12172. }
  12173. return data === undefined ?
  12174. this :
  12175. this.each( function() {
  12176. var queue = jQuery.queue( this, type, data );
  12177. // Ensure a hooks for this queue
  12178. jQuery._queueHooks( this, type );
  12179. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12180. jQuery.dequeue( this, type );
  12181. }
  12182. } );
  12183. },
  12184. dequeue: function( type ) {
  12185. return this.each( function() {
  12186. jQuery.dequeue( this, type );
  12187. } );
  12188. },
  12189. clearQueue: function( type ) {
  12190. return this.queue( type || "fx", [] );
  12191. },
  12192. // Get a promise resolved when queues of a certain type
  12193. // are emptied (fx is the type by default)
  12194. promise: function( type, obj ) {
  12195. var tmp,
  12196. count = 1,
  12197. defer = jQuery.Deferred(),
  12198. elements = this,
  12199. i = this.length,
  12200. resolve = function() {
  12201. if ( !( --count ) ) {
  12202. defer.resolveWith( elements, [ elements ] );
  12203. }
  12204. };
  12205. if ( typeof type !== "string" ) {
  12206. obj = type;
  12207. type = undefined;
  12208. }
  12209. type = type || "fx";
  12210. while ( i-- ) {
  12211. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12212. if ( tmp && tmp.empty ) {
  12213. count++;
  12214. tmp.empty.add( resolve );
  12215. }
  12216. }
  12217. resolve();
  12218. return defer.promise( obj );
  12219. }
  12220. } );
  12221. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12222. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12223. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12224. var documentElement = document.documentElement;
  12225. var isAttached = function( elem ) {
  12226. return jQuery.contains( elem.ownerDocument, elem );
  12227. },
  12228. composed = { composed: true };
  12229. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12230. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12231. // Support: iOS 10.0-10.2 only
  12232. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12233. // leading to errors. We need to check for `getRootNode`.
  12234. if ( documentElement.getRootNode ) {
  12235. isAttached = function( elem ) {
  12236. return jQuery.contains( elem.ownerDocument, elem ) ||
  12237. elem.getRootNode( composed ) === elem.ownerDocument;
  12238. };
  12239. }
  12240. var isHiddenWithinTree = function( elem, el ) {
  12241. // isHiddenWithinTree might be called from jQuery#filter function;
  12242. // in that case, element will be second argument
  12243. elem = el || elem;
  12244. // Inline style trumps all
  12245. return elem.style.display === "none" ||
  12246. elem.style.display === "" &&
  12247. // Otherwise, check computed style
  12248. // Support: Firefox <=43 - 45
  12249. // Disconnected elements can have computed display: none, so first confirm that elem is
  12250. // in the document.
  12251. isAttached( elem ) &&
  12252. jQuery.css( elem, "display" ) === "none";
  12253. };
  12254. var swap = function( elem, options, callback, args ) {
  12255. var ret, name,
  12256. old = {};
  12257. // Remember the old values, and insert the new ones
  12258. for ( name in options ) {
  12259. old[ name ] = elem.style[ name ];
  12260. elem.style[ name ] = options[ name ];
  12261. }
  12262. ret = callback.apply( elem, args || [] );
  12263. // Revert the old values
  12264. for ( name in options ) {
  12265. elem.style[ name ] = old[ name ];
  12266. }
  12267. return ret;
  12268. };
  12269. function adjustCSS( elem, prop, valueParts, tween ) {
  12270. var adjusted, scale,
  12271. maxIterations = 20,
  12272. currentValue = tween ?
  12273. function() {
  12274. return tween.cur();
  12275. } :
  12276. function() {
  12277. return jQuery.css( elem, prop, "" );
  12278. },
  12279. initial = currentValue(),
  12280. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12281. // Starting value computation is required for potential unit mismatches
  12282. initialInUnit = elem.nodeType &&
  12283. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12284. rcssNum.exec( jQuery.css( elem, prop ) );
  12285. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12286. // Support: Firefox <=54
  12287. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12288. initial = initial / 2;
  12289. // Trust units reported by jQuery.css
  12290. unit = unit || initialInUnit[ 3 ];
  12291. // Iteratively approximate from a nonzero starting point
  12292. initialInUnit = +initial || 1;
  12293. while ( maxIterations-- ) {
  12294. // Evaluate and update our best guess (doubling guesses that zero out).
  12295. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12296. jQuery.style( elem, prop, initialInUnit + unit );
  12297. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12298. maxIterations = 0;
  12299. }
  12300. initialInUnit = initialInUnit / scale;
  12301. }
  12302. initialInUnit = initialInUnit * 2;
  12303. jQuery.style( elem, prop, initialInUnit + unit );
  12304. // Make sure we update the tween properties later on
  12305. valueParts = valueParts || [];
  12306. }
  12307. if ( valueParts ) {
  12308. initialInUnit = +initialInUnit || +initial || 0;
  12309. // Apply relative offset (+=/-=) if specified
  12310. adjusted = valueParts[ 1 ] ?
  12311. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12312. +valueParts[ 2 ];
  12313. if ( tween ) {
  12314. tween.unit = unit;
  12315. tween.start = initialInUnit;
  12316. tween.end = adjusted;
  12317. }
  12318. }
  12319. return adjusted;
  12320. }
  12321. var defaultDisplayMap = {};
  12322. function getDefaultDisplay( elem ) {
  12323. var temp,
  12324. doc = elem.ownerDocument,
  12325. nodeName = elem.nodeName,
  12326. display = defaultDisplayMap[ nodeName ];
  12327. if ( display ) {
  12328. return display;
  12329. }
  12330. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12331. display = jQuery.css( temp, "display" );
  12332. temp.parentNode.removeChild( temp );
  12333. if ( display === "none" ) {
  12334. display = "block";
  12335. }
  12336. defaultDisplayMap[ nodeName ] = display;
  12337. return display;
  12338. }
  12339. function showHide( elements, show ) {
  12340. var display, elem,
  12341. values = [],
  12342. index = 0,
  12343. length = elements.length;
  12344. // Determine new display value for elements that need to change
  12345. for ( ; index < length; index++ ) {
  12346. elem = elements[ index ];
  12347. if ( !elem.style ) {
  12348. continue;
  12349. }
  12350. display = elem.style.display;
  12351. if ( show ) {
  12352. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12353. // check is required in this first loop unless we have a nonempty display value (either
  12354. // inline or about-to-be-restored)
  12355. if ( display === "none" ) {
  12356. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12357. if ( !values[ index ] ) {
  12358. elem.style.display = "";
  12359. }
  12360. }
  12361. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12362. values[ index ] = getDefaultDisplay( elem );
  12363. }
  12364. } else {
  12365. if ( display !== "none" ) {
  12366. values[ index ] = "none";
  12367. // Remember what we're overwriting
  12368. dataPriv.set( elem, "display", display );
  12369. }
  12370. }
  12371. }
  12372. // Set the display of the elements in a second loop to avoid constant reflow
  12373. for ( index = 0; index < length; index++ ) {
  12374. if ( values[ index ] != null ) {
  12375. elements[ index ].style.display = values[ index ];
  12376. }
  12377. }
  12378. return elements;
  12379. }
  12380. jQuery.fn.extend( {
  12381. show: function() {
  12382. return showHide( this, true );
  12383. },
  12384. hide: function() {
  12385. return showHide( this );
  12386. },
  12387. toggle: function( state ) {
  12388. if ( typeof state === "boolean" ) {
  12389. return state ? this.show() : this.hide();
  12390. }
  12391. return this.each( function() {
  12392. if ( isHiddenWithinTree( this ) ) {
  12393. jQuery( this ).show();
  12394. } else {
  12395. jQuery( this ).hide();
  12396. }
  12397. } );
  12398. }
  12399. } );
  12400. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12401. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12402. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12403. // We have to close these tags to support XHTML (#13200)
  12404. var wrapMap = {
  12405. // Support: IE <=9 only
  12406. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12407. // XHTML parsers do not magically insert elements in the
  12408. // same way that tag soup parsers do. So we cannot shorten
  12409. // this by omitting <tbody> or other required elements.
  12410. thead: [ 1, "<table>", "</table>" ],
  12411. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12412. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12413. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12414. _default: [ 0, "", "" ]
  12415. };
  12416. // Support: IE <=9 only
  12417. wrapMap.optgroup = wrapMap.option;
  12418. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12419. wrapMap.th = wrapMap.td;
  12420. function getAll( context, tag ) {
  12421. // Support: IE <=9 - 11 only
  12422. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12423. var ret;
  12424. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12425. ret = context.getElementsByTagName( tag || "*" );
  12426. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12427. ret = context.querySelectorAll( tag || "*" );
  12428. } else {
  12429. ret = [];
  12430. }
  12431. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12432. return jQuery.merge( [ context ], ret );
  12433. }
  12434. return ret;
  12435. }
  12436. // Mark scripts as having already been evaluated
  12437. function setGlobalEval( elems, refElements ) {
  12438. var i = 0,
  12439. l = elems.length;
  12440. for ( ; i < l; i++ ) {
  12441. dataPriv.set(
  12442. elems[ i ],
  12443. "globalEval",
  12444. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12445. );
  12446. }
  12447. }
  12448. var rhtml = /<|&#?\w+;/;
  12449. function buildFragment( elems, context, scripts, selection, ignored ) {
  12450. var elem, tmp, tag, wrap, attached, j,
  12451. fragment = context.createDocumentFragment(),
  12452. nodes = [],
  12453. i = 0,
  12454. l = elems.length;
  12455. for ( ; i < l; i++ ) {
  12456. elem = elems[ i ];
  12457. if ( elem || elem === 0 ) {
  12458. // Add nodes directly
  12459. if ( toType( elem ) === "object" ) {
  12460. // Support: Android <=4.0 only, PhantomJS 1 only
  12461. // push.apply(_, arraylike) throws on ancient WebKit
  12462. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12463. // Convert non-html into a text node
  12464. } else if ( !rhtml.test( elem ) ) {
  12465. nodes.push( context.createTextNode( elem ) );
  12466. // Convert html into DOM nodes
  12467. } else {
  12468. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12469. // Deserialize a standard representation
  12470. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12471. wrap = wrapMap[ tag ] || wrapMap._default;
  12472. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12473. // Descend through wrappers to the right content
  12474. j = wrap[ 0 ];
  12475. while ( j-- ) {
  12476. tmp = tmp.lastChild;
  12477. }
  12478. // Support: Android <=4.0 only, PhantomJS 1 only
  12479. // push.apply(_, arraylike) throws on ancient WebKit
  12480. jQuery.merge( nodes, tmp.childNodes );
  12481. // Remember the top-level container
  12482. tmp = fragment.firstChild;
  12483. // Ensure the created nodes are orphaned (#12392)
  12484. tmp.textContent = "";
  12485. }
  12486. }
  12487. }
  12488. // Remove wrapper from fragment
  12489. fragment.textContent = "";
  12490. i = 0;
  12491. while ( ( elem = nodes[ i++ ] ) ) {
  12492. // Skip elements already in the context collection (trac-4087)
  12493. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12494. if ( ignored ) {
  12495. ignored.push( elem );
  12496. }
  12497. continue;
  12498. }
  12499. attached = isAttached( elem );
  12500. // Append to fragment
  12501. tmp = getAll( fragment.appendChild( elem ), "script" );
  12502. // Preserve script evaluation history
  12503. if ( attached ) {
  12504. setGlobalEval( tmp );
  12505. }
  12506. // Capture executables
  12507. if ( scripts ) {
  12508. j = 0;
  12509. while ( ( elem = tmp[ j++ ] ) ) {
  12510. if ( rscriptType.test( elem.type || "" ) ) {
  12511. scripts.push( elem );
  12512. }
  12513. }
  12514. }
  12515. }
  12516. return fragment;
  12517. }
  12518. ( function() {
  12519. var fragment = document.createDocumentFragment(),
  12520. div = fragment.appendChild( document.createElement( "div" ) ),
  12521. input = document.createElement( "input" );
  12522. // Support: Android 4.0 - 4.3 only
  12523. // Check state lost if the name is set (#11217)
  12524. // Support: Windows Web Apps (WWA)
  12525. // `name` and `type` must use .setAttribute for WWA (#14901)
  12526. input.setAttribute( "type", "radio" );
  12527. input.setAttribute( "checked", "checked" );
  12528. input.setAttribute( "name", "t" );
  12529. div.appendChild( input );
  12530. // Support: Android <=4.1 only
  12531. // Older WebKit doesn't clone checked state correctly in fragments
  12532. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12533. // Support: IE <=11 only
  12534. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12535. div.innerHTML = "<textarea>x</textarea>";
  12536. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12537. } )();
  12538. var
  12539. rkeyEvent = /^key/,
  12540. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12541. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12542. function returnTrue() {
  12543. return true;
  12544. }
  12545. function returnFalse() {
  12546. return false;
  12547. }
  12548. // Support: IE <=9 - 11+
  12549. // focus() and blur() are asynchronous, except when they are no-op.
  12550. // So expect focus to be synchronous when the element is already active,
  12551. // and blur to be synchronous when the element is not already active.
  12552. // (focus and blur are always synchronous in other supported browsers,
  12553. // this just defines when we can count on it).
  12554. function expectSync( elem, type ) {
  12555. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12556. }
  12557. // Support: IE <=9 only
  12558. // Accessing document.activeElement can throw unexpectedly
  12559. // https://bugs.jquery.com/ticket/13393
  12560. function safeActiveElement() {
  12561. try {
  12562. return document.activeElement;
  12563. } catch ( err ) { }
  12564. }
  12565. function on( elem, types, selector, data, fn, one ) {
  12566. var origFn, type;
  12567. // Types can be a map of types/handlers
  12568. if ( typeof types === "object" ) {
  12569. // ( types-Object, selector, data )
  12570. if ( typeof selector !== "string" ) {
  12571. // ( types-Object, data )
  12572. data = data || selector;
  12573. selector = undefined;
  12574. }
  12575. for ( type in types ) {
  12576. on( elem, type, selector, data, types[ type ], one );
  12577. }
  12578. return elem;
  12579. }
  12580. if ( data == null && fn == null ) {
  12581. // ( types, fn )
  12582. fn = selector;
  12583. data = selector = undefined;
  12584. } else if ( fn == null ) {
  12585. if ( typeof selector === "string" ) {
  12586. // ( types, selector, fn )
  12587. fn = data;
  12588. data = undefined;
  12589. } else {
  12590. // ( types, data, fn )
  12591. fn = data;
  12592. data = selector;
  12593. selector = undefined;
  12594. }
  12595. }
  12596. if ( fn === false ) {
  12597. fn = returnFalse;
  12598. } else if ( !fn ) {
  12599. return elem;
  12600. }
  12601. if ( one === 1 ) {
  12602. origFn = fn;
  12603. fn = function( event ) {
  12604. // Can use an empty set, since event contains the info
  12605. jQuery().off( event );
  12606. return origFn.apply( this, arguments );
  12607. };
  12608. // Use same guid so caller can remove using origFn
  12609. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12610. }
  12611. return elem.each( function() {
  12612. jQuery.event.add( this, types, fn, data, selector );
  12613. } );
  12614. }
  12615. /*
  12616. * Helper functions for managing events -- not part of the public interface.
  12617. * Props to Dean Edwards' addEvent library for many of the ideas.
  12618. */
  12619. jQuery.event = {
  12620. global: {},
  12621. add: function( elem, types, handler, data, selector ) {
  12622. var handleObjIn, eventHandle, tmp,
  12623. events, t, handleObj,
  12624. special, handlers, type, namespaces, origType,
  12625. elemData = dataPriv.get( elem );
  12626. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12627. if ( !elemData ) {
  12628. return;
  12629. }
  12630. // Caller can pass in an object of custom data in lieu of the handler
  12631. if ( handler.handler ) {
  12632. handleObjIn = handler;
  12633. handler = handleObjIn.handler;
  12634. selector = handleObjIn.selector;
  12635. }
  12636. // Ensure that invalid selectors throw exceptions at attach time
  12637. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12638. if ( selector ) {
  12639. jQuery.find.matchesSelector( documentElement, selector );
  12640. }
  12641. // Make sure that the handler has a unique ID, used to find/remove it later
  12642. if ( !handler.guid ) {
  12643. handler.guid = jQuery.guid++;
  12644. }
  12645. // Init the element's event structure and main handler, if this is the first
  12646. if ( !( events = elemData.events ) ) {
  12647. events = elemData.events = {};
  12648. }
  12649. if ( !( eventHandle = elemData.handle ) ) {
  12650. eventHandle = elemData.handle = function( e ) {
  12651. // Discard the second event of a jQuery.event.trigger() and
  12652. // when an event is called after a page has unloaded
  12653. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12654. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12655. };
  12656. }
  12657. // Handle multiple events separated by a space
  12658. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12659. t = types.length;
  12660. while ( t-- ) {
  12661. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12662. type = origType = tmp[ 1 ];
  12663. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12664. // There *must* be a type, no attaching namespace-only handlers
  12665. if ( !type ) {
  12666. continue;
  12667. }
  12668. // If event changes its type, use the special event handlers for the changed type
  12669. special = jQuery.event.special[ type ] || {};
  12670. // If selector defined, determine special event api type, otherwise given type
  12671. type = ( selector ? special.delegateType : special.bindType ) || type;
  12672. // Update special based on newly reset type
  12673. special = jQuery.event.special[ type ] || {};
  12674. // handleObj is passed to all event handlers
  12675. handleObj = jQuery.extend( {
  12676. type: type,
  12677. origType: origType,
  12678. data: data,
  12679. handler: handler,
  12680. guid: handler.guid,
  12681. selector: selector,
  12682. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12683. namespace: namespaces.join( "." )
  12684. }, handleObjIn );
  12685. // Init the event handler queue if we're the first
  12686. if ( !( handlers = events[ type ] ) ) {
  12687. handlers = events[ type ] = [];
  12688. handlers.delegateCount = 0;
  12689. // Only use addEventListener if the special events handler returns false
  12690. if ( !special.setup ||
  12691. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12692. if ( elem.addEventListener ) {
  12693. elem.addEventListener( type, eventHandle );
  12694. }
  12695. }
  12696. }
  12697. if ( special.add ) {
  12698. special.add.call( elem, handleObj );
  12699. if ( !handleObj.handler.guid ) {
  12700. handleObj.handler.guid = handler.guid;
  12701. }
  12702. }
  12703. // Add to the element's handler list, delegates in front
  12704. if ( selector ) {
  12705. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12706. } else {
  12707. handlers.push( handleObj );
  12708. }
  12709. // Keep track of which events have ever been used, for event optimization
  12710. jQuery.event.global[ type ] = true;
  12711. }
  12712. },
  12713. // Detach an event or set of events from an element
  12714. remove: function( elem, types, handler, selector, mappedTypes ) {
  12715. var j, origCount, tmp,
  12716. events, t, handleObj,
  12717. special, handlers, type, namespaces, origType,
  12718. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12719. if ( !elemData || !( events = elemData.events ) ) {
  12720. return;
  12721. }
  12722. // Once for each type.namespace in types; type may be omitted
  12723. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12724. t = types.length;
  12725. while ( t-- ) {
  12726. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12727. type = origType = tmp[ 1 ];
  12728. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12729. // Unbind all events (on this namespace, if provided) for the element
  12730. if ( !type ) {
  12731. for ( type in events ) {
  12732. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12733. }
  12734. continue;
  12735. }
  12736. special = jQuery.event.special[ type ] || {};
  12737. type = ( selector ? special.delegateType : special.bindType ) || type;
  12738. handlers = events[ type ] || [];
  12739. tmp = tmp[ 2 ] &&
  12740. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12741. // Remove matching events
  12742. origCount = j = handlers.length;
  12743. while ( j-- ) {
  12744. handleObj = handlers[ j ];
  12745. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12746. ( !handler || handler.guid === handleObj.guid ) &&
  12747. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12748. ( !selector || selector === handleObj.selector ||
  12749. selector === "**" && handleObj.selector ) ) {
  12750. handlers.splice( j, 1 );
  12751. if ( handleObj.selector ) {
  12752. handlers.delegateCount--;
  12753. }
  12754. if ( special.remove ) {
  12755. special.remove.call( elem, handleObj );
  12756. }
  12757. }
  12758. }
  12759. // Remove generic event handler if we removed something and no more handlers exist
  12760. // (avoids potential for endless recursion during removal of special event handlers)
  12761. if ( origCount && !handlers.length ) {
  12762. if ( !special.teardown ||
  12763. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12764. jQuery.removeEvent( elem, type, elemData.handle );
  12765. }
  12766. delete events[ type ];
  12767. }
  12768. }
  12769. // Remove data and the expando if it's no longer used
  12770. if ( jQuery.isEmptyObject( events ) ) {
  12771. dataPriv.remove( elem, "handle events" );
  12772. }
  12773. },
  12774. dispatch: function( nativeEvent ) {
  12775. // Make a writable jQuery.Event from the native event object
  12776. var event = jQuery.event.fix( nativeEvent );
  12777. var i, j, ret, matched, handleObj, handlerQueue,
  12778. args = new Array( arguments.length ),
  12779. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12780. special = jQuery.event.special[ event.type ] || {};
  12781. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12782. args[ 0 ] = event;
  12783. for ( i = 1; i < arguments.length; i++ ) {
  12784. args[ i ] = arguments[ i ];
  12785. }
  12786. event.delegateTarget = this;
  12787. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12788. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12789. return;
  12790. }
  12791. // Determine handlers
  12792. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12793. // Run delegates first; they may want to stop propagation beneath us
  12794. i = 0;
  12795. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12796. event.currentTarget = matched.elem;
  12797. j = 0;
  12798. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12799. !event.isImmediatePropagationStopped() ) {
  12800. // If the event is namespaced, then each handler is only invoked if it is
  12801. // specially universal or its namespaces are a superset of the event's.
  12802. if ( !event.rnamespace || handleObj.namespace === false ||
  12803. event.rnamespace.test( handleObj.namespace ) ) {
  12804. event.handleObj = handleObj;
  12805. event.data = handleObj.data;
  12806. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12807. handleObj.handler ).apply( matched.elem, args );
  12808. if ( ret !== undefined ) {
  12809. if ( ( event.result = ret ) === false ) {
  12810. event.preventDefault();
  12811. event.stopPropagation();
  12812. }
  12813. }
  12814. }
  12815. }
  12816. }
  12817. // Call the postDispatch hook for the mapped type
  12818. if ( special.postDispatch ) {
  12819. special.postDispatch.call( this, event );
  12820. }
  12821. return event.result;
  12822. },
  12823. handlers: function( event, handlers ) {
  12824. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12825. handlerQueue = [],
  12826. delegateCount = handlers.delegateCount,
  12827. cur = event.target;
  12828. // Find delegate handlers
  12829. if ( delegateCount &&
  12830. // Support: IE <=9
  12831. // Black-hole SVG <use> instance trees (trac-13180)
  12832. cur.nodeType &&
  12833. // Support: Firefox <=42
  12834. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12835. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12836. // Support: IE 11 only
  12837. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12838. !( event.type === "click" && event.button >= 1 ) ) {
  12839. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12840. // Don't check non-elements (#13208)
  12841. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12842. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12843. matchedHandlers = [];
  12844. matchedSelectors = {};
  12845. for ( i = 0; i < delegateCount; i++ ) {
  12846. handleObj = handlers[ i ];
  12847. // Don't conflict with Object.prototype properties (#13203)
  12848. sel = handleObj.selector + " ";
  12849. if ( matchedSelectors[ sel ] === undefined ) {
  12850. matchedSelectors[ sel ] = handleObj.needsContext ?
  12851. jQuery( sel, this ).index( cur ) > -1 :
  12852. jQuery.find( sel, this, null, [ cur ] ).length;
  12853. }
  12854. if ( matchedSelectors[ sel ] ) {
  12855. matchedHandlers.push( handleObj );
  12856. }
  12857. }
  12858. if ( matchedHandlers.length ) {
  12859. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12860. }
  12861. }
  12862. }
  12863. }
  12864. // Add the remaining (directly-bound) handlers
  12865. cur = this;
  12866. if ( delegateCount < handlers.length ) {
  12867. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12868. }
  12869. return handlerQueue;
  12870. },
  12871. addProp: function( name, hook ) {
  12872. Object.defineProperty( jQuery.Event.prototype, name, {
  12873. enumerable: true,
  12874. configurable: true,
  12875. get: isFunction( hook ) ?
  12876. function() {
  12877. if ( this.originalEvent ) {
  12878. return hook( this.originalEvent );
  12879. }
  12880. } :
  12881. function() {
  12882. if ( this.originalEvent ) {
  12883. return this.originalEvent[ name ];
  12884. }
  12885. },
  12886. set: function( value ) {
  12887. Object.defineProperty( this, name, {
  12888. enumerable: true,
  12889. configurable: true,
  12890. writable: true,
  12891. value: value
  12892. } );
  12893. }
  12894. } );
  12895. },
  12896. fix: function( originalEvent ) {
  12897. return originalEvent[ jQuery.expando ] ?
  12898. originalEvent :
  12899. new jQuery.Event( originalEvent );
  12900. },
  12901. special: {
  12902. load: {
  12903. // Prevent triggered image.load events from bubbling to window.load
  12904. noBubble: true
  12905. },
  12906. click: {
  12907. // Utilize native event to ensure correct state for checkable inputs
  12908. setup: function( data ) {
  12909. // For mutual compressibility with _default, replace `this` access with a local var.
  12910. // `|| data` is dead code meant only to preserve the variable through minification.
  12911. var el = this || data;
  12912. // Claim the first handler
  12913. if ( rcheckableType.test( el.type ) &&
  12914. el.click && nodeName( el, "input" ) ) {
  12915. // dataPriv.set( el, "click", ... )
  12916. leverageNative( el, "click", returnTrue );
  12917. }
  12918. // Return false to allow normal processing in the caller
  12919. return false;
  12920. },
  12921. trigger: function( data ) {
  12922. // For mutual compressibility with _default, replace `this` access with a local var.
  12923. // `|| data` is dead code meant only to preserve the variable through minification.
  12924. var el = this || data;
  12925. // Force setup before triggering a click
  12926. if ( rcheckableType.test( el.type ) &&
  12927. el.click && nodeName( el, "input" ) ) {
  12928. leverageNative( el, "click" );
  12929. }
  12930. // Return non-false to allow normal event-path propagation
  12931. return true;
  12932. },
  12933. // For cross-browser consistency, suppress native .click() on links
  12934. // Also prevent it if we're currently inside a leveraged native-event stack
  12935. _default: function( event ) {
  12936. var target = event.target;
  12937. return rcheckableType.test( target.type ) &&
  12938. target.click && nodeName( target, "input" ) &&
  12939. dataPriv.get( target, "click" ) ||
  12940. nodeName( target, "a" );
  12941. }
  12942. },
  12943. beforeunload: {
  12944. postDispatch: function( event ) {
  12945. // Support: Firefox 20+
  12946. // Firefox doesn't alert if the returnValue field is not set.
  12947. if ( event.result !== undefined && event.originalEvent ) {
  12948. event.originalEvent.returnValue = event.result;
  12949. }
  12950. }
  12951. }
  12952. }
  12953. };
  12954. // Ensure the presence of an event listener that handles manually-triggered
  12955. // synthetic events by interrupting progress until reinvoked in response to
  12956. // *native* events that it fires directly, ensuring that state changes have
  12957. // already occurred before other listeners are invoked.
  12958. function leverageNative( el, type, expectSync ) {
  12959. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12960. if ( !expectSync ) {
  12961. if ( dataPriv.get( el, type ) === undefined ) {
  12962. jQuery.event.add( el, type, returnTrue );
  12963. }
  12964. return;
  12965. }
  12966. // Register the controller as a special universal handler for all event namespaces
  12967. dataPriv.set( el, type, false );
  12968. jQuery.event.add( el, type, {
  12969. namespace: false,
  12970. handler: function( event ) {
  12971. var notAsync, result,
  12972. saved = dataPriv.get( this, type );
  12973. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12974. // Interrupt processing of the outer synthetic .trigger()ed event
  12975. // Saved data should be false in such cases, but might be a leftover capture object
  12976. // from an async native handler (gh-4350)
  12977. if ( !saved.length ) {
  12978. // Store arguments for use when handling the inner native event
  12979. // There will always be at least one argument (an event object), so this array
  12980. // will not be confused with a leftover capture object.
  12981. saved = slice.call( arguments );
  12982. dataPriv.set( this, type, saved );
  12983. // Trigger the native event and capture its result
  12984. // Support: IE <=9 - 11+
  12985. // focus() and blur() are asynchronous
  12986. notAsync = expectSync( this, type );
  12987. this[ type ]();
  12988. result = dataPriv.get( this, type );
  12989. if ( saved !== result || notAsync ) {
  12990. dataPriv.set( this, type, false );
  12991. } else {
  12992. result = {};
  12993. }
  12994. if ( saved !== result ) {
  12995. // Cancel the outer synthetic event
  12996. event.stopImmediatePropagation();
  12997. event.preventDefault();
  12998. return result.value;
  12999. }
  13000. // If this is an inner synthetic event for an event with a bubbling surrogate
  13001. // (focus or blur), assume that the surrogate already propagated from triggering the
  13002. // native event and prevent that from happening again here.
  13003. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13004. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13005. // less bad than duplication.
  13006. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13007. event.stopPropagation();
  13008. }
  13009. // If this is a native event triggered above, everything is now in order
  13010. // Fire an inner synthetic event with the original arguments
  13011. } else if ( saved.length ) {
  13012. // ...and capture the result
  13013. dataPriv.set( this, type, {
  13014. value: jQuery.event.trigger(
  13015. // Support: IE <=9 - 11+
  13016. // Extend with the prototype to reset the above stopImmediatePropagation()
  13017. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13018. saved.slice( 1 ),
  13019. this
  13020. )
  13021. } );
  13022. // Abort handling of the native event
  13023. event.stopImmediatePropagation();
  13024. }
  13025. }
  13026. } );
  13027. }
  13028. jQuery.removeEvent = function( elem, type, handle ) {
  13029. // This "if" is needed for plain objects
  13030. if ( elem.removeEventListener ) {
  13031. elem.removeEventListener( type, handle );
  13032. }
  13033. };
  13034. jQuery.Event = function( src, props ) {
  13035. // Allow instantiation without the 'new' keyword
  13036. if ( !( this instanceof jQuery.Event ) ) {
  13037. return new jQuery.Event( src, props );
  13038. }
  13039. // Event object
  13040. if ( src && src.type ) {
  13041. this.originalEvent = src;
  13042. this.type = src.type;
  13043. // Events bubbling up the document may have been marked as prevented
  13044. // by a handler lower down the tree; reflect the correct value.
  13045. this.isDefaultPrevented = src.defaultPrevented ||
  13046. src.defaultPrevented === undefined &&
  13047. // Support: Android <=2.3 only
  13048. src.returnValue === false ?
  13049. returnTrue :
  13050. returnFalse;
  13051. // Create target properties
  13052. // Support: Safari <=6 - 7 only
  13053. // Target should not be a text node (#504, #13143)
  13054. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13055. src.target.parentNode :
  13056. src.target;
  13057. this.currentTarget = src.currentTarget;
  13058. this.relatedTarget = src.relatedTarget;
  13059. // Event type
  13060. } else {
  13061. this.type = src;
  13062. }
  13063. // Put explicitly provided properties onto the event object
  13064. if ( props ) {
  13065. jQuery.extend( this, props );
  13066. }
  13067. // Create a timestamp if incoming event doesn't have one
  13068. this.timeStamp = src && src.timeStamp || Date.now();
  13069. // Mark it as fixed
  13070. this[ jQuery.expando ] = true;
  13071. };
  13072. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13073. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13074. jQuery.Event.prototype = {
  13075. constructor: jQuery.Event,
  13076. isDefaultPrevented: returnFalse,
  13077. isPropagationStopped: returnFalse,
  13078. isImmediatePropagationStopped: returnFalse,
  13079. isSimulated: false,
  13080. preventDefault: function() {
  13081. var e = this.originalEvent;
  13082. this.isDefaultPrevented = returnTrue;
  13083. if ( e && !this.isSimulated ) {
  13084. e.preventDefault();
  13085. }
  13086. },
  13087. stopPropagation: function() {
  13088. var e = this.originalEvent;
  13089. this.isPropagationStopped = returnTrue;
  13090. if ( e && !this.isSimulated ) {
  13091. e.stopPropagation();
  13092. }
  13093. },
  13094. stopImmediatePropagation: function() {
  13095. var e = this.originalEvent;
  13096. this.isImmediatePropagationStopped = returnTrue;
  13097. if ( e && !this.isSimulated ) {
  13098. e.stopImmediatePropagation();
  13099. }
  13100. this.stopPropagation();
  13101. }
  13102. };
  13103. // Includes all common event props including KeyEvent and MouseEvent specific props
  13104. jQuery.each( {
  13105. altKey: true,
  13106. bubbles: true,
  13107. cancelable: true,
  13108. changedTouches: true,
  13109. ctrlKey: true,
  13110. detail: true,
  13111. eventPhase: true,
  13112. metaKey: true,
  13113. pageX: true,
  13114. pageY: true,
  13115. shiftKey: true,
  13116. view: true,
  13117. "char": true,
  13118. code: true,
  13119. charCode: true,
  13120. key: true,
  13121. keyCode: true,
  13122. button: true,
  13123. buttons: true,
  13124. clientX: true,
  13125. clientY: true,
  13126. offsetX: true,
  13127. offsetY: true,
  13128. pointerId: true,
  13129. pointerType: true,
  13130. screenX: true,
  13131. screenY: true,
  13132. targetTouches: true,
  13133. toElement: true,
  13134. touches: true,
  13135. which: function( event ) {
  13136. var button = event.button;
  13137. // Add which for key events
  13138. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13139. return event.charCode != null ? event.charCode : event.keyCode;
  13140. }
  13141. // Add which for click: 1 === left; 2 === middle; 3 === right
  13142. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13143. if ( button & 1 ) {
  13144. return 1;
  13145. }
  13146. if ( button & 2 ) {
  13147. return 3;
  13148. }
  13149. if ( button & 4 ) {
  13150. return 2;
  13151. }
  13152. return 0;
  13153. }
  13154. return event.which;
  13155. }
  13156. }, jQuery.event.addProp );
  13157. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13158. jQuery.event.special[ type ] = {
  13159. // Utilize native event if possible so blur/focus sequence is correct
  13160. setup: function() {
  13161. // Claim the first handler
  13162. // dataPriv.set( this, "focus", ... )
  13163. // dataPriv.set( this, "blur", ... )
  13164. leverageNative( this, type, expectSync );
  13165. // Return false to allow normal processing in the caller
  13166. return false;
  13167. },
  13168. trigger: function() {
  13169. // Force setup before trigger
  13170. leverageNative( this, type );
  13171. // Return non-false to allow normal event-path propagation
  13172. return true;
  13173. },
  13174. delegateType: delegateType
  13175. };
  13176. } );
  13177. // Create mouseenter/leave events using mouseover/out and event-time checks
  13178. // so that event delegation works in jQuery.
  13179. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13180. //
  13181. // Support: Safari 7 only
  13182. // Safari sends mouseenter too often; see:
  13183. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13184. // for the description of the bug (it existed in older Chrome versions as well).
  13185. jQuery.each( {
  13186. mouseenter: "mouseover",
  13187. mouseleave: "mouseout",
  13188. pointerenter: "pointerover",
  13189. pointerleave: "pointerout"
  13190. }, function( orig, fix ) {
  13191. jQuery.event.special[ orig ] = {
  13192. delegateType: fix,
  13193. bindType: fix,
  13194. handle: function( event ) {
  13195. var ret,
  13196. target = this,
  13197. related = event.relatedTarget,
  13198. handleObj = event.handleObj;
  13199. // For mouseenter/leave call the handler if related is outside the target.
  13200. // NB: No relatedTarget if the mouse left/entered the browser window
  13201. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13202. event.type = handleObj.origType;
  13203. ret = handleObj.handler.apply( this, arguments );
  13204. event.type = fix;
  13205. }
  13206. return ret;
  13207. }
  13208. };
  13209. } );
  13210. jQuery.fn.extend( {
  13211. on: function( types, selector, data, fn ) {
  13212. return on( this, types, selector, data, fn );
  13213. },
  13214. one: function( types, selector, data, fn ) {
  13215. return on( this, types, selector, data, fn, 1 );
  13216. },
  13217. off: function( types, selector, fn ) {
  13218. var handleObj, type;
  13219. if ( types && types.preventDefault && types.handleObj ) {
  13220. // ( event ) dispatched jQuery.Event
  13221. handleObj = types.handleObj;
  13222. jQuery( types.delegateTarget ).off(
  13223. handleObj.namespace ?
  13224. handleObj.origType + "." + handleObj.namespace :
  13225. handleObj.origType,
  13226. handleObj.selector,
  13227. handleObj.handler
  13228. );
  13229. return this;
  13230. }
  13231. if ( typeof types === "object" ) {
  13232. // ( types-object [, selector] )
  13233. for ( type in types ) {
  13234. this.off( type, selector, types[ type ] );
  13235. }
  13236. return this;
  13237. }
  13238. if ( selector === false || typeof selector === "function" ) {
  13239. // ( types [, fn] )
  13240. fn = selector;
  13241. selector = undefined;
  13242. }
  13243. if ( fn === false ) {
  13244. fn = returnFalse;
  13245. }
  13246. return this.each( function() {
  13247. jQuery.event.remove( this, types, fn, selector );
  13248. } );
  13249. }
  13250. } );
  13251. var
  13252. /* eslint-disable max-len */
  13253. // See https://github.com/eslint/eslint/issues/3229
  13254. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13255. /* eslint-enable */
  13256. // Support: IE <=10 - 11, Edge 12 - 13 only
  13257. // In IE/Edge using regex groups here causes severe slowdowns.
  13258. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13259. rnoInnerhtml = /<script|<style|<link/i,
  13260. // checked="checked" or checked
  13261. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13262. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13263. // Prefer a tbody over its parent table for containing new rows
  13264. function manipulationTarget( elem, content ) {
  13265. if ( nodeName( elem, "table" ) &&
  13266. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13267. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13268. }
  13269. return elem;
  13270. }
  13271. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13272. function disableScript( elem ) {
  13273. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13274. return elem;
  13275. }
  13276. function restoreScript( elem ) {
  13277. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13278. elem.type = elem.type.slice( 5 );
  13279. } else {
  13280. elem.removeAttribute( "type" );
  13281. }
  13282. return elem;
  13283. }
  13284. function cloneCopyEvent( src, dest ) {
  13285. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13286. if ( dest.nodeType !== 1 ) {
  13287. return;
  13288. }
  13289. // 1. Copy private data: events, handlers, etc.
  13290. if ( dataPriv.hasData( src ) ) {
  13291. pdataOld = dataPriv.access( src );
  13292. pdataCur = dataPriv.set( dest, pdataOld );
  13293. events = pdataOld.events;
  13294. if ( events ) {
  13295. delete pdataCur.handle;
  13296. pdataCur.events = {};
  13297. for ( type in events ) {
  13298. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13299. jQuery.event.add( dest, type, events[ type ][ i ] );
  13300. }
  13301. }
  13302. }
  13303. }
  13304. // 2. Copy user data
  13305. if ( dataUser.hasData( src ) ) {
  13306. udataOld = dataUser.access( src );
  13307. udataCur = jQuery.extend( {}, udataOld );
  13308. dataUser.set( dest, udataCur );
  13309. }
  13310. }
  13311. // Fix IE bugs, see support tests
  13312. function fixInput( src, dest ) {
  13313. var nodeName = dest.nodeName.toLowerCase();
  13314. // Fails to persist the checked state of a cloned checkbox or radio button.
  13315. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13316. dest.checked = src.checked;
  13317. // Fails to return the selected option to the default selected state when cloning options
  13318. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13319. dest.defaultValue = src.defaultValue;
  13320. }
  13321. }
  13322. function domManip( collection, args, callback, ignored ) {
  13323. // Flatten any nested arrays
  13324. args = concat.apply( [], args );
  13325. var fragment, first, scripts, hasScripts, node, doc,
  13326. i = 0,
  13327. l = collection.length,
  13328. iNoClone = l - 1,
  13329. value = args[ 0 ],
  13330. valueIsFunction = isFunction( value );
  13331. // We can't cloneNode fragments that contain checked, in WebKit
  13332. if ( valueIsFunction ||
  13333. ( l > 1 && typeof value === "string" &&
  13334. !support.checkClone && rchecked.test( value ) ) ) {
  13335. return collection.each( function( index ) {
  13336. var self = collection.eq( index );
  13337. if ( valueIsFunction ) {
  13338. args[ 0 ] = value.call( this, index, self.html() );
  13339. }
  13340. domManip( self, args, callback, ignored );
  13341. } );
  13342. }
  13343. if ( l ) {
  13344. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13345. first = fragment.firstChild;
  13346. if ( fragment.childNodes.length === 1 ) {
  13347. fragment = first;
  13348. }
  13349. // Require either new content or an interest in ignored elements to invoke the callback
  13350. if ( first || ignored ) {
  13351. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13352. hasScripts = scripts.length;
  13353. // Use the original fragment for the last item
  13354. // instead of the first because it can end up
  13355. // being emptied incorrectly in certain situations (#8070).
  13356. for ( ; i < l; i++ ) {
  13357. node = fragment;
  13358. if ( i !== iNoClone ) {
  13359. node = jQuery.clone( node, true, true );
  13360. // Keep references to cloned scripts for later restoration
  13361. if ( hasScripts ) {
  13362. // Support: Android <=4.0 only, PhantomJS 1 only
  13363. // push.apply(_, arraylike) throws on ancient WebKit
  13364. jQuery.merge( scripts, getAll( node, "script" ) );
  13365. }
  13366. }
  13367. callback.call( collection[ i ], node, i );
  13368. }
  13369. if ( hasScripts ) {
  13370. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13371. // Reenable scripts
  13372. jQuery.map( scripts, restoreScript );
  13373. // Evaluate executable scripts on first document insertion
  13374. for ( i = 0; i < hasScripts; i++ ) {
  13375. node = scripts[ i ];
  13376. if ( rscriptType.test( node.type || "" ) &&
  13377. !dataPriv.access( node, "globalEval" ) &&
  13378. jQuery.contains( doc, node ) ) {
  13379. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13380. // Optional AJAX dependency, but won't run scripts if not present
  13381. if ( jQuery._evalUrl && !node.noModule ) {
  13382. jQuery._evalUrl( node.src, {
  13383. nonce: node.nonce || node.getAttribute( "nonce" )
  13384. } );
  13385. }
  13386. } else {
  13387. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13388. }
  13389. }
  13390. }
  13391. }
  13392. }
  13393. }
  13394. return collection;
  13395. }
  13396. function remove( elem, selector, keepData ) {
  13397. var node,
  13398. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13399. i = 0;
  13400. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13401. if ( !keepData && node.nodeType === 1 ) {
  13402. jQuery.cleanData( getAll( node ) );
  13403. }
  13404. if ( node.parentNode ) {
  13405. if ( keepData && isAttached( node ) ) {
  13406. setGlobalEval( getAll( node, "script" ) );
  13407. }
  13408. node.parentNode.removeChild( node );
  13409. }
  13410. }
  13411. return elem;
  13412. }
  13413. jQuery.extend( {
  13414. htmlPrefilter: function( html ) {
  13415. return html.replace( rxhtmlTag, "<$1></$2>" );
  13416. },
  13417. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13418. var i, l, srcElements, destElements,
  13419. clone = elem.cloneNode( true ),
  13420. inPage = isAttached( elem );
  13421. // Fix IE cloning issues
  13422. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13423. !jQuery.isXMLDoc( elem ) ) {
  13424. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13425. destElements = getAll( clone );
  13426. srcElements = getAll( elem );
  13427. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13428. fixInput( srcElements[ i ], destElements[ i ] );
  13429. }
  13430. }
  13431. // Copy the events from the original to the clone
  13432. if ( dataAndEvents ) {
  13433. if ( deepDataAndEvents ) {
  13434. srcElements = srcElements || getAll( elem );
  13435. destElements = destElements || getAll( clone );
  13436. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13437. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13438. }
  13439. } else {
  13440. cloneCopyEvent( elem, clone );
  13441. }
  13442. }
  13443. // Preserve script evaluation history
  13444. destElements = getAll( clone, "script" );
  13445. if ( destElements.length > 0 ) {
  13446. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13447. }
  13448. // Return the cloned set
  13449. return clone;
  13450. },
  13451. cleanData: function( elems ) {
  13452. var data, elem, type,
  13453. special = jQuery.event.special,
  13454. i = 0;
  13455. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13456. if ( acceptData( elem ) ) {
  13457. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13458. if ( data.events ) {
  13459. for ( type in data.events ) {
  13460. if ( special[ type ] ) {
  13461. jQuery.event.remove( elem, type );
  13462. // This is a shortcut to avoid jQuery.event.remove's overhead
  13463. } else {
  13464. jQuery.removeEvent( elem, type, data.handle );
  13465. }
  13466. }
  13467. }
  13468. // Support: Chrome <=35 - 45+
  13469. // Assign undefined instead of using delete, see Data#remove
  13470. elem[ dataPriv.expando ] = undefined;
  13471. }
  13472. if ( elem[ dataUser.expando ] ) {
  13473. // Support: Chrome <=35 - 45+
  13474. // Assign undefined instead of using delete, see Data#remove
  13475. elem[ dataUser.expando ] = undefined;
  13476. }
  13477. }
  13478. }
  13479. }
  13480. } );
  13481. jQuery.fn.extend( {
  13482. detach: function( selector ) {
  13483. return remove( this, selector, true );
  13484. },
  13485. remove: function( selector ) {
  13486. return remove( this, selector );
  13487. },
  13488. text: function( value ) {
  13489. return access( this, function( value ) {
  13490. return value === undefined ?
  13491. jQuery.text( this ) :
  13492. this.empty().each( function() {
  13493. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13494. this.textContent = value;
  13495. }
  13496. } );
  13497. }, null, value, arguments.length );
  13498. },
  13499. append: function() {
  13500. return domManip( this, arguments, function( elem ) {
  13501. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13502. var target = manipulationTarget( this, elem );
  13503. target.appendChild( elem );
  13504. }
  13505. } );
  13506. },
  13507. prepend: function() {
  13508. return domManip( this, arguments, function( elem ) {
  13509. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13510. var target = manipulationTarget( this, elem );
  13511. target.insertBefore( elem, target.firstChild );
  13512. }
  13513. } );
  13514. },
  13515. before: function() {
  13516. return domManip( this, arguments, function( elem ) {
  13517. if ( this.parentNode ) {
  13518. this.parentNode.insertBefore( elem, this );
  13519. }
  13520. } );
  13521. },
  13522. after: function() {
  13523. return domManip( this, arguments, function( elem ) {
  13524. if ( this.parentNode ) {
  13525. this.parentNode.insertBefore( elem, this.nextSibling );
  13526. }
  13527. } );
  13528. },
  13529. empty: function() {
  13530. var elem,
  13531. i = 0;
  13532. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13533. if ( elem.nodeType === 1 ) {
  13534. // Prevent memory leaks
  13535. jQuery.cleanData( getAll( elem, false ) );
  13536. // Remove any remaining nodes
  13537. elem.textContent = "";
  13538. }
  13539. }
  13540. return this;
  13541. },
  13542. clone: function( dataAndEvents, deepDataAndEvents ) {
  13543. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13544. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13545. return this.map( function() {
  13546. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13547. } );
  13548. },
  13549. html: function( value ) {
  13550. return access( this, function( value ) {
  13551. var elem = this[ 0 ] || {},
  13552. i = 0,
  13553. l = this.length;
  13554. if ( value === undefined && elem.nodeType === 1 ) {
  13555. return elem.innerHTML;
  13556. }
  13557. // See if we can take a shortcut and just use innerHTML
  13558. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13559. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13560. value = jQuery.htmlPrefilter( value );
  13561. try {
  13562. for ( ; i < l; i++ ) {
  13563. elem = this[ i ] || {};
  13564. // Remove element nodes and prevent memory leaks
  13565. if ( elem.nodeType === 1 ) {
  13566. jQuery.cleanData( getAll( elem, false ) );
  13567. elem.innerHTML = value;
  13568. }
  13569. }
  13570. elem = 0;
  13571. // If using innerHTML throws an exception, use the fallback method
  13572. } catch ( e ) {}
  13573. }
  13574. if ( elem ) {
  13575. this.empty().append( value );
  13576. }
  13577. }, null, value, arguments.length );
  13578. },
  13579. replaceWith: function() {
  13580. var ignored = [];
  13581. // Make the changes, replacing each non-ignored context element with the new content
  13582. return domManip( this, arguments, function( elem ) {
  13583. var parent = this.parentNode;
  13584. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13585. jQuery.cleanData( getAll( this ) );
  13586. if ( parent ) {
  13587. parent.replaceChild( elem, this );
  13588. }
  13589. }
  13590. // Force callback invocation
  13591. }, ignored );
  13592. }
  13593. } );
  13594. jQuery.each( {
  13595. appendTo: "append",
  13596. prependTo: "prepend",
  13597. insertBefore: "before",
  13598. insertAfter: "after",
  13599. replaceAll: "replaceWith"
  13600. }, function( name, original ) {
  13601. jQuery.fn[ name ] = function( selector ) {
  13602. var elems,
  13603. ret = [],
  13604. insert = jQuery( selector ),
  13605. last = insert.length - 1,
  13606. i = 0;
  13607. for ( ; i <= last; i++ ) {
  13608. elems = i === last ? this : this.clone( true );
  13609. jQuery( insert[ i ] )[ original ]( elems );
  13610. // Support: Android <=4.0 only, PhantomJS 1 only
  13611. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13612. push.apply( ret, elems.get() );
  13613. }
  13614. return this.pushStack( ret );
  13615. };
  13616. } );
  13617. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13618. var getStyles = function( elem ) {
  13619. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13620. // IE throws on elements created in popups
  13621. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13622. var view = elem.ownerDocument.defaultView;
  13623. if ( !view || !view.opener ) {
  13624. view = window;
  13625. }
  13626. return view.getComputedStyle( elem );
  13627. };
  13628. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13629. ( function() {
  13630. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13631. // so they're executed at the same time to save the second computation.
  13632. function computeStyleTests() {
  13633. // This is a singleton, we need to execute it only once
  13634. if ( !div ) {
  13635. return;
  13636. }
  13637. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13638. "margin-top:1px;padding:0;border:0";
  13639. div.style.cssText =
  13640. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13641. "margin:auto;border:1px;padding:1px;" +
  13642. "width:60%;top:1%";
  13643. documentElement.appendChild( container ).appendChild( div );
  13644. var divStyle = window.getComputedStyle( div );
  13645. pixelPositionVal = divStyle.top !== "1%";
  13646. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13647. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13648. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13649. // Some styles come back with percentage values, even though they shouldn't
  13650. div.style.right = "60%";
  13651. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13652. // Support: IE 9 - 11 only
  13653. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13654. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13655. // Support: IE 9 only
  13656. // Detect overflow:scroll screwiness (gh-3699)
  13657. // Support: Chrome <=64
  13658. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13659. div.style.position = "absolute";
  13660. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13661. documentElement.removeChild( container );
  13662. // Nullify the div so it wouldn't be stored in the memory and
  13663. // it will also be a sign that checks already performed
  13664. div = null;
  13665. }
  13666. function roundPixelMeasures( measure ) {
  13667. return Math.round( parseFloat( measure ) );
  13668. }
  13669. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13670. reliableMarginLeftVal,
  13671. container = document.createElement( "div" ),
  13672. div = document.createElement( "div" );
  13673. // Finish early in limited (non-browser) environments
  13674. if ( !div.style ) {
  13675. return;
  13676. }
  13677. // Support: IE <=9 - 11 only
  13678. // Style of cloned element affects source element cloned (#8908)
  13679. div.style.backgroundClip = "content-box";
  13680. div.cloneNode( true ).style.backgroundClip = "";
  13681. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13682. jQuery.extend( support, {
  13683. boxSizingReliable: function() {
  13684. computeStyleTests();
  13685. return boxSizingReliableVal;
  13686. },
  13687. pixelBoxStyles: function() {
  13688. computeStyleTests();
  13689. return pixelBoxStylesVal;
  13690. },
  13691. pixelPosition: function() {
  13692. computeStyleTests();
  13693. return pixelPositionVal;
  13694. },
  13695. reliableMarginLeft: function() {
  13696. computeStyleTests();
  13697. return reliableMarginLeftVal;
  13698. },
  13699. scrollboxSize: function() {
  13700. computeStyleTests();
  13701. return scrollboxSizeVal;
  13702. }
  13703. } );
  13704. } )();
  13705. function curCSS( elem, name, computed ) {
  13706. var width, minWidth, maxWidth, ret,
  13707. // Support: Firefox 51+
  13708. // Retrieving style before computed somehow
  13709. // fixes an issue with getting wrong values
  13710. // on detached elements
  13711. style = elem.style;
  13712. computed = computed || getStyles( elem );
  13713. // getPropertyValue is needed for:
  13714. // .css('filter') (IE 9 only, #12537)
  13715. // .css('--customProperty) (#3144)
  13716. if ( computed ) {
  13717. ret = computed.getPropertyValue( name ) || computed[ name ];
  13718. if ( ret === "" && !isAttached( elem ) ) {
  13719. ret = jQuery.style( elem, name );
  13720. }
  13721. // A tribute to the "awesome hack by Dean Edwards"
  13722. // Android Browser returns percentage for some values,
  13723. // but width seems to be reliably pixels.
  13724. // This is against the CSSOM draft spec:
  13725. // https://drafts.csswg.org/cssom/#resolved-values
  13726. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13727. // Remember the original values
  13728. width = style.width;
  13729. minWidth = style.minWidth;
  13730. maxWidth = style.maxWidth;
  13731. // Put in the new values to get a computed value out
  13732. style.minWidth = style.maxWidth = style.width = ret;
  13733. ret = computed.width;
  13734. // Revert the changed values
  13735. style.width = width;
  13736. style.minWidth = minWidth;
  13737. style.maxWidth = maxWidth;
  13738. }
  13739. }
  13740. return ret !== undefined ?
  13741. // Support: IE <=9 - 11 only
  13742. // IE returns zIndex value as an integer.
  13743. ret + "" :
  13744. ret;
  13745. }
  13746. function addGetHookIf( conditionFn, hookFn ) {
  13747. // Define the hook, we'll check on the first run if it's really needed.
  13748. return {
  13749. get: function() {
  13750. if ( conditionFn() ) {
  13751. // Hook not needed (or it's not possible to use it due
  13752. // to missing dependency), remove it.
  13753. delete this.get;
  13754. return;
  13755. }
  13756. // Hook needed; redefine it so that the support test is not executed again.
  13757. return ( this.get = hookFn ).apply( this, arguments );
  13758. }
  13759. };
  13760. }
  13761. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13762. emptyStyle = document.createElement( "div" ).style,
  13763. vendorProps = {};
  13764. // Return a vendor-prefixed property or undefined
  13765. function vendorPropName( name ) {
  13766. // Check for vendor prefixed names
  13767. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13768. i = cssPrefixes.length;
  13769. while ( i-- ) {
  13770. name = cssPrefixes[ i ] + capName;
  13771. if ( name in emptyStyle ) {
  13772. return name;
  13773. }
  13774. }
  13775. }
  13776. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13777. function finalPropName( name ) {
  13778. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13779. if ( final ) {
  13780. return final;
  13781. }
  13782. if ( name in emptyStyle ) {
  13783. return name;
  13784. }
  13785. return vendorProps[ name ] = vendorPropName( name ) || name;
  13786. }
  13787. var
  13788. // Swappable if display is none or starts with table
  13789. // except "table", "table-cell", or "table-caption"
  13790. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13791. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13792. rcustomProp = /^--/,
  13793. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13794. cssNormalTransform = {
  13795. letterSpacing: "0",
  13796. fontWeight: "400"
  13797. };
  13798. function setPositiveNumber( elem, value, subtract ) {
  13799. // Any relative (+/-) values have already been
  13800. // normalized at this point
  13801. var matches = rcssNum.exec( value );
  13802. return matches ?
  13803. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13804. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13805. value;
  13806. }
  13807. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13808. var i = dimension === "width" ? 1 : 0,
  13809. extra = 0,
  13810. delta = 0;
  13811. // Adjustment may not be necessary
  13812. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13813. return 0;
  13814. }
  13815. for ( ; i < 4; i += 2 ) {
  13816. // Both box models exclude margin
  13817. if ( box === "margin" ) {
  13818. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13819. }
  13820. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13821. if ( !isBorderBox ) {
  13822. // Add padding
  13823. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13824. // For "border" or "margin", add border
  13825. if ( box !== "padding" ) {
  13826. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13827. // But still keep track of it otherwise
  13828. } else {
  13829. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13830. }
  13831. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13832. // "padding" or "margin"
  13833. } else {
  13834. // For "content", subtract padding
  13835. if ( box === "content" ) {
  13836. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13837. }
  13838. // For "content" or "padding", subtract border
  13839. if ( box !== "margin" ) {
  13840. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13841. }
  13842. }
  13843. }
  13844. // Account for positive content-box scroll gutter when requested by providing computedVal
  13845. if ( !isBorderBox && computedVal >= 0 ) {
  13846. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13847. // Assuming integer scroll gutter, subtract the rest and round down
  13848. delta += Math.max( 0, Math.ceil(
  13849. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13850. computedVal -
  13851. delta -
  13852. extra -
  13853. 0.5
  13854. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13855. // Use an explicit zero to avoid NaN (gh-3964)
  13856. ) ) || 0;
  13857. }
  13858. return delta;
  13859. }
  13860. function getWidthOrHeight( elem, dimension, extra ) {
  13861. // Start with computed style
  13862. var styles = getStyles( elem ),
  13863. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13864. // Fake content-box until we know it's needed to know the true value.
  13865. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13866. isBorderBox = boxSizingNeeded &&
  13867. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13868. valueIsBorderBox = isBorderBox,
  13869. val = curCSS( elem, dimension, styles ),
  13870. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13871. // Support: Firefox <=54
  13872. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13873. if ( rnumnonpx.test( val ) ) {
  13874. if ( !extra ) {
  13875. return val;
  13876. }
  13877. val = "auto";
  13878. }
  13879. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13880. // This happens for inline elements with no explicit setting (gh-3571)
  13881. // Support: Android <=4.1 - 4.3 only
  13882. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13883. // Support: IE 9-11 only
  13884. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13885. // We use getClientRects() to check for hidden/disconnected.
  13886. // In those cases, the computed value can be trusted to be border-box
  13887. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13888. val === "auto" ||
  13889. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13890. elem.getClientRects().length ) {
  13891. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13892. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13893. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13894. // retrieved value as a content box dimension.
  13895. valueIsBorderBox = offsetProp in elem;
  13896. if ( valueIsBorderBox ) {
  13897. val = elem[ offsetProp ];
  13898. }
  13899. }
  13900. // Normalize "" and auto
  13901. val = parseFloat( val ) || 0;
  13902. // Adjust for the element's box model
  13903. return ( val +
  13904. boxModelAdjustment(
  13905. elem,
  13906. dimension,
  13907. extra || ( isBorderBox ? "border" : "content" ),
  13908. valueIsBorderBox,
  13909. styles,
  13910. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13911. val
  13912. )
  13913. ) + "px";
  13914. }
  13915. jQuery.extend( {
  13916. // Add in style property hooks for overriding the default
  13917. // behavior of getting and setting a style property
  13918. cssHooks: {
  13919. opacity: {
  13920. get: function( elem, computed ) {
  13921. if ( computed ) {
  13922. // We should always get a number back from opacity
  13923. var ret = curCSS( elem, "opacity" );
  13924. return ret === "" ? "1" : ret;
  13925. }
  13926. }
  13927. }
  13928. },
  13929. // Don't automatically add "px" to these possibly-unitless properties
  13930. cssNumber: {
  13931. "animationIterationCount": true,
  13932. "columnCount": true,
  13933. "fillOpacity": true,
  13934. "flexGrow": true,
  13935. "flexShrink": true,
  13936. "fontWeight": true,
  13937. "gridArea": true,
  13938. "gridColumn": true,
  13939. "gridColumnEnd": true,
  13940. "gridColumnStart": true,
  13941. "gridRow": true,
  13942. "gridRowEnd": true,
  13943. "gridRowStart": true,
  13944. "lineHeight": true,
  13945. "opacity": true,
  13946. "order": true,
  13947. "orphans": true,
  13948. "widows": true,
  13949. "zIndex": true,
  13950. "zoom": true
  13951. },
  13952. // Add in properties whose names you wish to fix before
  13953. // setting or getting the value
  13954. cssProps: {},
  13955. // Get and set the style property on a DOM Node
  13956. style: function( elem, name, value, extra ) {
  13957. // Don't set styles on text and comment nodes
  13958. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13959. return;
  13960. }
  13961. // Make sure that we're working with the right name
  13962. var ret, type, hooks,
  13963. origName = camelCase( name ),
  13964. isCustomProp = rcustomProp.test( name ),
  13965. style = elem.style;
  13966. // Make sure that we're working with the right name. We don't
  13967. // want to query the value if it is a CSS custom property
  13968. // since they are user-defined.
  13969. if ( !isCustomProp ) {
  13970. name = finalPropName( origName );
  13971. }
  13972. // Gets hook for the prefixed version, then unprefixed version
  13973. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13974. // Check if we're setting a value
  13975. if ( value !== undefined ) {
  13976. type = typeof value;
  13977. // Convert "+=" or "-=" to relative numbers (#7345)
  13978. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13979. value = adjustCSS( elem, name, ret );
  13980. // Fixes bug #9237
  13981. type = "number";
  13982. }
  13983. // Make sure that null and NaN values aren't set (#7116)
  13984. if ( value == null || value !== value ) {
  13985. return;
  13986. }
  13987. // If a number was passed in, add the unit (except for certain CSS properties)
  13988. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13989. // "px" to a few hardcoded values.
  13990. if ( type === "number" && !isCustomProp ) {
  13991. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13992. }
  13993. // background-* props affect original clone's values
  13994. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13995. style[ name ] = "inherit";
  13996. }
  13997. // If a hook was provided, use that value, otherwise just set the specified value
  13998. if ( !hooks || !( "set" in hooks ) ||
  13999. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14000. if ( isCustomProp ) {
  14001. style.setProperty( name, value );
  14002. } else {
  14003. style[ name ] = value;
  14004. }
  14005. }
  14006. } else {
  14007. // If a hook was provided get the non-computed value from there
  14008. if ( hooks && "get" in hooks &&
  14009. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14010. return ret;
  14011. }
  14012. // Otherwise just get the value from the style object
  14013. return style[ name ];
  14014. }
  14015. },
  14016. css: function( elem, name, extra, styles ) {
  14017. var val, num, hooks,
  14018. origName = camelCase( name ),
  14019. isCustomProp = rcustomProp.test( name );
  14020. // Make sure that we're working with the right name. We don't
  14021. // want to modify the value if it is a CSS custom property
  14022. // since they are user-defined.
  14023. if ( !isCustomProp ) {
  14024. name = finalPropName( origName );
  14025. }
  14026. // Try prefixed name followed by the unprefixed name
  14027. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14028. // If a hook was provided get the computed value from there
  14029. if ( hooks && "get" in hooks ) {
  14030. val = hooks.get( elem, true, extra );
  14031. }
  14032. // Otherwise, if a way to get the computed value exists, use that
  14033. if ( val === undefined ) {
  14034. val = curCSS( elem, name, styles );
  14035. }
  14036. // Convert "normal" to computed value
  14037. if ( val === "normal" && name in cssNormalTransform ) {
  14038. val = cssNormalTransform[ name ];
  14039. }
  14040. // Make numeric if forced or a qualifier was provided and val looks numeric
  14041. if ( extra === "" || extra ) {
  14042. num = parseFloat( val );
  14043. return extra === true || isFinite( num ) ? num || 0 : val;
  14044. }
  14045. return val;
  14046. }
  14047. } );
  14048. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14049. jQuery.cssHooks[ dimension ] = {
  14050. get: function( elem, computed, extra ) {
  14051. if ( computed ) {
  14052. // Certain elements can have dimension info if we invisibly show them
  14053. // but it must have a current display style that would benefit
  14054. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14055. // Support: Safari 8+
  14056. // Table columns in Safari have non-zero offsetWidth & zero
  14057. // getBoundingClientRect().width unless display is changed.
  14058. // Support: IE <=11 only
  14059. // Running getBoundingClientRect on a disconnected node
  14060. // in IE throws an error.
  14061. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14062. swap( elem, cssShow, function() {
  14063. return getWidthOrHeight( elem, dimension, extra );
  14064. } ) :
  14065. getWidthOrHeight( elem, dimension, extra );
  14066. }
  14067. },
  14068. set: function( elem, value, extra ) {
  14069. var matches,
  14070. styles = getStyles( elem ),
  14071. // Only read styles.position if the test has a chance to fail
  14072. // to avoid forcing a reflow.
  14073. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14074. styles.position === "absolute",
  14075. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14076. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14077. isBorderBox = boxSizingNeeded &&
  14078. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14079. subtract = extra ?
  14080. boxModelAdjustment(
  14081. elem,
  14082. dimension,
  14083. extra,
  14084. isBorderBox,
  14085. styles
  14086. ) :
  14087. 0;
  14088. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14089. // faking a content-box to get border and padding (gh-3699)
  14090. if ( isBorderBox && scrollboxSizeBuggy ) {
  14091. subtract -= Math.ceil(
  14092. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14093. parseFloat( styles[ dimension ] ) -
  14094. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14095. 0.5
  14096. );
  14097. }
  14098. // Convert to pixels if value adjustment is needed
  14099. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14100. ( matches[ 3 ] || "px" ) !== "px" ) {
  14101. elem.style[ dimension ] = value;
  14102. value = jQuery.css( elem, dimension );
  14103. }
  14104. return setPositiveNumber( elem, value, subtract );
  14105. }
  14106. };
  14107. } );
  14108. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14109. function( elem, computed ) {
  14110. if ( computed ) {
  14111. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14112. elem.getBoundingClientRect().left -
  14113. swap( elem, { marginLeft: 0 }, function() {
  14114. return elem.getBoundingClientRect().left;
  14115. } )
  14116. ) + "px";
  14117. }
  14118. }
  14119. );
  14120. // These hooks are used by animate to expand properties
  14121. jQuery.each( {
  14122. margin: "",
  14123. padding: "",
  14124. border: "Width"
  14125. }, function( prefix, suffix ) {
  14126. jQuery.cssHooks[ prefix + suffix ] = {
  14127. expand: function( value ) {
  14128. var i = 0,
  14129. expanded = {},
  14130. // Assumes a single number if not a string
  14131. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14132. for ( ; i < 4; i++ ) {
  14133. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14134. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14135. }
  14136. return expanded;
  14137. }
  14138. };
  14139. if ( prefix !== "margin" ) {
  14140. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14141. }
  14142. } );
  14143. jQuery.fn.extend( {
  14144. css: function( name, value ) {
  14145. return access( this, function( elem, name, value ) {
  14146. var styles, len,
  14147. map = {},
  14148. i = 0;
  14149. if ( Array.isArray( name ) ) {
  14150. styles = getStyles( elem );
  14151. len = name.length;
  14152. for ( ; i < len; i++ ) {
  14153. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14154. }
  14155. return map;
  14156. }
  14157. return value !== undefined ?
  14158. jQuery.style( elem, name, value ) :
  14159. jQuery.css( elem, name );
  14160. }, name, value, arguments.length > 1 );
  14161. }
  14162. } );
  14163. function Tween( elem, options, prop, end, easing ) {
  14164. return new Tween.prototype.init( elem, options, prop, end, easing );
  14165. }
  14166. jQuery.Tween = Tween;
  14167. Tween.prototype = {
  14168. constructor: Tween,
  14169. init: function( elem, options, prop, end, easing, unit ) {
  14170. this.elem = elem;
  14171. this.prop = prop;
  14172. this.easing = easing || jQuery.easing._default;
  14173. this.options = options;
  14174. this.start = this.now = this.cur();
  14175. this.end = end;
  14176. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14177. },
  14178. cur: function() {
  14179. var hooks = Tween.propHooks[ this.prop ];
  14180. return hooks && hooks.get ?
  14181. hooks.get( this ) :
  14182. Tween.propHooks._default.get( this );
  14183. },
  14184. run: function( percent ) {
  14185. var eased,
  14186. hooks = Tween.propHooks[ this.prop ];
  14187. if ( this.options.duration ) {
  14188. this.pos = eased = jQuery.easing[ this.easing ](
  14189. percent, this.options.duration * percent, 0, 1, this.options.duration
  14190. );
  14191. } else {
  14192. this.pos = eased = percent;
  14193. }
  14194. this.now = ( this.end - this.start ) * eased + this.start;
  14195. if ( this.options.step ) {
  14196. this.options.step.call( this.elem, this.now, this );
  14197. }
  14198. if ( hooks && hooks.set ) {
  14199. hooks.set( this );
  14200. } else {
  14201. Tween.propHooks._default.set( this );
  14202. }
  14203. return this;
  14204. }
  14205. };
  14206. Tween.prototype.init.prototype = Tween.prototype;
  14207. Tween.propHooks = {
  14208. _default: {
  14209. get: function( tween ) {
  14210. var result;
  14211. // Use a property on the element directly when it is not a DOM element,
  14212. // or when there is no matching style property that exists.
  14213. if ( tween.elem.nodeType !== 1 ||
  14214. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14215. return tween.elem[ tween.prop ];
  14216. }
  14217. // Passing an empty string as a 3rd parameter to .css will automatically
  14218. // attempt a parseFloat and fallback to a string if the parse fails.
  14219. // Simple values such as "10px" are parsed to Float;
  14220. // complex values such as "rotate(1rad)" are returned as-is.
  14221. result = jQuery.css( tween.elem, tween.prop, "" );
  14222. // Empty strings, null, undefined and "auto" are converted to 0.
  14223. return !result || result === "auto" ? 0 : result;
  14224. },
  14225. set: function( tween ) {
  14226. // Use step hook for back compat.
  14227. // Use cssHook if its there.
  14228. // Use .style if available and use plain properties where available.
  14229. if ( jQuery.fx.step[ tween.prop ] ) {
  14230. jQuery.fx.step[ tween.prop ]( tween );
  14231. } else if ( tween.elem.nodeType === 1 && (
  14232. jQuery.cssHooks[ tween.prop ] ||
  14233. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14234. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14235. } else {
  14236. tween.elem[ tween.prop ] = tween.now;
  14237. }
  14238. }
  14239. }
  14240. };
  14241. // Support: IE <=9 only
  14242. // Panic based approach to setting things on disconnected nodes
  14243. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14244. set: function( tween ) {
  14245. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14246. tween.elem[ tween.prop ] = tween.now;
  14247. }
  14248. }
  14249. };
  14250. jQuery.easing = {
  14251. linear: function( p ) {
  14252. return p;
  14253. },
  14254. swing: function( p ) {
  14255. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14256. },
  14257. _default: "swing"
  14258. };
  14259. jQuery.fx = Tween.prototype.init;
  14260. // Back compat <1.8 extension point
  14261. jQuery.fx.step = {};
  14262. var
  14263. fxNow, inProgress,
  14264. rfxtypes = /^(?:toggle|show|hide)$/,
  14265. rrun = /queueHooks$/;
  14266. function schedule() {
  14267. if ( inProgress ) {
  14268. if ( document.hidden === false && window.requestAnimationFrame ) {
  14269. window.requestAnimationFrame( schedule );
  14270. } else {
  14271. window.setTimeout( schedule, jQuery.fx.interval );
  14272. }
  14273. jQuery.fx.tick();
  14274. }
  14275. }
  14276. // Animations created synchronously will run synchronously
  14277. function createFxNow() {
  14278. window.setTimeout( function() {
  14279. fxNow = undefined;
  14280. } );
  14281. return ( fxNow = Date.now() );
  14282. }
  14283. // Generate parameters to create a standard animation
  14284. function genFx( type, includeWidth ) {
  14285. var which,
  14286. i = 0,
  14287. attrs = { height: type };
  14288. // If we include width, step value is 1 to do all cssExpand values,
  14289. // otherwise step value is 2 to skip over Left and Right
  14290. includeWidth = includeWidth ? 1 : 0;
  14291. for ( ; i < 4; i += 2 - includeWidth ) {
  14292. which = cssExpand[ i ];
  14293. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14294. }
  14295. if ( includeWidth ) {
  14296. attrs.opacity = attrs.width = type;
  14297. }
  14298. return attrs;
  14299. }
  14300. function createTween( value, prop, animation ) {
  14301. var tween,
  14302. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14303. index = 0,
  14304. length = collection.length;
  14305. for ( ; index < length; index++ ) {
  14306. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14307. // We're done with this property
  14308. return tween;
  14309. }
  14310. }
  14311. }
  14312. function defaultPrefilter( elem, props, opts ) {
  14313. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14314. isBox = "width" in props || "height" in props,
  14315. anim = this,
  14316. orig = {},
  14317. style = elem.style,
  14318. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14319. dataShow = dataPriv.get( elem, "fxshow" );
  14320. // Queue-skipping animations hijack the fx hooks
  14321. if ( !opts.queue ) {
  14322. hooks = jQuery._queueHooks( elem, "fx" );
  14323. if ( hooks.unqueued == null ) {
  14324. hooks.unqueued = 0;
  14325. oldfire = hooks.empty.fire;
  14326. hooks.empty.fire = function() {
  14327. if ( !hooks.unqueued ) {
  14328. oldfire();
  14329. }
  14330. };
  14331. }
  14332. hooks.unqueued++;
  14333. anim.always( function() {
  14334. // Ensure the complete handler is called before this completes
  14335. anim.always( function() {
  14336. hooks.unqueued--;
  14337. if ( !jQuery.queue( elem, "fx" ).length ) {
  14338. hooks.empty.fire();
  14339. }
  14340. } );
  14341. } );
  14342. }
  14343. // Detect show/hide animations
  14344. for ( prop in props ) {
  14345. value = props[ prop ];
  14346. if ( rfxtypes.test( value ) ) {
  14347. delete props[ prop ];
  14348. toggle = toggle || value === "toggle";
  14349. if ( value === ( hidden ? "hide" : "show" ) ) {
  14350. // Pretend to be hidden if this is a "show" and
  14351. // there is still data from a stopped show/hide
  14352. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14353. hidden = true;
  14354. // Ignore all other no-op show/hide data
  14355. } else {
  14356. continue;
  14357. }
  14358. }
  14359. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14360. }
  14361. }
  14362. // Bail out if this is a no-op like .hide().hide()
  14363. propTween = !jQuery.isEmptyObject( props );
  14364. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14365. return;
  14366. }
  14367. // Restrict "overflow" and "display" styles during box animations
  14368. if ( isBox && elem.nodeType === 1 ) {
  14369. // Support: IE <=9 - 11, Edge 12 - 15
  14370. // Record all 3 overflow attributes because IE does not infer the shorthand
  14371. // from identically-valued overflowX and overflowY and Edge just mirrors
  14372. // the overflowX value there.
  14373. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14374. // Identify a display type, preferring old show/hide data over the CSS cascade
  14375. restoreDisplay = dataShow && dataShow.display;
  14376. if ( restoreDisplay == null ) {
  14377. restoreDisplay = dataPriv.get( elem, "display" );
  14378. }
  14379. display = jQuery.css( elem, "display" );
  14380. if ( display === "none" ) {
  14381. if ( restoreDisplay ) {
  14382. display = restoreDisplay;
  14383. } else {
  14384. // Get nonempty value(s) by temporarily forcing visibility
  14385. showHide( [ elem ], true );
  14386. restoreDisplay = elem.style.display || restoreDisplay;
  14387. display = jQuery.css( elem, "display" );
  14388. showHide( [ elem ] );
  14389. }
  14390. }
  14391. // Animate inline elements as inline-block
  14392. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14393. if ( jQuery.css( elem, "float" ) === "none" ) {
  14394. // Restore the original display value at the end of pure show/hide animations
  14395. if ( !propTween ) {
  14396. anim.done( function() {
  14397. style.display = restoreDisplay;
  14398. } );
  14399. if ( restoreDisplay == null ) {
  14400. display = style.display;
  14401. restoreDisplay = display === "none" ? "" : display;
  14402. }
  14403. }
  14404. style.display = "inline-block";
  14405. }
  14406. }
  14407. }
  14408. if ( opts.overflow ) {
  14409. style.overflow = "hidden";
  14410. anim.always( function() {
  14411. style.overflow = opts.overflow[ 0 ];
  14412. style.overflowX = opts.overflow[ 1 ];
  14413. style.overflowY = opts.overflow[ 2 ];
  14414. } );
  14415. }
  14416. // Implement show/hide animations
  14417. propTween = false;
  14418. for ( prop in orig ) {
  14419. // General show/hide setup for this element animation
  14420. if ( !propTween ) {
  14421. if ( dataShow ) {
  14422. if ( "hidden" in dataShow ) {
  14423. hidden = dataShow.hidden;
  14424. }
  14425. } else {
  14426. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14427. }
  14428. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14429. if ( toggle ) {
  14430. dataShow.hidden = !hidden;
  14431. }
  14432. // Show elements before animating them
  14433. if ( hidden ) {
  14434. showHide( [ elem ], true );
  14435. }
  14436. /* eslint-disable no-loop-func */
  14437. anim.done( function() {
  14438. /* eslint-enable no-loop-func */
  14439. // The final step of a "hide" animation is actually hiding the element
  14440. if ( !hidden ) {
  14441. showHide( [ elem ] );
  14442. }
  14443. dataPriv.remove( elem, "fxshow" );
  14444. for ( prop in orig ) {
  14445. jQuery.style( elem, prop, orig[ prop ] );
  14446. }
  14447. } );
  14448. }
  14449. // Per-property setup
  14450. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14451. if ( !( prop in dataShow ) ) {
  14452. dataShow[ prop ] = propTween.start;
  14453. if ( hidden ) {
  14454. propTween.end = propTween.start;
  14455. propTween.start = 0;
  14456. }
  14457. }
  14458. }
  14459. }
  14460. function propFilter( props, specialEasing ) {
  14461. var index, name, easing, value, hooks;
  14462. // camelCase, specialEasing and expand cssHook pass
  14463. for ( index in props ) {
  14464. name = camelCase( index );
  14465. easing = specialEasing[ name ];
  14466. value = props[ index ];
  14467. if ( Array.isArray( value ) ) {
  14468. easing = value[ 1 ];
  14469. value = props[ index ] = value[ 0 ];
  14470. }
  14471. if ( index !== name ) {
  14472. props[ name ] = value;
  14473. delete props[ index ];
  14474. }
  14475. hooks = jQuery.cssHooks[ name ];
  14476. if ( hooks && "expand" in hooks ) {
  14477. value = hooks.expand( value );
  14478. delete props[ name ];
  14479. // Not quite $.extend, this won't overwrite existing keys.
  14480. // Reusing 'index' because we have the correct "name"
  14481. for ( index in value ) {
  14482. if ( !( index in props ) ) {
  14483. props[ index ] = value[ index ];
  14484. specialEasing[ index ] = easing;
  14485. }
  14486. }
  14487. } else {
  14488. specialEasing[ name ] = easing;
  14489. }
  14490. }
  14491. }
  14492. function Animation( elem, properties, options ) {
  14493. var result,
  14494. stopped,
  14495. index = 0,
  14496. length = Animation.prefilters.length,
  14497. deferred = jQuery.Deferred().always( function() {
  14498. // Don't match elem in the :animated selector
  14499. delete tick.elem;
  14500. } ),
  14501. tick = function() {
  14502. if ( stopped ) {
  14503. return false;
  14504. }
  14505. var currentTime = fxNow || createFxNow(),
  14506. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14507. // Support: Android 2.3 only
  14508. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14509. temp = remaining / animation.duration || 0,
  14510. percent = 1 - temp,
  14511. index = 0,
  14512. length = animation.tweens.length;
  14513. for ( ; index < length; index++ ) {
  14514. animation.tweens[ index ].run( percent );
  14515. }
  14516. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14517. // If there's more to do, yield
  14518. if ( percent < 1 && length ) {
  14519. return remaining;
  14520. }
  14521. // If this was an empty animation, synthesize a final progress notification
  14522. if ( !length ) {
  14523. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14524. }
  14525. // Resolve the animation and report its conclusion
  14526. deferred.resolveWith( elem, [ animation ] );
  14527. return false;
  14528. },
  14529. animation = deferred.promise( {
  14530. elem: elem,
  14531. props: jQuery.extend( {}, properties ),
  14532. opts: jQuery.extend( true, {
  14533. specialEasing: {},
  14534. easing: jQuery.easing._default
  14535. }, options ),
  14536. originalProperties: properties,
  14537. originalOptions: options,
  14538. startTime: fxNow || createFxNow(),
  14539. duration: options.duration,
  14540. tweens: [],
  14541. createTween: function( prop, end ) {
  14542. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14543. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14544. animation.tweens.push( tween );
  14545. return tween;
  14546. },
  14547. stop: function( gotoEnd ) {
  14548. var index = 0,
  14549. // If we are going to the end, we want to run all the tweens
  14550. // otherwise we skip this part
  14551. length = gotoEnd ? animation.tweens.length : 0;
  14552. if ( stopped ) {
  14553. return this;
  14554. }
  14555. stopped = true;
  14556. for ( ; index < length; index++ ) {
  14557. animation.tweens[ index ].run( 1 );
  14558. }
  14559. // Resolve when we played the last frame; otherwise, reject
  14560. if ( gotoEnd ) {
  14561. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14562. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14563. } else {
  14564. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14565. }
  14566. return this;
  14567. }
  14568. } ),
  14569. props = animation.props;
  14570. propFilter( props, animation.opts.specialEasing );
  14571. for ( ; index < length; index++ ) {
  14572. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14573. if ( result ) {
  14574. if ( isFunction( result.stop ) ) {
  14575. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14576. result.stop.bind( result );
  14577. }
  14578. return result;
  14579. }
  14580. }
  14581. jQuery.map( props, createTween, animation );
  14582. if ( isFunction( animation.opts.start ) ) {
  14583. animation.opts.start.call( elem, animation );
  14584. }
  14585. // Attach callbacks from options
  14586. animation
  14587. .progress( animation.opts.progress )
  14588. .done( animation.opts.done, animation.opts.complete )
  14589. .fail( animation.opts.fail )
  14590. .always( animation.opts.always );
  14591. jQuery.fx.timer(
  14592. jQuery.extend( tick, {
  14593. elem: elem,
  14594. anim: animation,
  14595. queue: animation.opts.queue
  14596. } )
  14597. );
  14598. return animation;
  14599. }
  14600. jQuery.Animation = jQuery.extend( Animation, {
  14601. tweeners: {
  14602. "*": [ function( prop, value ) {
  14603. var tween = this.createTween( prop, value );
  14604. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14605. return tween;
  14606. } ]
  14607. },
  14608. tweener: function( props, callback ) {
  14609. if ( isFunction( props ) ) {
  14610. callback = props;
  14611. props = [ "*" ];
  14612. } else {
  14613. props = props.match( rnothtmlwhite );
  14614. }
  14615. var prop,
  14616. index = 0,
  14617. length = props.length;
  14618. for ( ; index < length; index++ ) {
  14619. prop = props[ index ];
  14620. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14621. Animation.tweeners[ prop ].unshift( callback );
  14622. }
  14623. },
  14624. prefilters: [ defaultPrefilter ],
  14625. prefilter: function( callback, prepend ) {
  14626. if ( prepend ) {
  14627. Animation.prefilters.unshift( callback );
  14628. } else {
  14629. Animation.prefilters.push( callback );
  14630. }
  14631. }
  14632. } );
  14633. jQuery.speed = function( speed, easing, fn ) {
  14634. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14635. complete: fn || !fn && easing ||
  14636. isFunction( speed ) && speed,
  14637. duration: speed,
  14638. easing: fn && easing || easing && !isFunction( easing ) && easing
  14639. };
  14640. // Go to the end state if fx are off
  14641. if ( jQuery.fx.off ) {
  14642. opt.duration = 0;
  14643. } else {
  14644. if ( typeof opt.duration !== "number" ) {
  14645. if ( opt.duration in jQuery.fx.speeds ) {
  14646. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14647. } else {
  14648. opt.duration = jQuery.fx.speeds._default;
  14649. }
  14650. }
  14651. }
  14652. // Normalize opt.queue - true/undefined/null -> "fx"
  14653. if ( opt.queue == null || opt.queue === true ) {
  14654. opt.queue = "fx";
  14655. }
  14656. // Queueing
  14657. opt.old = opt.complete;
  14658. opt.complete = function() {
  14659. if ( isFunction( opt.old ) ) {
  14660. opt.old.call( this );
  14661. }
  14662. if ( opt.queue ) {
  14663. jQuery.dequeue( this, opt.queue );
  14664. }
  14665. };
  14666. return opt;
  14667. };
  14668. jQuery.fn.extend( {
  14669. fadeTo: function( speed, to, easing, callback ) {
  14670. // Show any hidden elements after setting opacity to 0
  14671. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14672. // Animate to the value specified
  14673. .end().animate( { opacity: to }, speed, easing, callback );
  14674. },
  14675. animate: function( prop, speed, easing, callback ) {
  14676. var empty = jQuery.isEmptyObject( prop ),
  14677. optall = jQuery.speed( speed, easing, callback ),
  14678. doAnimation = function() {
  14679. // Operate on a copy of prop so per-property easing won't be lost
  14680. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14681. // Empty animations, or finishing resolves immediately
  14682. if ( empty || dataPriv.get( this, "finish" ) ) {
  14683. anim.stop( true );
  14684. }
  14685. };
  14686. doAnimation.finish = doAnimation;
  14687. return empty || optall.queue === false ?
  14688. this.each( doAnimation ) :
  14689. this.queue( optall.queue, doAnimation );
  14690. },
  14691. stop: function( type, clearQueue, gotoEnd ) {
  14692. var stopQueue = function( hooks ) {
  14693. var stop = hooks.stop;
  14694. delete hooks.stop;
  14695. stop( gotoEnd );
  14696. };
  14697. if ( typeof type !== "string" ) {
  14698. gotoEnd = clearQueue;
  14699. clearQueue = type;
  14700. type = undefined;
  14701. }
  14702. if ( clearQueue && type !== false ) {
  14703. this.queue( type || "fx", [] );
  14704. }
  14705. return this.each( function() {
  14706. var dequeue = true,
  14707. index = type != null && type + "queueHooks",
  14708. timers = jQuery.timers,
  14709. data = dataPriv.get( this );
  14710. if ( index ) {
  14711. if ( data[ index ] && data[ index ].stop ) {
  14712. stopQueue( data[ index ] );
  14713. }
  14714. } else {
  14715. for ( index in data ) {
  14716. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14717. stopQueue( data[ index ] );
  14718. }
  14719. }
  14720. }
  14721. for ( index = timers.length; index--; ) {
  14722. if ( timers[ index ].elem === this &&
  14723. ( type == null || timers[ index ].queue === type ) ) {
  14724. timers[ index ].anim.stop( gotoEnd );
  14725. dequeue = false;
  14726. timers.splice( index, 1 );
  14727. }
  14728. }
  14729. // Start the next in the queue if the last step wasn't forced.
  14730. // Timers currently will call their complete callbacks, which
  14731. // will dequeue but only if they were gotoEnd.
  14732. if ( dequeue || !gotoEnd ) {
  14733. jQuery.dequeue( this, type );
  14734. }
  14735. } );
  14736. },
  14737. finish: function( type ) {
  14738. if ( type !== false ) {
  14739. type = type || "fx";
  14740. }
  14741. return this.each( function() {
  14742. var index,
  14743. data = dataPriv.get( this ),
  14744. queue = data[ type + "queue" ],
  14745. hooks = data[ type + "queueHooks" ],
  14746. timers = jQuery.timers,
  14747. length = queue ? queue.length : 0;
  14748. // Enable finishing flag on private data
  14749. data.finish = true;
  14750. // Empty the queue first
  14751. jQuery.queue( this, type, [] );
  14752. if ( hooks && hooks.stop ) {
  14753. hooks.stop.call( this, true );
  14754. }
  14755. // Look for any active animations, and finish them
  14756. for ( index = timers.length; index--; ) {
  14757. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14758. timers[ index ].anim.stop( true );
  14759. timers.splice( index, 1 );
  14760. }
  14761. }
  14762. // Look for any animations in the old queue and finish them
  14763. for ( index = 0; index < length; index++ ) {
  14764. if ( queue[ index ] && queue[ index ].finish ) {
  14765. queue[ index ].finish.call( this );
  14766. }
  14767. }
  14768. // Turn off finishing flag
  14769. delete data.finish;
  14770. } );
  14771. }
  14772. } );
  14773. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14774. var cssFn = jQuery.fn[ name ];
  14775. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14776. return speed == null || typeof speed === "boolean" ?
  14777. cssFn.apply( this, arguments ) :
  14778. this.animate( genFx( name, true ), speed, easing, callback );
  14779. };
  14780. } );
  14781. // Generate shortcuts for custom animations
  14782. jQuery.each( {
  14783. slideDown: genFx( "show" ),
  14784. slideUp: genFx( "hide" ),
  14785. slideToggle: genFx( "toggle" ),
  14786. fadeIn: { opacity: "show" },
  14787. fadeOut: { opacity: "hide" },
  14788. fadeToggle: { opacity: "toggle" }
  14789. }, function( name, props ) {
  14790. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14791. return this.animate( props, speed, easing, callback );
  14792. };
  14793. } );
  14794. jQuery.timers = [];
  14795. jQuery.fx.tick = function() {
  14796. var timer,
  14797. i = 0,
  14798. timers = jQuery.timers;
  14799. fxNow = Date.now();
  14800. for ( ; i < timers.length; i++ ) {
  14801. timer = timers[ i ];
  14802. // Run the timer and safely remove it when done (allowing for external removal)
  14803. if ( !timer() && timers[ i ] === timer ) {
  14804. timers.splice( i--, 1 );
  14805. }
  14806. }
  14807. if ( !timers.length ) {
  14808. jQuery.fx.stop();
  14809. }
  14810. fxNow = undefined;
  14811. };
  14812. jQuery.fx.timer = function( timer ) {
  14813. jQuery.timers.push( timer );
  14814. jQuery.fx.start();
  14815. };
  14816. jQuery.fx.interval = 13;
  14817. jQuery.fx.start = function() {
  14818. if ( inProgress ) {
  14819. return;
  14820. }
  14821. inProgress = true;
  14822. schedule();
  14823. };
  14824. jQuery.fx.stop = function() {
  14825. inProgress = null;
  14826. };
  14827. jQuery.fx.speeds = {
  14828. slow: 600,
  14829. fast: 200,
  14830. // Default speed
  14831. _default: 400
  14832. };
  14833. // Based off of the plugin by Clint Helfers, with permission.
  14834. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14835. jQuery.fn.delay = function( time, type ) {
  14836. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14837. type = type || "fx";
  14838. return this.queue( type, function( next, hooks ) {
  14839. var timeout = window.setTimeout( next, time );
  14840. hooks.stop = function() {
  14841. window.clearTimeout( timeout );
  14842. };
  14843. } );
  14844. };
  14845. ( function() {
  14846. var input = document.createElement( "input" ),
  14847. select = document.createElement( "select" ),
  14848. opt = select.appendChild( document.createElement( "option" ) );
  14849. input.type = "checkbox";
  14850. // Support: Android <=4.3 only
  14851. // Default value for a checkbox should be "on"
  14852. support.checkOn = input.value !== "";
  14853. // Support: IE <=11 only
  14854. // Must access selectedIndex to make default options select
  14855. support.optSelected = opt.selected;
  14856. // Support: IE <=11 only
  14857. // An input loses its value after becoming a radio
  14858. input = document.createElement( "input" );
  14859. input.value = "t";
  14860. input.type = "radio";
  14861. support.radioValue = input.value === "t";
  14862. } )();
  14863. var boolHook,
  14864. attrHandle = jQuery.expr.attrHandle;
  14865. jQuery.fn.extend( {
  14866. attr: function( name, value ) {
  14867. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14868. },
  14869. removeAttr: function( name ) {
  14870. return this.each( function() {
  14871. jQuery.removeAttr( this, name );
  14872. } );
  14873. }
  14874. } );
  14875. jQuery.extend( {
  14876. attr: function( elem, name, value ) {
  14877. var ret, hooks,
  14878. nType = elem.nodeType;
  14879. // Don't get/set attributes on text, comment and attribute nodes
  14880. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14881. return;
  14882. }
  14883. // Fallback to prop when attributes are not supported
  14884. if ( typeof elem.getAttribute === "undefined" ) {
  14885. return jQuery.prop( elem, name, value );
  14886. }
  14887. // Attribute hooks are determined by the lowercase version
  14888. // Grab necessary hook if one is defined
  14889. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14890. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14891. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14892. }
  14893. if ( value !== undefined ) {
  14894. if ( value === null ) {
  14895. jQuery.removeAttr( elem, name );
  14896. return;
  14897. }
  14898. if ( hooks && "set" in hooks &&
  14899. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14900. return ret;
  14901. }
  14902. elem.setAttribute( name, value + "" );
  14903. return value;
  14904. }
  14905. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14906. return ret;
  14907. }
  14908. ret = jQuery.find.attr( elem, name );
  14909. // Non-existent attributes return null, we normalize to undefined
  14910. return ret == null ? undefined : ret;
  14911. },
  14912. attrHooks: {
  14913. type: {
  14914. set: function( elem, value ) {
  14915. if ( !support.radioValue && value === "radio" &&
  14916. nodeName( elem, "input" ) ) {
  14917. var val = elem.value;
  14918. elem.setAttribute( "type", value );
  14919. if ( val ) {
  14920. elem.value = val;
  14921. }
  14922. return value;
  14923. }
  14924. }
  14925. }
  14926. },
  14927. removeAttr: function( elem, value ) {
  14928. var name,
  14929. i = 0,
  14930. // Attribute names can contain non-HTML whitespace characters
  14931. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14932. attrNames = value && value.match( rnothtmlwhite );
  14933. if ( attrNames && elem.nodeType === 1 ) {
  14934. while ( ( name = attrNames[ i++ ] ) ) {
  14935. elem.removeAttribute( name );
  14936. }
  14937. }
  14938. }
  14939. } );
  14940. // Hooks for boolean attributes
  14941. boolHook = {
  14942. set: function( elem, value, name ) {
  14943. if ( value === false ) {
  14944. // Remove boolean attributes when set to false
  14945. jQuery.removeAttr( elem, name );
  14946. } else {
  14947. elem.setAttribute( name, name );
  14948. }
  14949. return name;
  14950. }
  14951. };
  14952. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14953. var getter = attrHandle[ name ] || jQuery.find.attr;
  14954. attrHandle[ name ] = function( elem, name, isXML ) {
  14955. var ret, handle,
  14956. lowercaseName = name.toLowerCase();
  14957. if ( !isXML ) {
  14958. // Avoid an infinite loop by temporarily removing this function from the getter
  14959. handle = attrHandle[ lowercaseName ];
  14960. attrHandle[ lowercaseName ] = ret;
  14961. ret = getter( elem, name, isXML ) != null ?
  14962. lowercaseName :
  14963. null;
  14964. attrHandle[ lowercaseName ] = handle;
  14965. }
  14966. return ret;
  14967. };
  14968. } );
  14969. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14970. rclickable = /^(?:a|area)$/i;
  14971. jQuery.fn.extend( {
  14972. prop: function( name, value ) {
  14973. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14974. },
  14975. removeProp: function( name ) {
  14976. return this.each( function() {
  14977. delete this[ jQuery.propFix[ name ] || name ];
  14978. } );
  14979. }
  14980. } );
  14981. jQuery.extend( {
  14982. prop: function( elem, name, value ) {
  14983. var ret, hooks,
  14984. nType = elem.nodeType;
  14985. // Don't get/set properties on text, comment and attribute nodes
  14986. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14987. return;
  14988. }
  14989. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14990. // Fix name and attach hooks
  14991. name = jQuery.propFix[ name ] || name;
  14992. hooks = jQuery.propHooks[ name ];
  14993. }
  14994. if ( value !== undefined ) {
  14995. if ( hooks && "set" in hooks &&
  14996. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14997. return ret;
  14998. }
  14999. return ( elem[ name ] = value );
  15000. }
  15001. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15002. return ret;
  15003. }
  15004. return elem[ name ];
  15005. },
  15006. propHooks: {
  15007. tabIndex: {
  15008. get: function( elem ) {
  15009. // Support: IE <=9 - 11 only
  15010. // elem.tabIndex doesn't always return the
  15011. // correct value when it hasn't been explicitly set
  15012. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15013. // Use proper attribute retrieval(#12072)
  15014. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15015. if ( tabindex ) {
  15016. return parseInt( tabindex, 10 );
  15017. }
  15018. if (
  15019. rfocusable.test( elem.nodeName ) ||
  15020. rclickable.test( elem.nodeName ) &&
  15021. elem.href
  15022. ) {
  15023. return 0;
  15024. }
  15025. return -1;
  15026. }
  15027. }
  15028. },
  15029. propFix: {
  15030. "for": "htmlFor",
  15031. "class": "className"
  15032. }
  15033. } );
  15034. // Support: IE <=11 only
  15035. // Accessing the selectedIndex property
  15036. // forces the browser to respect setting selected
  15037. // on the option
  15038. // The getter ensures a default option is selected
  15039. // when in an optgroup
  15040. // eslint rule "no-unused-expressions" is disabled for this code
  15041. // since it considers such accessions noop
  15042. if ( !support.optSelected ) {
  15043. jQuery.propHooks.selected = {
  15044. get: function( elem ) {
  15045. /* eslint no-unused-expressions: "off" */
  15046. var parent = elem.parentNode;
  15047. if ( parent && parent.parentNode ) {
  15048. parent.parentNode.selectedIndex;
  15049. }
  15050. return null;
  15051. },
  15052. set: function( elem ) {
  15053. /* eslint no-unused-expressions: "off" */
  15054. var parent = elem.parentNode;
  15055. if ( parent ) {
  15056. parent.selectedIndex;
  15057. if ( parent.parentNode ) {
  15058. parent.parentNode.selectedIndex;
  15059. }
  15060. }
  15061. }
  15062. };
  15063. }
  15064. jQuery.each( [
  15065. "tabIndex",
  15066. "readOnly",
  15067. "maxLength",
  15068. "cellSpacing",
  15069. "cellPadding",
  15070. "rowSpan",
  15071. "colSpan",
  15072. "useMap",
  15073. "frameBorder",
  15074. "contentEditable"
  15075. ], function() {
  15076. jQuery.propFix[ this.toLowerCase() ] = this;
  15077. } );
  15078. // Strip and collapse whitespace according to HTML spec
  15079. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15080. function stripAndCollapse( value ) {
  15081. var tokens = value.match( rnothtmlwhite ) || [];
  15082. return tokens.join( " " );
  15083. }
  15084. function getClass( elem ) {
  15085. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15086. }
  15087. function classesToArray( value ) {
  15088. if ( Array.isArray( value ) ) {
  15089. return value;
  15090. }
  15091. if ( typeof value === "string" ) {
  15092. return value.match( rnothtmlwhite ) || [];
  15093. }
  15094. return [];
  15095. }
  15096. jQuery.fn.extend( {
  15097. addClass: function( value ) {
  15098. var classes, elem, cur, curValue, clazz, j, finalValue,
  15099. i = 0;
  15100. if ( isFunction( value ) ) {
  15101. return this.each( function( j ) {
  15102. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15103. } );
  15104. }
  15105. classes = classesToArray( value );
  15106. if ( classes.length ) {
  15107. while ( ( elem = this[ i++ ] ) ) {
  15108. curValue = getClass( elem );
  15109. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15110. if ( cur ) {
  15111. j = 0;
  15112. while ( ( clazz = classes[ j++ ] ) ) {
  15113. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15114. cur += clazz + " ";
  15115. }
  15116. }
  15117. // Only assign if different to avoid unneeded rendering.
  15118. finalValue = stripAndCollapse( cur );
  15119. if ( curValue !== finalValue ) {
  15120. elem.setAttribute( "class", finalValue );
  15121. }
  15122. }
  15123. }
  15124. }
  15125. return this;
  15126. },
  15127. removeClass: function( value ) {
  15128. var classes, elem, cur, curValue, clazz, j, finalValue,
  15129. i = 0;
  15130. if ( isFunction( value ) ) {
  15131. return this.each( function( j ) {
  15132. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15133. } );
  15134. }
  15135. if ( !arguments.length ) {
  15136. return this.attr( "class", "" );
  15137. }
  15138. classes = classesToArray( value );
  15139. if ( classes.length ) {
  15140. while ( ( elem = this[ i++ ] ) ) {
  15141. curValue = getClass( elem );
  15142. // This expression is here for better compressibility (see addClass)
  15143. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15144. if ( cur ) {
  15145. j = 0;
  15146. while ( ( clazz = classes[ j++ ] ) ) {
  15147. // Remove *all* instances
  15148. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15149. cur = cur.replace( " " + clazz + " ", " " );
  15150. }
  15151. }
  15152. // Only assign if different to avoid unneeded rendering.
  15153. finalValue = stripAndCollapse( cur );
  15154. if ( curValue !== finalValue ) {
  15155. elem.setAttribute( "class", finalValue );
  15156. }
  15157. }
  15158. }
  15159. }
  15160. return this;
  15161. },
  15162. toggleClass: function( value, stateVal ) {
  15163. var type = typeof value,
  15164. isValidValue = type === "string" || Array.isArray( value );
  15165. if ( typeof stateVal === "boolean" && isValidValue ) {
  15166. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15167. }
  15168. if ( isFunction( value ) ) {
  15169. return this.each( function( i ) {
  15170. jQuery( this ).toggleClass(
  15171. value.call( this, i, getClass( this ), stateVal ),
  15172. stateVal
  15173. );
  15174. } );
  15175. }
  15176. return this.each( function() {
  15177. var className, i, self, classNames;
  15178. if ( isValidValue ) {
  15179. // Toggle individual class names
  15180. i = 0;
  15181. self = jQuery( this );
  15182. classNames = classesToArray( value );
  15183. while ( ( className = classNames[ i++ ] ) ) {
  15184. // Check each className given, space separated list
  15185. if ( self.hasClass( className ) ) {
  15186. self.removeClass( className );
  15187. } else {
  15188. self.addClass( className );
  15189. }
  15190. }
  15191. // Toggle whole class name
  15192. } else if ( value === undefined || type === "boolean" ) {
  15193. className = getClass( this );
  15194. if ( className ) {
  15195. // Store className if set
  15196. dataPriv.set( this, "__className__", className );
  15197. }
  15198. // If the element has a class name or if we're passed `false`,
  15199. // then remove the whole classname (if there was one, the above saved it).
  15200. // Otherwise bring back whatever was previously saved (if anything),
  15201. // falling back to the empty string if nothing was stored.
  15202. if ( this.setAttribute ) {
  15203. this.setAttribute( "class",
  15204. className || value === false ?
  15205. "" :
  15206. dataPriv.get( this, "__className__" ) || ""
  15207. );
  15208. }
  15209. }
  15210. } );
  15211. },
  15212. hasClass: function( selector ) {
  15213. var className, elem,
  15214. i = 0;
  15215. className = " " + selector + " ";
  15216. while ( ( elem = this[ i++ ] ) ) {
  15217. if ( elem.nodeType === 1 &&
  15218. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15219. return true;
  15220. }
  15221. }
  15222. return false;
  15223. }
  15224. } );
  15225. var rreturn = /\r/g;
  15226. jQuery.fn.extend( {
  15227. val: function( value ) {
  15228. var hooks, ret, valueIsFunction,
  15229. elem = this[ 0 ];
  15230. if ( !arguments.length ) {
  15231. if ( elem ) {
  15232. hooks = jQuery.valHooks[ elem.type ] ||
  15233. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15234. if ( hooks &&
  15235. "get" in hooks &&
  15236. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15237. ) {
  15238. return ret;
  15239. }
  15240. ret = elem.value;
  15241. // Handle most common string cases
  15242. if ( typeof ret === "string" ) {
  15243. return ret.replace( rreturn, "" );
  15244. }
  15245. // Handle cases where value is null/undef or number
  15246. return ret == null ? "" : ret;
  15247. }
  15248. return;
  15249. }
  15250. valueIsFunction = isFunction( value );
  15251. return this.each( function( i ) {
  15252. var val;
  15253. if ( this.nodeType !== 1 ) {
  15254. return;
  15255. }
  15256. if ( valueIsFunction ) {
  15257. val = value.call( this, i, jQuery( this ).val() );
  15258. } else {
  15259. val = value;
  15260. }
  15261. // Treat null/undefined as ""; convert numbers to string
  15262. if ( val == null ) {
  15263. val = "";
  15264. } else if ( typeof val === "number" ) {
  15265. val += "";
  15266. } else if ( Array.isArray( val ) ) {
  15267. val = jQuery.map( val, function( value ) {
  15268. return value == null ? "" : value + "";
  15269. } );
  15270. }
  15271. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15272. // If set returns undefined, fall back to normal setting
  15273. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15274. this.value = val;
  15275. }
  15276. } );
  15277. }
  15278. } );
  15279. jQuery.extend( {
  15280. valHooks: {
  15281. option: {
  15282. get: function( elem ) {
  15283. var val = jQuery.find.attr( elem, "value" );
  15284. return val != null ?
  15285. val :
  15286. // Support: IE <=10 - 11 only
  15287. // option.text throws exceptions (#14686, #14858)
  15288. // Strip and collapse whitespace
  15289. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15290. stripAndCollapse( jQuery.text( elem ) );
  15291. }
  15292. },
  15293. select: {
  15294. get: function( elem ) {
  15295. var value, option, i,
  15296. options = elem.options,
  15297. index = elem.selectedIndex,
  15298. one = elem.type === "select-one",
  15299. values = one ? null : [],
  15300. max = one ? index + 1 : options.length;
  15301. if ( index < 0 ) {
  15302. i = max;
  15303. } else {
  15304. i = one ? index : 0;
  15305. }
  15306. // Loop through all the selected options
  15307. for ( ; i < max; i++ ) {
  15308. option = options[ i ];
  15309. // Support: IE <=9 only
  15310. // IE8-9 doesn't update selected after form reset (#2551)
  15311. if ( ( option.selected || i === index ) &&
  15312. // Don't return options that are disabled or in a disabled optgroup
  15313. !option.disabled &&
  15314. ( !option.parentNode.disabled ||
  15315. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15316. // Get the specific value for the option
  15317. value = jQuery( option ).val();
  15318. // We don't need an array for one selects
  15319. if ( one ) {
  15320. return value;
  15321. }
  15322. // Multi-Selects return an array
  15323. values.push( value );
  15324. }
  15325. }
  15326. return values;
  15327. },
  15328. set: function( elem, value ) {
  15329. var optionSet, option,
  15330. options = elem.options,
  15331. values = jQuery.makeArray( value ),
  15332. i = options.length;
  15333. while ( i-- ) {
  15334. option = options[ i ];
  15335. /* eslint-disable no-cond-assign */
  15336. if ( option.selected =
  15337. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15338. ) {
  15339. optionSet = true;
  15340. }
  15341. /* eslint-enable no-cond-assign */
  15342. }
  15343. // Force browsers to behave consistently when non-matching value is set
  15344. if ( !optionSet ) {
  15345. elem.selectedIndex = -1;
  15346. }
  15347. return values;
  15348. }
  15349. }
  15350. }
  15351. } );
  15352. // Radios and checkboxes getter/setter
  15353. jQuery.each( [ "radio", "checkbox" ], function() {
  15354. jQuery.valHooks[ this ] = {
  15355. set: function( elem, value ) {
  15356. if ( Array.isArray( value ) ) {
  15357. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15358. }
  15359. }
  15360. };
  15361. if ( !support.checkOn ) {
  15362. jQuery.valHooks[ this ].get = function( elem ) {
  15363. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15364. };
  15365. }
  15366. } );
  15367. // Return jQuery for attributes-only inclusion
  15368. support.focusin = "onfocusin" in window;
  15369. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15370. stopPropagationCallback = function( e ) {
  15371. e.stopPropagation();
  15372. };
  15373. jQuery.extend( jQuery.event, {
  15374. trigger: function( event, data, elem, onlyHandlers ) {
  15375. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15376. eventPath = [ elem || document ],
  15377. type = hasOwn.call( event, "type" ) ? event.type : event,
  15378. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15379. cur = lastElement = tmp = elem = elem || document;
  15380. // Don't do events on text and comment nodes
  15381. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15382. return;
  15383. }
  15384. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15385. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15386. return;
  15387. }
  15388. if ( type.indexOf( "." ) > -1 ) {
  15389. // Namespaced trigger; create a regexp to match event type in handle()
  15390. namespaces = type.split( "." );
  15391. type = namespaces.shift();
  15392. namespaces.sort();
  15393. }
  15394. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15395. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15396. event = event[ jQuery.expando ] ?
  15397. event :
  15398. new jQuery.Event( type, typeof event === "object" && event );
  15399. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15400. event.isTrigger = onlyHandlers ? 2 : 3;
  15401. event.namespace = namespaces.join( "." );
  15402. event.rnamespace = event.namespace ?
  15403. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15404. null;
  15405. // Clean up the event in case it is being reused
  15406. event.result = undefined;
  15407. if ( !event.target ) {
  15408. event.target = elem;
  15409. }
  15410. // Clone any incoming data and prepend the event, creating the handler arg list
  15411. data = data == null ?
  15412. [ event ] :
  15413. jQuery.makeArray( data, [ event ] );
  15414. // Allow special events to draw outside the lines
  15415. special = jQuery.event.special[ type ] || {};
  15416. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15417. return;
  15418. }
  15419. // Determine event propagation path in advance, per W3C events spec (#9951)
  15420. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15421. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15422. bubbleType = special.delegateType || type;
  15423. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15424. cur = cur.parentNode;
  15425. }
  15426. for ( ; cur; cur = cur.parentNode ) {
  15427. eventPath.push( cur );
  15428. tmp = cur;
  15429. }
  15430. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15431. if ( tmp === ( elem.ownerDocument || document ) ) {
  15432. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15433. }
  15434. }
  15435. // Fire handlers on the event path
  15436. i = 0;
  15437. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15438. lastElement = cur;
  15439. event.type = i > 1 ?
  15440. bubbleType :
  15441. special.bindType || type;
  15442. // jQuery handler
  15443. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15444. dataPriv.get( cur, "handle" );
  15445. if ( handle ) {
  15446. handle.apply( cur, data );
  15447. }
  15448. // Native handler
  15449. handle = ontype && cur[ ontype ];
  15450. if ( handle && handle.apply && acceptData( cur ) ) {
  15451. event.result = handle.apply( cur, data );
  15452. if ( event.result === false ) {
  15453. event.preventDefault();
  15454. }
  15455. }
  15456. }
  15457. event.type = type;
  15458. // If nobody prevented the default action, do it now
  15459. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15460. if ( ( !special._default ||
  15461. special._default.apply( eventPath.pop(), data ) === false ) &&
  15462. acceptData( elem ) ) {
  15463. // Call a native DOM method on the target with the same name as the event.
  15464. // Don't do default actions on window, that's where global variables be (#6170)
  15465. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15466. // Don't re-trigger an onFOO event when we call its FOO() method
  15467. tmp = elem[ ontype ];
  15468. if ( tmp ) {
  15469. elem[ ontype ] = null;
  15470. }
  15471. // Prevent re-triggering of the same event, since we already bubbled it above
  15472. jQuery.event.triggered = type;
  15473. if ( event.isPropagationStopped() ) {
  15474. lastElement.addEventListener( type, stopPropagationCallback );
  15475. }
  15476. elem[ type ]();
  15477. if ( event.isPropagationStopped() ) {
  15478. lastElement.removeEventListener( type, stopPropagationCallback );
  15479. }
  15480. jQuery.event.triggered = undefined;
  15481. if ( tmp ) {
  15482. elem[ ontype ] = tmp;
  15483. }
  15484. }
  15485. }
  15486. }
  15487. return event.result;
  15488. },
  15489. // Piggyback on a donor event to simulate a different one
  15490. // Used only for `focus(in | out)` events
  15491. simulate: function( type, elem, event ) {
  15492. var e = jQuery.extend(
  15493. new jQuery.Event(),
  15494. event,
  15495. {
  15496. type: type,
  15497. isSimulated: true
  15498. }
  15499. );
  15500. jQuery.event.trigger( e, null, elem );
  15501. }
  15502. } );
  15503. jQuery.fn.extend( {
  15504. trigger: function( type, data ) {
  15505. return this.each( function() {
  15506. jQuery.event.trigger( type, data, this );
  15507. } );
  15508. },
  15509. triggerHandler: function( type, data ) {
  15510. var elem = this[ 0 ];
  15511. if ( elem ) {
  15512. return jQuery.event.trigger( type, data, elem, true );
  15513. }
  15514. }
  15515. } );
  15516. // Support: Firefox <=44
  15517. // Firefox doesn't have focus(in | out) events
  15518. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15519. //
  15520. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15521. // focus(in | out) events fire after focus & blur events,
  15522. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15523. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15524. if ( !support.focusin ) {
  15525. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15526. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15527. var handler = function( event ) {
  15528. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15529. };
  15530. jQuery.event.special[ fix ] = {
  15531. setup: function() {
  15532. var doc = this.ownerDocument || this,
  15533. attaches = dataPriv.access( doc, fix );
  15534. if ( !attaches ) {
  15535. doc.addEventListener( orig, handler, true );
  15536. }
  15537. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15538. },
  15539. teardown: function() {
  15540. var doc = this.ownerDocument || this,
  15541. attaches = dataPriv.access( doc, fix ) - 1;
  15542. if ( !attaches ) {
  15543. doc.removeEventListener( orig, handler, true );
  15544. dataPriv.remove( doc, fix );
  15545. } else {
  15546. dataPriv.access( doc, fix, attaches );
  15547. }
  15548. }
  15549. };
  15550. } );
  15551. }
  15552. var location = window.location;
  15553. var nonce = Date.now();
  15554. var rquery = ( /\?/ );
  15555. // Cross-browser xml parsing
  15556. jQuery.parseXML = function( data ) {
  15557. var xml;
  15558. if ( !data || typeof data !== "string" ) {
  15559. return null;
  15560. }
  15561. // Support: IE 9 - 11 only
  15562. // IE throws on parseFromString with invalid input.
  15563. try {
  15564. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15565. } catch ( e ) {
  15566. xml = undefined;
  15567. }
  15568. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15569. jQuery.error( "Invalid XML: " + data );
  15570. }
  15571. return xml;
  15572. };
  15573. var
  15574. rbracket = /\[\]$/,
  15575. rCRLF = /\r?\n/g,
  15576. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15577. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15578. function buildParams( prefix, obj, traditional, add ) {
  15579. var name;
  15580. if ( Array.isArray( obj ) ) {
  15581. // Serialize array item.
  15582. jQuery.each( obj, function( i, v ) {
  15583. if ( traditional || rbracket.test( prefix ) ) {
  15584. // Treat each array item as a scalar.
  15585. add( prefix, v );
  15586. } else {
  15587. // Item is non-scalar (array or object), encode its numeric index.
  15588. buildParams(
  15589. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15590. v,
  15591. traditional,
  15592. add
  15593. );
  15594. }
  15595. } );
  15596. } else if ( !traditional && toType( obj ) === "object" ) {
  15597. // Serialize object item.
  15598. for ( name in obj ) {
  15599. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15600. }
  15601. } else {
  15602. // Serialize scalar item.
  15603. add( prefix, obj );
  15604. }
  15605. }
  15606. // Serialize an array of form elements or a set of
  15607. // key/values into a query string
  15608. jQuery.param = function( a, traditional ) {
  15609. var prefix,
  15610. s = [],
  15611. add = function( key, valueOrFunction ) {
  15612. // If value is a function, invoke it and use its return value
  15613. var value = isFunction( valueOrFunction ) ?
  15614. valueOrFunction() :
  15615. valueOrFunction;
  15616. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15617. encodeURIComponent( value == null ? "" : value );
  15618. };
  15619. if ( a == null ) {
  15620. return "";
  15621. }
  15622. // If an array was passed in, assume that it is an array of form elements.
  15623. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15624. // Serialize the form elements
  15625. jQuery.each( a, function() {
  15626. add( this.name, this.value );
  15627. } );
  15628. } else {
  15629. // If traditional, encode the "old" way (the way 1.3.2 or older
  15630. // did it), otherwise encode params recursively.
  15631. for ( prefix in a ) {
  15632. buildParams( prefix, a[ prefix ], traditional, add );
  15633. }
  15634. }
  15635. // Return the resulting serialization
  15636. return s.join( "&" );
  15637. };
  15638. jQuery.fn.extend( {
  15639. serialize: function() {
  15640. return jQuery.param( this.serializeArray() );
  15641. },
  15642. serializeArray: function() {
  15643. return this.map( function() {
  15644. // Can add propHook for "elements" to filter or add form elements
  15645. var elements = jQuery.prop( this, "elements" );
  15646. return elements ? jQuery.makeArray( elements ) : this;
  15647. } )
  15648. .filter( function() {
  15649. var type = this.type;
  15650. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15651. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15652. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15653. ( this.checked || !rcheckableType.test( type ) );
  15654. } )
  15655. .map( function( i, elem ) {
  15656. var val = jQuery( this ).val();
  15657. if ( val == null ) {
  15658. return null;
  15659. }
  15660. if ( Array.isArray( val ) ) {
  15661. return jQuery.map( val, function( val ) {
  15662. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15663. } );
  15664. }
  15665. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15666. } ).get();
  15667. }
  15668. } );
  15669. var
  15670. r20 = /%20/g,
  15671. rhash = /#.*$/,
  15672. rantiCache = /([?&])_=[^&]*/,
  15673. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15674. // #7653, #8125, #8152: local protocol detection
  15675. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15676. rnoContent = /^(?:GET|HEAD)$/,
  15677. rprotocol = /^\/\//,
  15678. /* Prefilters
  15679. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15680. * 2) These are called:
  15681. * - BEFORE asking for a transport
  15682. * - AFTER param serialization (s.data is a string if s.processData is true)
  15683. * 3) key is the dataType
  15684. * 4) the catchall symbol "*" can be used
  15685. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15686. */
  15687. prefilters = {},
  15688. /* Transports bindings
  15689. * 1) key is the dataType
  15690. * 2) the catchall symbol "*" can be used
  15691. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15692. */
  15693. transports = {},
  15694. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15695. allTypes = "*/".concat( "*" ),
  15696. // Anchor tag for parsing the document origin
  15697. originAnchor = document.createElement( "a" );
  15698. originAnchor.href = location.href;
  15699. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15700. function addToPrefiltersOrTransports( structure ) {
  15701. // dataTypeExpression is optional and defaults to "*"
  15702. return function( dataTypeExpression, func ) {
  15703. if ( typeof dataTypeExpression !== "string" ) {
  15704. func = dataTypeExpression;
  15705. dataTypeExpression = "*";
  15706. }
  15707. var dataType,
  15708. i = 0,
  15709. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15710. if ( isFunction( func ) ) {
  15711. // For each dataType in the dataTypeExpression
  15712. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15713. // Prepend if requested
  15714. if ( dataType[ 0 ] === "+" ) {
  15715. dataType = dataType.slice( 1 ) || "*";
  15716. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15717. // Otherwise append
  15718. } else {
  15719. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15720. }
  15721. }
  15722. }
  15723. };
  15724. }
  15725. // Base inspection function for prefilters and transports
  15726. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15727. var inspected = {},
  15728. seekingTransport = ( structure === transports );
  15729. function inspect( dataType ) {
  15730. var selected;
  15731. inspected[ dataType ] = true;
  15732. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15733. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15734. if ( typeof dataTypeOrTransport === "string" &&
  15735. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15736. options.dataTypes.unshift( dataTypeOrTransport );
  15737. inspect( dataTypeOrTransport );
  15738. return false;
  15739. } else if ( seekingTransport ) {
  15740. return !( selected = dataTypeOrTransport );
  15741. }
  15742. } );
  15743. return selected;
  15744. }
  15745. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15746. }
  15747. // A special extend for ajax options
  15748. // that takes "flat" options (not to be deep extended)
  15749. // Fixes #9887
  15750. function ajaxExtend( target, src ) {
  15751. var key, deep,
  15752. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15753. for ( key in src ) {
  15754. if ( src[ key ] !== undefined ) {
  15755. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15756. }
  15757. }
  15758. if ( deep ) {
  15759. jQuery.extend( true, target, deep );
  15760. }
  15761. return target;
  15762. }
  15763. /* Handles responses to an ajax request:
  15764. * - finds the right dataType (mediates between content-type and expected dataType)
  15765. * - returns the corresponding response
  15766. */
  15767. function ajaxHandleResponses( s, jqXHR, responses ) {
  15768. var ct, type, finalDataType, firstDataType,
  15769. contents = s.contents,
  15770. dataTypes = s.dataTypes;
  15771. // Remove auto dataType and get content-type in the process
  15772. while ( dataTypes[ 0 ] === "*" ) {
  15773. dataTypes.shift();
  15774. if ( ct === undefined ) {
  15775. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15776. }
  15777. }
  15778. // Check if we're dealing with a known content-type
  15779. if ( ct ) {
  15780. for ( type in contents ) {
  15781. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15782. dataTypes.unshift( type );
  15783. break;
  15784. }
  15785. }
  15786. }
  15787. // Check to see if we have a response for the expected dataType
  15788. if ( dataTypes[ 0 ] in responses ) {
  15789. finalDataType = dataTypes[ 0 ];
  15790. } else {
  15791. // Try convertible dataTypes
  15792. for ( type in responses ) {
  15793. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15794. finalDataType = type;
  15795. break;
  15796. }
  15797. if ( !firstDataType ) {
  15798. firstDataType = type;
  15799. }
  15800. }
  15801. // Or just use first one
  15802. finalDataType = finalDataType || firstDataType;
  15803. }
  15804. // If we found a dataType
  15805. // We add the dataType to the list if needed
  15806. // and return the corresponding response
  15807. if ( finalDataType ) {
  15808. if ( finalDataType !== dataTypes[ 0 ] ) {
  15809. dataTypes.unshift( finalDataType );
  15810. }
  15811. return responses[ finalDataType ];
  15812. }
  15813. }
  15814. /* Chain conversions given the request and the original response
  15815. * Also sets the responseXXX fields on the jqXHR instance
  15816. */
  15817. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15818. var conv2, current, conv, tmp, prev,
  15819. converters = {},
  15820. // Work with a copy of dataTypes in case we need to modify it for conversion
  15821. dataTypes = s.dataTypes.slice();
  15822. // Create converters map with lowercased keys
  15823. if ( dataTypes[ 1 ] ) {
  15824. for ( conv in s.converters ) {
  15825. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15826. }
  15827. }
  15828. current = dataTypes.shift();
  15829. // Convert to each sequential dataType
  15830. while ( current ) {
  15831. if ( s.responseFields[ current ] ) {
  15832. jqXHR[ s.responseFields[ current ] ] = response;
  15833. }
  15834. // Apply the dataFilter if provided
  15835. if ( !prev && isSuccess && s.dataFilter ) {
  15836. response = s.dataFilter( response, s.dataType );
  15837. }
  15838. prev = current;
  15839. current = dataTypes.shift();
  15840. if ( current ) {
  15841. // There's only work to do if current dataType is non-auto
  15842. if ( current === "*" ) {
  15843. current = prev;
  15844. // Convert response if prev dataType is non-auto and differs from current
  15845. } else if ( prev !== "*" && prev !== current ) {
  15846. // Seek a direct converter
  15847. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15848. // If none found, seek a pair
  15849. if ( !conv ) {
  15850. for ( conv2 in converters ) {
  15851. // If conv2 outputs current
  15852. tmp = conv2.split( " " );
  15853. if ( tmp[ 1 ] === current ) {
  15854. // If prev can be converted to accepted input
  15855. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15856. converters[ "* " + tmp[ 0 ] ];
  15857. if ( conv ) {
  15858. // Condense equivalence converters
  15859. if ( conv === true ) {
  15860. conv = converters[ conv2 ];
  15861. // Otherwise, insert the intermediate dataType
  15862. } else if ( converters[ conv2 ] !== true ) {
  15863. current = tmp[ 0 ];
  15864. dataTypes.unshift( tmp[ 1 ] );
  15865. }
  15866. break;
  15867. }
  15868. }
  15869. }
  15870. }
  15871. // Apply converter (if not an equivalence)
  15872. if ( conv !== true ) {
  15873. // Unless errors are allowed to bubble, catch and return them
  15874. if ( conv && s.throws ) {
  15875. response = conv( response );
  15876. } else {
  15877. try {
  15878. response = conv( response );
  15879. } catch ( e ) {
  15880. return {
  15881. state: "parsererror",
  15882. error: conv ? e : "No conversion from " + prev + " to " + current
  15883. };
  15884. }
  15885. }
  15886. }
  15887. }
  15888. }
  15889. }
  15890. return { state: "success", data: response };
  15891. }
  15892. jQuery.extend( {
  15893. // Counter for holding the number of active queries
  15894. active: 0,
  15895. // Last-Modified header cache for next request
  15896. lastModified: {},
  15897. etag: {},
  15898. ajaxSettings: {
  15899. url: location.href,
  15900. type: "GET",
  15901. isLocal: rlocalProtocol.test( location.protocol ),
  15902. global: true,
  15903. processData: true,
  15904. async: true,
  15905. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15906. /*
  15907. timeout: 0,
  15908. data: null,
  15909. dataType: null,
  15910. username: null,
  15911. password: null,
  15912. cache: null,
  15913. throws: false,
  15914. traditional: false,
  15915. headers: {},
  15916. */
  15917. accepts: {
  15918. "*": allTypes,
  15919. text: "text/plain",
  15920. html: "text/html",
  15921. xml: "application/xml, text/xml",
  15922. json: "application/json, text/javascript"
  15923. },
  15924. contents: {
  15925. xml: /\bxml\b/,
  15926. html: /\bhtml/,
  15927. json: /\bjson\b/
  15928. },
  15929. responseFields: {
  15930. xml: "responseXML",
  15931. text: "responseText",
  15932. json: "responseJSON"
  15933. },
  15934. // Data converters
  15935. // Keys separate source (or catchall "*") and destination types with a single space
  15936. converters: {
  15937. // Convert anything to text
  15938. "* text": String,
  15939. // Text to html (true = no transformation)
  15940. "text html": true,
  15941. // Evaluate text as a json expression
  15942. "text json": JSON.parse,
  15943. // Parse text as xml
  15944. "text xml": jQuery.parseXML
  15945. },
  15946. // For options that shouldn't be deep extended:
  15947. // you can add your own custom options here if
  15948. // and when you create one that shouldn't be
  15949. // deep extended (see ajaxExtend)
  15950. flatOptions: {
  15951. url: true,
  15952. context: true
  15953. }
  15954. },
  15955. // Creates a full fledged settings object into target
  15956. // with both ajaxSettings and settings fields.
  15957. // If target is omitted, writes into ajaxSettings.
  15958. ajaxSetup: function( target, settings ) {
  15959. return settings ?
  15960. // Building a settings object
  15961. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15962. // Extending ajaxSettings
  15963. ajaxExtend( jQuery.ajaxSettings, target );
  15964. },
  15965. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15966. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15967. // Main method
  15968. ajax: function( url, options ) {
  15969. // If url is an object, simulate pre-1.5 signature
  15970. if ( typeof url === "object" ) {
  15971. options = url;
  15972. url = undefined;
  15973. }
  15974. // Force options to be an object
  15975. options = options || {};
  15976. var transport,
  15977. // URL without anti-cache param
  15978. cacheURL,
  15979. // Response headers
  15980. responseHeadersString,
  15981. responseHeaders,
  15982. // timeout handle
  15983. timeoutTimer,
  15984. // Url cleanup var
  15985. urlAnchor,
  15986. // Request state (becomes false upon send and true upon completion)
  15987. completed,
  15988. // To know if global events are to be dispatched
  15989. fireGlobals,
  15990. // Loop variable
  15991. i,
  15992. // uncached part of the url
  15993. uncached,
  15994. // Create the final options object
  15995. s = jQuery.ajaxSetup( {}, options ),
  15996. // Callbacks context
  15997. callbackContext = s.context || s,
  15998. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15999. globalEventContext = s.context &&
  16000. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16001. jQuery( callbackContext ) :
  16002. jQuery.event,
  16003. // Deferreds
  16004. deferred = jQuery.Deferred(),
  16005. completeDeferred = jQuery.Callbacks( "once memory" ),
  16006. // Status-dependent callbacks
  16007. statusCode = s.statusCode || {},
  16008. // Headers (they are sent all at once)
  16009. requestHeaders = {},
  16010. requestHeadersNames = {},
  16011. // Default abort message
  16012. strAbort = "canceled",
  16013. // Fake xhr
  16014. jqXHR = {
  16015. readyState: 0,
  16016. // Builds headers hashtable if needed
  16017. getResponseHeader: function( key ) {
  16018. var match;
  16019. if ( completed ) {
  16020. if ( !responseHeaders ) {
  16021. responseHeaders = {};
  16022. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16023. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16024. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16025. .concat( match[ 2 ] );
  16026. }
  16027. }
  16028. match = responseHeaders[ key.toLowerCase() + " " ];
  16029. }
  16030. return match == null ? null : match.join( ", " );
  16031. },
  16032. // Raw string
  16033. getAllResponseHeaders: function() {
  16034. return completed ? responseHeadersString : null;
  16035. },
  16036. // Caches the header
  16037. setRequestHeader: function( name, value ) {
  16038. if ( completed == null ) {
  16039. name = requestHeadersNames[ name.toLowerCase() ] =
  16040. requestHeadersNames[ name.toLowerCase() ] || name;
  16041. requestHeaders[ name ] = value;
  16042. }
  16043. return this;
  16044. },
  16045. // Overrides response content-type header
  16046. overrideMimeType: function( type ) {
  16047. if ( completed == null ) {
  16048. s.mimeType = type;
  16049. }
  16050. return this;
  16051. },
  16052. // Status-dependent callbacks
  16053. statusCode: function( map ) {
  16054. var code;
  16055. if ( map ) {
  16056. if ( completed ) {
  16057. // Execute the appropriate callbacks
  16058. jqXHR.always( map[ jqXHR.status ] );
  16059. } else {
  16060. // Lazy-add the new callbacks in a way that preserves old ones
  16061. for ( code in map ) {
  16062. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16063. }
  16064. }
  16065. }
  16066. return this;
  16067. },
  16068. // Cancel the request
  16069. abort: function( statusText ) {
  16070. var finalText = statusText || strAbort;
  16071. if ( transport ) {
  16072. transport.abort( finalText );
  16073. }
  16074. done( 0, finalText );
  16075. return this;
  16076. }
  16077. };
  16078. // Attach deferreds
  16079. deferred.promise( jqXHR );
  16080. // Add protocol if not provided (prefilters might expect it)
  16081. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16082. // We also use the url parameter if available
  16083. s.url = ( ( url || s.url || location.href ) + "" )
  16084. .replace( rprotocol, location.protocol + "//" );
  16085. // Alias method option to type as per ticket #12004
  16086. s.type = options.method || options.type || s.method || s.type;
  16087. // Extract dataTypes list
  16088. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16089. // A cross-domain request is in order when the origin doesn't match the current origin.
  16090. if ( s.crossDomain == null ) {
  16091. urlAnchor = document.createElement( "a" );
  16092. // Support: IE <=8 - 11, Edge 12 - 15
  16093. // IE throws exception on accessing the href property if url is malformed,
  16094. // e.g. http://example.com:80x/
  16095. try {
  16096. urlAnchor.href = s.url;
  16097. // Support: IE <=8 - 11 only
  16098. // Anchor's host property isn't correctly set when s.url is relative
  16099. urlAnchor.href = urlAnchor.href;
  16100. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16101. urlAnchor.protocol + "//" + urlAnchor.host;
  16102. } catch ( e ) {
  16103. // If there is an error parsing the URL, assume it is crossDomain,
  16104. // it can be rejected by the transport if it is invalid
  16105. s.crossDomain = true;
  16106. }
  16107. }
  16108. // Convert data if not already a string
  16109. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16110. s.data = jQuery.param( s.data, s.traditional );
  16111. }
  16112. // Apply prefilters
  16113. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16114. // If request was aborted inside a prefilter, stop there
  16115. if ( completed ) {
  16116. return jqXHR;
  16117. }
  16118. // We can fire global events as of now if asked to
  16119. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16120. fireGlobals = jQuery.event && s.global;
  16121. // Watch for a new set of requests
  16122. if ( fireGlobals && jQuery.active++ === 0 ) {
  16123. jQuery.event.trigger( "ajaxStart" );
  16124. }
  16125. // Uppercase the type
  16126. s.type = s.type.toUpperCase();
  16127. // Determine if request has content
  16128. s.hasContent = !rnoContent.test( s.type );
  16129. // Save the URL in case we're toying with the If-Modified-Since
  16130. // and/or If-None-Match header later on
  16131. // Remove hash to simplify url manipulation
  16132. cacheURL = s.url.replace( rhash, "" );
  16133. // More options handling for requests with no content
  16134. if ( !s.hasContent ) {
  16135. // Remember the hash so we can put it back
  16136. uncached = s.url.slice( cacheURL.length );
  16137. // If data is available and should be processed, append data to url
  16138. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16139. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16140. // #9682: remove data so that it's not used in an eventual retry
  16141. delete s.data;
  16142. }
  16143. // Add or update anti-cache param if needed
  16144. if ( s.cache === false ) {
  16145. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16146. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16147. }
  16148. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16149. s.url = cacheURL + uncached;
  16150. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16151. } else if ( s.data && s.processData &&
  16152. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16153. s.data = s.data.replace( r20, "+" );
  16154. }
  16155. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16156. if ( s.ifModified ) {
  16157. if ( jQuery.lastModified[ cacheURL ] ) {
  16158. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16159. }
  16160. if ( jQuery.etag[ cacheURL ] ) {
  16161. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16162. }
  16163. }
  16164. // Set the correct header, if data is being sent
  16165. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16166. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16167. }
  16168. // Set the Accepts header for the server, depending on the dataType
  16169. jqXHR.setRequestHeader(
  16170. "Accept",
  16171. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16172. s.accepts[ s.dataTypes[ 0 ] ] +
  16173. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16174. s.accepts[ "*" ]
  16175. );
  16176. // Check for headers option
  16177. for ( i in s.headers ) {
  16178. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16179. }
  16180. // Allow custom headers/mimetypes and early abort
  16181. if ( s.beforeSend &&
  16182. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16183. // Abort if not done already and return
  16184. return jqXHR.abort();
  16185. }
  16186. // Aborting is no longer a cancellation
  16187. strAbort = "abort";
  16188. // Install callbacks on deferreds
  16189. completeDeferred.add( s.complete );
  16190. jqXHR.done( s.success );
  16191. jqXHR.fail( s.error );
  16192. // Get transport
  16193. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16194. // If no transport, we auto-abort
  16195. if ( !transport ) {
  16196. done( -1, "No Transport" );
  16197. } else {
  16198. jqXHR.readyState = 1;
  16199. // Send global event
  16200. if ( fireGlobals ) {
  16201. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16202. }
  16203. // If request was aborted inside ajaxSend, stop there
  16204. if ( completed ) {
  16205. return jqXHR;
  16206. }
  16207. // Timeout
  16208. if ( s.async && s.timeout > 0 ) {
  16209. timeoutTimer = window.setTimeout( function() {
  16210. jqXHR.abort( "timeout" );
  16211. }, s.timeout );
  16212. }
  16213. try {
  16214. completed = false;
  16215. transport.send( requestHeaders, done );
  16216. } catch ( e ) {
  16217. // Rethrow post-completion exceptions
  16218. if ( completed ) {
  16219. throw e;
  16220. }
  16221. // Propagate others as results
  16222. done( -1, e );
  16223. }
  16224. }
  16225. // Callback for when everything is done
  16226. function done( status, nativeStatusText, responses, headers ) {
  16227. var isSuccess, success, error, response, modified,
  16228. statusText = nativeStatusText;
  16229. // Ignore repeat invocations
  16230. if ( completed ) {
  16231. return;
  16232. }
  16233. completed = true;
  16234. // Clear timeout if it exists
  16235. if ( timeoutTimer ) {
  16236. window.clearTimeout( timeoutTimer );
  16237. }
  16238. // Dereference transport for early garbage collection
  16239. // (no matter how long the jqXHR object will be used)
  16240. transport = undefined;
  16241. // Cache response headers
  16242. responseHeadersString = headers || "";
  16243. // Set readyState
  16244. jqXHR.readyState = status > 0 ? 4 : 0;
  16245. // Determine if successful
  16246. isSuccess = status >= 200 && status < 300 || status === 304;
  16247. // Get response data
  16248. if ( responses ) {
  16249. response = ajaxHandleResponses( s, jqXHR, responses );
  16250. }
  16251. // Convert no matter what (that way responseXXX fields are always set)
  16252. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16253. // If successful, handle type chaining
  16254. if ( isSuccess ) {
  16255. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16256. if ( s.ifModified ) {
  16257. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16258. if ( modified ) {
  16259. jQuery.lastModified[ cacheURL ] = modified;
  16260. }
  16261. modified = jqXHR.getResponseHeader( "etag" );
  16262. if ( modified ) {
  16263. jQuery.etag[ cacheURL ] = modified;
  16264. }
  16265. }
  16266. // if no content
  16267. if ( status === 204 || s.type === "HEAD" ) {
  16268. statusText = "nocontent";
  16269. // if not modified
  16270. } else if ( status === 304 ) {
  16271. statusText = "notmodified";
  16272. // If we have data, let's convert it
  16273. } else {
  16274. statusText = response.state;
  16275. success = response.data;
  16276. error = response.error;
  16277. isSuccess = !error;
  16278. }
  16279. } else {
  16280. // Extract error from statusText and normalize for non-aborts
  16281. error = statusText;
  16282. if ( status || !statusText ) {
  16283. statusText = "error";
  16284. if ( status < 0 ) {
  16285. status = 0;
  16286. }
  16287. }
  16288. }
  16289. // Set data for the fake xhr object
  16290. jqXHR.status = status;
  16291. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16292. // Success/Error
  16293. if ( isSuccess ) {
  16294. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16295. } else {
  16296. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16297. }
  16298. // Status-dependent callbacks
  16299. jqXHR.statusCode( statusCode );
  16300. statusCode = undefined;
  16301. if ( fireGlobals ) {
  16302. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16303. [ jqXHR, s, isSuccess ? success : error ] );
  16304. }
  16305. // Complete
  16306. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16307. if ( fireGlobals ) {
  16308. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16309. // Handle the global AJAX counter
  16310. if ( !( --jQuery.active ) ) {
  16311. jQuery.event.trigger( "ajaxStop" );
  16312. }
  16313. }
  16314. }
  16315. return jqXHR;
  16316. },
  16317. getJSON: function( url, data, callback ) {
  16318. return jQuery.get( url, data, callback, "json" );
  16319. },
  16320. getScript: function( url, callback ) {
  16321. return jQuery.get( url, undefined, callback, "script" );
  16322. }
  16323. } );
  16324. jQuery.each( [ "get", "post" ], function( i, method ) {
  16325. jQuery[ method ] = function( url, data, callback, type ) {
  16326. // Shift arguments if data argument was omitted
  16327. if ( isFunction( data ) ) {
  16328. type = type || callback;
  16329. callback = data;
  16330. data = undefined;
  16331. }
  16332. // The url can be an options object (which then must have .url)
  16333. return jQuery.ajax( jQuery.extend( {
  16334. url: url,
  16335. type: method,
  16336. dataType: type,
  16337. data: data,
  16338. success: callback
  16339. }, jQuery.isPlainObject( url ) && url ) );
  16340. };
  16341. } );
  16342. jQuery._evalUrl = function( url, options ) {
  16343. return jQuery.ajax( {
  16344. url: url,
  16345. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16346. type: "GET",
  16347. dataType: "script",
  16348. cache: true,
  16349. async: false,
  16350. global: false,
  16351. // Only evaluate the response if it is successful (gh-4126)
  16352. // dataFilter is not invoked for failure responses, so using it instead
  16353. // of the default converter is kludgy but it works.
  16354. converters: {
  16355. "text script": function() {}
  16356. },
  16357. dataFilter: function( response ) {
  16358. jQuery.globalEval( response, options );
  16359. }
  16360. } );
  16361. };
  16362. jQuery.fn.extend( {
  16363. wrapAll: function( html ) {
  16364. var wrap;
  16365. if ( this[ 0 ] ) {
  16366. if ( isFunction( html ) ) {
  16367. html = html.call( this[ 0 ] );
  16368. }
  16369. // The elements to wrap the target around
  16370. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16371. if ( this[ 0 ].parentNode ) {
  16372. wrap.insertBefore( this[ 0 ] );
  16373. }
  16374. wrap.map( function() {
  16375. var elem = this;
  16376. while ( elem.firstElementChild ) {
  16377. elem = elem.firstElementChild;
  16378. }
  16379. return elem;
  16380. } ).append( this );
  16381. }
  16382. return this;
  16383. },
  16384. wrapInner: function( html ) {
  16385. if ( isFunction( html ) ) {
  16386. return this.each( function( i ) {
  16387. jQuery( this ).wrapInner( html.call( this, i ) );
  16388. } );
  16389. }
  16390. return this.each( function() {
  16391. var self = jQuery( this ),
  16392. contents = self.contents();
  16393. if ( contents.length ) {
  16394. contents.wrapAll( html );
  16395. } else {
  16396. self.append( html );
  16397. }
  16398. } );
  16399. },
  16400. wrap: function( html ) {
  16401. var htmlIsFunction = isFunction( html );
  16402. return this.each( function( i ) {
  16403. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16404. } );
  16405. },
  16406. unwrap: function( selector ) {
  16407. this.parent( selector ).not( "body" ).each( function() {
  16408. jQuery( this ).replaceWith( this.childNodes );
  16409. } );
  16410. return this;
  16411. }
  16412. } );
  16413. jQuery.expr.pseudos.hidden = function( elem ) {
  16414. return !jQuery.expr.pseudos.visible( elem );
  16415. };
  16416. jQuery.expr.pseudos.visible = function( elem ) {
  16417. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16418. };
  16419. jQuery.ajaxSettings.xhr = function() {
  16420. try {
  16421. return new window.XMLHttpRequest();
  16422. } catch ( e ) {}
  16423. };
  16424. var xhrSuccessStatus = {
  16425. // File protocol always yields status code 0, assume 200
  16426. 0: 200,
  16427. // Support: IE <=9 only
  16428. // #1450: sometimes IE returns 1223 when it should be 204
  16429. 1223: 204
  16430. },
  16431. xhrSupported = jQuery.ajaxSettings.xhr();
  16432. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16433. support.ajax = xhrSupported = !!xhrSupported;
  16434. jQuery.ajaxTransport( function( options ) {
  16435. var callback, errorCallback;
  16436. // Cross domain only allowed if supported through XMLHttpRequest
  16437. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16438. return {
  16439. send: function( headers, complete ) {
  16440. var i,
  16441. xhr = options.xhr();
  16442. xhr.open(
  16443. options.type,
  16444. options.url,
  16445. options.async,
  16446. options.username,
  16447. options.password
  16448. );
  16449. // Apply custom fields if provided
  16450. if ( options.xhrFields ) {
  16451. for ( i in options.xhrFields ) {
  16452. xhr[ i ] = options.xhrFields[ i ];
  16453. }
  16454. }
  16455. // Override mime type if needed
  16456. if ( options.mimeType && xhr.overrideMimeType ) {
  16457. xhr.overrideMimeType( options.mimeType );
  16458. }
  16459. // X-Requested-With header
  16460. // For cross-domain requests, seeing as conditions for a preflight are
  16461. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16462. // (it can always be set on a per-request basis or even using ajaxSetup)
  16463. // For same-domain requests, won't change header if already provided.
  16464. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16465. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16466. }
  16467. // Set headers
  16468. for ( i in headers ) {
  16469. xhr.setRequestHeader( i, headers[ i ] );
  16470. }
  16471. // Callback
  16472. callback = function( type ) {
  16473. return function() {
  16474. if ( callback ) {
  16475. callback = errorCallback = xhr.onload =
  16476. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16477. xhr.onreadystatechange = null;
  16478. if ( type === "abort" ) {
  16479. xhr.abort();
  16480. } else if ( type === "error" ) {
  16481. // Support: IE <=9 only
  16482. // On a manual native abort, IE9 throws
  16483. // errors on any property access that is not readyState
  16484. if ( typeof xhr.status !== "number" ) {
  16485. complete( 0, "error" );
  16486. } else {
  16487. complete(
  16488. // File: protocol always yields status 0; see #8605, #14207
  16489. xhr.status,
  16490. xhr.statusText
  16491. );
  16492. }
  16493. } else {
  16494. complete(
  16495. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16496. xhr.statusText,
  16497. // Support: IE <=9 only
  16498. // IE9 has no XHR2 but throws on binary (trac-11426)
  16499. // For XHR2 non-text, let the caller handle it (gh-2498)
  16500. ( xhr.responseType || "text" ) !== "text" ||
  16501. typeof xhr.responseText !== "string" ?
  16502. { binary: xhr.response } :
  16503. { text: xhr.responseText },
  16504. xhr.getAllResponseHeaders()
  16505. );
  16506. }
  16507. }
  16508. };
  16509. };
  16510. // Listen to events
  16511. xhr.onload = callback();
  16512. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16513. // Support: IE 9 only
  16514. // Use onreadystatechange to replace onabort
  16515. // to handle uncaught aborts
  16516. if ( xhr.onabort !== undefined ) {
  16517. xhr.onabort = errorCallback;
  16518. } else {
  16519. xhr.onreadystatechange = function() {
  16520. // Check readyState before timeout as it changes
  16521. if ( xhr.readyState === 4 ) {
  16522. // Allow onerror to be called first,
  16523. // but that will not handle a native abort
  16524. // Also, save errorCallback to a variable
  16525. // as xhr.onerror cannot be accessed
  16526. window.setTimeout( function() {
  16527. if ( callback ) {
  16528. errorCallback();
  16529. }
  16530. } );
  16531. }
  16532. };
  16533. }
  16534. // Create the abort callback
  16535. callback = callback( "abort" );
  16536. try {
  16537. // Do send the request (this may raise an exception)
  16538. xhr.send( options.hasContent && options.data || null );
  16539. } catch ( e ) {
  16540. // #14683: Only rethrow if this hasn't been notified as an error yet
  16541. if ( callback ) {
  16542. throw e;
  16543. }
  16544. }
  16545. },
  16546. abort: function() {
  16547. if ( callback ) {
  16548. callback();
  16549. }
  16550. }
  16551. };
  16552. }
  16553. } );
  16554. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16555. jQuery.ajaxPrefilter( function( s ) {
  16556. if ( s.crossDomain ) {
  16557. s.contents.script = false;
  16558. }
  16559. } );
  16560. // Install script dataType
  16561. jQuery.ajaxSetup( {
  16562. accepts: {
  16563. script: "text/javascript, application/javascript, " +
  16564. "application/ecmascript, application/x-ecmascript"
  16565. },
  16566. contents: {
  16567. script: /\b(?:java|ecma)script\b/
  16568. },
  16569. converters: {
  16570. "text script": function( text ) {
  16571. jQuery.globalEval( text );
  16572. return text;
  16573. }
  16574. }
  16575. } );
  16576. // Handle cache's special case and crossDomain
  16577. jQuery.ajaxPrefilter( "script", function( s ) {
  16578. if ( s.cache === undefined ) {
  16579. s.cache = false;
  16580. }
  16581. if ( s.crossDomain ) {
  16582. s.type = "GET";
  16583. }
  16584. } );
  16585. // Bind script tag hack transport
  16586. jQuery.ajaxTransport( "script", function( s ) {
  16587. // This transport only deals with cross domain or forced-by-attrs requests
  16588. if ( s.crossDomain || s.scriptAttrs ) {
  16589. var script, callback;
  16590. return {
  16591. send: function( _, complete ) {
  16592. script = jQuery( "<script>" )
  16593. .attr( s.scriptAttrs || {} )
  16594. .prop( { charset: s.scriptCharset, src: s.url } )
  16595. .on( "load error", callback = function( evt ) {
  16596. script.remove();
  16597. callback = null;
  16598. if ( evt ) {
  16599. complete( evt.type === "error" ? 404 : 200, evt.type );
  16600. }
  16601. } );
  16602. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16603. document.head.appendChild( script[ 0 ] );
  16604. },
  16605. abort: function() {
  16606. if ( callback ) {
  16607. callback();
  16608. }
  16609. }
  16610. };
  16611. }
  16612. } );
  16613. var oldCallbacks = [],
  16614. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16615. // Default jsonp settings
  16616. jQuery.ajaxSetup( {
  16617. jsonp: "callback",
  16618. jsonpCallback: function() {
  16619. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16620. this[ callback ] = true;
  16621. return callback;
  16622. }
  16623. } );
  16624. // Detect, normalize options and install callbacks for jsonp requests
  16625. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16626. var callbackName, overwritten, responseContainer,
  16627. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16628. "url" :
  16629. typeof s.data === "string" &&
  16630. ( s.contentType || "" )
  16631. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16632. rjsonp.test( s.data ) && "data"
  16633. );
  16634. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16635. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16636. // Get callback name, remembering preexisting value associated with it
  16637. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16638. s.jsonpCallback() :
  16639. s.jsonpCallback;
  16640. // Insert callback into url or form data
  16641. if ( jsonProp ) {
  16642. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16643. } else if ( s.jsonp !== false ) {
  16644. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16645. }
  16646. // Use data converter to retrieve json after script execution
  16647. s.converters[ "script json" ] = function() {
  16648. if ( !responseContainer ) {
  16649. jQuery.error( callbackName + " was not called" );
  16650. }
  16651. return responseContainer[ 0 ];
  16652. };
  16653. // Force json dataType
  16654. s.dataTypes[ 0 ] = "json";
  16655. // Install callback
  16656. overwritten = window[ callbackName ];
  16657. window[ callbackName ] = function() {
  16658. responseContainer = arguments;
  16659. };
  16660. // Clean-up function (fires after converters)
  16661. jqXHR.always( function() {
  16662. // If previous value didn't exist - remove it
  16663. if ( overwritten === undefined ) {
  16664. jQuery( window ).removeProp( callbackName );
  16665. // Otherwise restore preexisting value
  16666. } else {
  16667. window[ callbackName ] = overwritten;
  16668. }
  16669. // Save back as free
  16670. if ( s[ callbackName ] ) {
  16671. // Make sure that re-using the options doesn't screw things around
  16672. s.jsonpCallback = originalSettings.jsonpCallback;
  16673. // Save the callback name for future use
  16674. oldCallbacks.push( callbackName );
  16675. }
  16676. // Call if it was a function and we have a response
  16677. if ( responseContainer && isFunction( overwritten ) ) {
  16678. overwritten( responseContainer[ 0 ] );
  16679. }
  16680. responseContainer = overwritten = undefined;
  16681. } );
  16682. // Delegate to script
  16683. return "script";
  16684. }
  16685. } );
  16686. // Support: Safari 8 only
  16687. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16688. // collapse sibling forms: the second one becomes a child of the first one.
  16689. // Because of that, this security measure has to be disabled in Safari 8.
  16690. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16691. support.createHTMLDocument = ( function() {
  16692. var body = document.implementation.createHTMLDocument( "" ).body;
  16693. body.innerHTML = "<form></form><form></form>";
  16694. return body.childNodes.length === 2;
  16695. } )();
  16696. // Argument "data" should be string of html
  16697. // context (optional): If specified, the fragment will be created in this context,
  16698. // defaults to document
  16699. // keepScripts (optional): If true, will include scripts passed in the html string
  16700. jQuery.parseHTML = function( data, context, keepScripts ) {
  16701. if ( typeof data !== "string" ) {
  16702. return [];
  16703. }
  16704. if ( typeof context === "boolean" ) {
  16705. keepScripts = context;
  16706. context = false;
  16707. }
  16708. var base, parsed, scripts;
  16709. if ( !context ) {
  16710. // Stop scripts or inline event handlers from being executed immediately
  16711. // by using document.implementation
  16712. if ( support.createHTMLDocument ) {
  16713. context = document.implementation.createHTMLDocument( "" );
  16714. // Set the base href for the created document
  16715. // so any parsed elements with URLs
  16716. // are based on the document's URL (gh-2965)
  16717. base = context.createElement( "base" );
  16718. base.href = document.location.href;
  16719. context.head.appendChild( base );
  16720. } else {
  16721. context = document;
  16722. }
  16723. }
  16724. parsed = rsingleTag.exec( data );
  16725. scripts = !keepScripts && [];
  16726. // Single tag
  16727. if ( parsed ) {
  16728. return [ context.createElement( parsed[ 1 ] ) ];
  16729. }
  16730. parsed = buildFragment( [ data ], context, scripts );
  16731. if ( scripts && scripts.length ) {
  16732. jQuery( scripts ).remove();
  16733. }
  16734. return jQuery.merge( [], parsed.childNodes );
  16735. };
  16736. /**
  16737. * Load a url into a page
  16738. */
  16739. jQuery.fn.load = function( url, params, callback ) {
  16740. var selector, type, response,
  16741. self = this,
  16742. off = url.indexOf( " " );
  16743. if ( off > -1 ) {
  16744. selector = stripAndCollapse( url.slice( off ) );
  16745. url = url.slice( 0, off );
  16746. }
  16747. // If it's a function
  16748. if ( isFunction( params ) ) {
  16749. // We assume that it's the callback
  16750. callback = params;
  16751. params = undefined;
  16752. // Otherwise, build a param string
  16753. } else if ( params && typeof params === "object" ) {
  16754. type = "POST";
  16755. }
  16756. // If we have elements to modify, make the request
  16757. if ( self.length > 0 ) {
  16758. jQuery.ajax( {
  16759. url: url,
  16760. // If "type" variable is undefined, then "GET" method will be used.
  16761. // Make value of this field explicit since
  16762. // user can override it through ajaxSetup method
  16763. type: type || "GET",
  16764. dataType: "html",
  16765. data: params
  16766. } ).done( function( responseText ) {
  16767. // Save response for use in complete callback
  16768. response = arguments;
  16769. self.html( selector ?
  16770. // If a selector was specified, locate the right elements in a dummy div
  16771. // Exclude scripts to avoid IE 'Permission Denied' errors
  16772. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16773. // Otherwise use the full result
  16774. responseText );
  16775. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16776. // but they are ignored because response was set above.
  16777. // If it fails, this function gets "jqXHR", "status", "error"
  16778. } ).always( callback && function( jqXHR, status ) {
  16779. self.each( function() {
  16780. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16781. } );
  16782. } );
  16783. }
  16784. return this;
  16785. };
  16786. // Attach a bunch of functions for handling common AJAX events
  16787. jQuery.each( [
  16788. "ajaxStart",
  16789. "ajaxStop",
  16790. "ajaxComplete",
  16791. "ajaxError",
  16792. "ajaxSuccess",
  16793. "ajaxSend"
  16794. ], function( i, type ) {
  16795. jQuery.fn[ type ] = function( fn ) {
  16796. return this.on( type, fn );
  16797. };
  16798. } );
  16799. jQuery.expr.pseudos.animated = function( elem ) {
  16800. return jQuery.grep( jQuery.timers, function( fn ) {
  16801. return elem === fn.elem;
  16802. } ).length;
  16803. };
  16804. jQuery.offset = {
  16805. setOffset: function( elem, options, i ) {
  16806. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16807. position = jQuery.css( elem, "position" ),
  16808. curElem = jQuery( elem ),
  16809. props = {};
  16810. // Set position first, in-case top/left are set even on static elem
  16811. if ( position === "static" ) {
  16812. elem.style.position = "relative";
  16813. }
  16814. curOffset = curElem.offset();
  16815. curCSSTop = jQuery.css( elem, "top" );
  16816. curCSSLeft = jQuery.css( elem, "left" );
  16817. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16818. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16819. // Need to be able to calculate position if either
  16820. // top or left is auto and position is either absolute or fixed
  16821. if ( calculatePosition ) {
  16822. curPosition = curElem.position();
  16823. curTop = curPosition.top;
  16824. curLeft = curPosition.left;
  16825. } else {
  16826. curTop = parseFloat( curCSSTop ) || 0;
  16827. curLeft = parseFloat( curCSSLeft ) || 0;
  16828. }
  16829. if ( isFunction( options ) ) {
  16830. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16831. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16832. }
  16833. if ( options.top != null ) {
  16834. props.top = ( options.top - curOffset.top ) + curTop;
  16835. }
  16836. if ( options.left != null ) {
  16837. props.left = ( options.left - curOffset.left ) + curLeft;
  16838. }
  16839. if ( "using" in options ) {
  16840. options.using.call( elem, props );
  16841. } else {
  16842. curElem.css( props );
  16843. }
  16844. }
  16845. };
  16846. jQuery.fn.extend( {
  16847. // offset() relates an element's border box to the document origin
  16848. offset: function( options ) {
  16849. // Preserve chaining for setter
  16850. if ( arguments.length ) {
  16851. return options === undefined ?
  16852. this :
  16853. this.each( function( i ) {
  16854. jQuery.offset.setOffset( this, options, i );
  16855. } );
  16856. }
  16857. var rect, win,
  16858. elem = this[ 0 ];
  16859. if ( !elem ) {
  16860. return;
  16861. }
  16862. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16863. // Support: IE <=11 only
  16864. // Running getBoundingClientRect on a
  16865. // disconnected node in IE throws an error
  16866. if ( !elem.getClientRects().length ) {
  16867. return { top: 0, left: 0 };
  16868. }
  16869. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16870. rect = elem.getBoundingClientRect();
  16871. win = elem.ownerDocument.defaultView;
  16872. return {
  16873. top: rect.top + win.pageYOffset,
  16874. left: rect.left + win.pageXOffset
  16875. };
  16876. },
  16877. // position() relates an element's margin box to its offset parent's padding box
  16878. // This corresponds to the behavior of CSS absolute positioning
  16879. position: function() {
  16880. if ( !this[ 0 ] ) {
  16881. return;
  16882. }
  16883. var offsetParent, offset, doc,
  16884. elem = this[ 0 ],
  16885. parentOffset = { top: 0, left: 0 };
  16886. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16887. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16888. // Assume position:fixed implies availability of getBoundingClientRect
  16889. offset = elem.getBoundingClientRect();
  16890. } else {
  16891. offset = this.offset();
  16892. // Account for the *real* offset parent, which can be the document or its root element
  16893. // when a statically positioned element is identified
  16894. doc = elem.ownerDocument;
  16895. offsetParent = elem.offsetParent || doc.documentElement;
  16896. while ( offsetParent &&
  16897. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16898. jQuery.css( offsetParent, "position" ) === "static" ) {
  16899. offsetParent = offsetParent.parentNode;
  16900. }
  16901. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16902. // Incorporate borders into its offset, since they are outside its content origin
  16903. parentOffset = jQuery( offsetParent ).offset();
  16904. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16905. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16906. }
  16907. }
  16908. // Subtract parent offsets and element margins
  16909. return {
  16910. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16911. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16912. };
  16913. },
  16914. // This method will return documentElement in the following cases:
  16915. // 1) For the element inside the iframe without offsetParent, this method will return
  16916. // documentElement of the parent window
  16917. // 2) For the hidden or detached element
  16918. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16919. //
  16920. // but those exceptions were never presented as a real life use-cases
  16921. // and might be considered as more preferable results.
  16922. //
  16923. // This logic, however, is not guaranteed and can change at any point in the future
  16924. offsetParent: function() {
  16925. return this.map( function() {
  16926. var offsetParent = this.offsetParent;
  16927. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16928. offsetParent = offsetParent.offsetParent;
  16929. }
  16930. return offsetParent || documentElement;
  16931. } );
  16932. }
  16933. } );
  16934. // Create scrollLeft and scrollTop methods
  16935. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16936. var top = "pageYOffset" === prop;
  16937. jQuery.fn[ method ] = function( val ) {
  16938. return access( this, function( elem, method, val ) {
  16939. // Coalesce documents and windows
  16940. var win;
  16941. if ( isWindow( elem ) ) {
  16942. win = elem;
  16943. } else if ( elem.nodeType === 9 ) {
  16944. win = elem.defaultView;
  16945. }
  16946. if ( val === undefined ) {
  16947. return win ? win[ prop ] : elem[ method ];
  16948. }
  16949. if ( win ) {
  16950. win.scrollTo(
  16951. !top ? val : win.pageXOffset,
  16952. top ? val : win.pageYOffset
  16953. );
  16954. } else {
  16955. elem[ method ] = val;
  16956. }
  16957. }, method, val, arguments.length );
  16958. };
  16959. } );
  16960. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16961. // Add the top/left cssHooks using jQuery.fn.position
  16962. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16963. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16964. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16965. // rather than make the css module depend on the offset module, just check for it here
  16966. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16967. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16968. function( elem, computed ) {
  16969. if ( computed ) {
  16970. computed = curCSS( elem, prop );
  16971. // If curCSS returns percentage, fallback to offset
  16972. return rnumnonpx.test( computed ) ?
  16973. jQuery( elem ).position()[ prop ] + "px" :
  16974. computed;
  16975. }
  16976. }
  16977. );
  16978. } );
  16979. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16980. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16981. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16982. function( defaultExtra, funcName ) {
  16983. // Margin is only for outerHeight, outerWidth
  16984. jQuery.fn[ funcName ] = function( margin, value ) {
  16985. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16986. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16987. return access( this, function( elem, type, value ) {
  16988. var doc;
  16989. if ( isWindow( elem ) ) {
  16990. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16991. return funcName.indexOf( "outer" ) === 0 ?
  16992. elem[ "inner" + name ] :
  16993. elem.document.documentElement[ "client" + name ];
  16994. }
  16995. // Get document width or height
  16996. if ( elem.nodeType === 9 ) {
  16997. doc = elem.documentElement;
  16998. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16999. // whichever is greatest
  17000. return Math.max(
  17001. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17002. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17003. doc[ "client" + name ]
  17004. );
  17005. }
  17006. return value === undefined ?
  17007. // Get width or height on the element, requesting but not forcing parseFloat
  17008. jQuery.css( elem, type, extra ) :
  17009. // Set width or height on the element
  17010. jQuery.style( elem, type, value, extra );
  17011. }, type, chainable ? margin : undefined, chainable );
  17012. };
  17013. } );
  17014. } );
  17015. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17016. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17017. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17018. function( i, name ) {
  17019. // Handle event binding
  17020. jQuery.fn[ name ] = function( data, fn ) {
  17021. return arguments.length > 0 ?
  17022. this.on( name, null, data, fn ) :
  17023. this.trigger( name );
  17024. };
  17025. } );
  17026. jQuery.fn.extend( {
  17027. hover: function( fnOver, fnOut ) {
  17028. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17029. }
  17030. } );
  17031. jQuery.fn.extend( {
  17032. bind: function( types, data, fn ) {
  17033. return this.on( types, null, data, fn );
  17034. },
  17035. unbind: function( types, fn ) {
  17036. return this.off( types, null, fn );
  17037. },
  17038. delegate: function( selector, types, data, fn ) {
  17039. return this.on( types, selector, data, fn );
  17040. },
  17041. undelegate: function( selector, types, fn ) {
  17042. // ( namespace ) or ( selector, types [, fn] )
  17043. return arguments.length === 1 ?
  17044. this.off( selector, "**" ) :
  17045. this.off( types, selector || "**", fn );
  17046. }
  17047. } );
  17048. // Bind a function to a context, optionally partially applying any
  17049. // arguments.
  17050. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17051. // However, it is not slated for removal any time soon
  17052. jQuery.proxy = function( fn, context ) {
  17053. var tmp, args, proxy;
  17054. if ( typeof context === "string" ) {
  17055. tmp = fn[ context ];
  17056. context = fn;
  17057. fn = tmp;
  17058. }
  17059. // Quick check to determine if target is callable, in the spec
  17060. // this throws a TypeError, but we will just return undefined.
  17061. if ( !isFunction( fn ) ) {
  17062. return undefined;
  17063. }
  17064. // Simulated bind
  17065. args = slice.call( arguments, 2 );
  17066. proxy = function() {
  17067. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17068. };
  17069. // Set the guid of unique handler to the same of original handler, so it can be removed
  17070. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17071. return proxy;
  17072. };
  17073. jQuery.holdReady = function( hold ) {
  17074. if ( hold ) {
  17075. jQuery.readyWait++;
  17076. } else {
  17077. jQuery.ready( true );
  17078. }
  17079. };
  17080. jQuery.isArray = Array.isArray;
  17081. jQuery.parseJSON = JSON.parse;
  17082. jQuery.nodeName = nodeName;
  17083. jQuery.isFunction = isFunction;
  17084. jQuery.isWindow = isWindow;
  17085. jQuery.camelCase = camelCase;
  17086. jQuery.type = toType;
  17087. jQuery.now = Date.now;
  17088. jQuery.isNumeric = function( obj ) {
  17089. // As of jQuery 3.0, isNumeric is limited to
  17090. // strings and numbers (primitives or objects)
  17091. // that can be coerced to finite numbers (gh-2662)
  17092. var type = jQuery.type( obj );
  17093. return ( type === "number" || type === "string" ) &&
  17094. // parseFloat NaNs numeric-cast false positives ("")
  17095. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17096. // subtraction forces infinities to NaN
  17097. !isNaN( obj - parseFloat( obj ) );
  17098. };
  17099. // Register as a named AMD module, since jQuery can be concatenated with other
  17100. // files that may use define, but not via a proper concatenation script that
  17101. // understands anonymous AMD modules. A named AMD is safest and most robust
  17102. // way to register. Lowercase jquery is used because AMD module names are
  17103. // derived from file names, and jQuery is normally delivered in a lowercase
  17104. // file name. Do this after creating the global so that if an AMD module wants
  17105. // to call noConflict to hide this version of jQuery, it will work.
  17106. // Note that for maximum portability, libraries that are not jQuery should
  17107. // declare themselves as anonymous modules, and avoid setting a global if an
  17108. // AMD loader is present. jQuery is a special case. For more information, see
  17109. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17110. if ( true ) {
  17111. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17112. return jQuery;
  17113. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17114. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17115. }
  17116. var
  17117. // Map over jQuery in case of overwrite
  17118. _jQuery = window.jQuery,
  17119. // Map over the $ in case of overwrite
  17120. _$ = window.$;
  17121. jQuery.noConflict = function( deep ) {
  17122. if ( window.$ === jQuery ) {
  17123. window.$ = _$;
  17124. }
  17125. if ( deep && window.jQuery === jQuery ) {
  17126. window.jQuery = _jQuery;
  17127. }
  17128. return jQuery;
  17129. };
  17130. // Expose jQuery and $ identifiers, even in AMD
  17131. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17132. // and CommonJS for browser emulators (#13566)
  17133. if ( !noGlobal ) {
  17134. window.jQuery = window.$ = jQuery;
  17135. }
  17136. return jQuery;
  17137. } );
  17138. /***/ }),
  17139. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17140. /*!************************************************!*\
  17141. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17142. \************************************************/
  17143. /*! exports provided: default */
  17144. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17145. "use strict";
  17146. __webpack_require__.r(__webpack_exports__);
  17147. var classCallCheck = function (instance, Constructor) {
  17148. if (!(instance instanceof Constructor)) {
  17149. throw new TypeError("Cannot call a class as a function");
  17150. }
  17151. };
  17152. var createClass = function () {
  17153. function defineProperties(target, props) {
  17154. for (var i = 0; i < props.length; i++) {
  17155. var descriptor = props[i];
  17156. descriptor.enumerable = descriptor.enumerable || false;
  17157. descriptor.configurable = true;
  17158. if ("value" in descriptor) descriptor.writable = true;
  17159. Object.defineProperty(target, descriptor.key, descriptor);
  17160. }
  17161. }
  17162. return function (Constructor, protoProps, staticProps) {
  17163. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17164. if (staticProps) defineProperties(Constructor, staticProps);
  17165. return Constructor;
  17166. };
  17167. }();
  17168. var _extends = Object.assign || function (target) {
  17169. for (var i = 1; i < arguments.length; i++) {
  17170. var source = arguments[i];
  17171. for (var key in source) {
  17172. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17173. target[key] = source[key];
  17174. }
  17175. }
  17176. }
  17177. return target;
  17178. };
  17179. var inherits = function (subClass, superClass) {
  17180. if (typeof superClass !== "function" && superClass !== null) {
  17181. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17182. }
  17183. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17184. constructor: {
  17185. value: subClass,
  17186. enumerable: false,
  17187. writable: true,
  17188. configurable: true
  17189. }
  17190. });
  17191. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17192. };
  17193. var possibleConstructorReturn = function (self, call) {
  17194. if (!self) {
  17195. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17196. }
  17197. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17198. };
  17199. var Connector = function () {
  17200. /**
  17201. * Create a new class instance.
  17202. */
  17203. function Connector(options) {
  17204. classCallCheck(this, Connector);
  17205. /**
  17206. * Default connector options.
  17207. */
  17208. this._defaultOptions = {
  17209. auth: {
  17210. headers: {}
  17211. },
  17212. authEndpoint: '/broadcasting/auth',
  17213. broadcaster: 'pusher',
  17214. csrfToken: null,
  17215. host: null,
  17216. key: null,
  17217. namespace: 'App.Events'
  17218. };
  17219. this.setOptions(options);
  17220. this.connect();
  17221. }
  17222. /**
  17223. * Merge the custom options with the defaults.
  17224. */
  17225. createClass(Connector, [{
  17226. key: 'setOptions',
  17227. value: function setOptions(options) {
  17228. this.options = _extends(this._defaultOptions, options);
  17229. if (this.csrfToken()) {
  17230. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17231. }
  17232. return options;
  17233. }
  17234. /**
  17235. * Extract the CSRF token from the page.
  17236. */
  17237. }, {
  17238. key: 'csrfToken',
  17239. value: function csrfToken() {
  17240. var selector = void 0;
  17241. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17242. return window['Laravel'].csrfToken;
  17243. } else if (this.options.csrfToken) {
  17244. return this.options.csrfToken;
  17245. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17246. return selector.getAttribute('content');
  17247. }
  17248. return null;
  17249. }
  17250. }]);
  17251. return Connector;
  17252. }();
  17253. /**
  17254. * This class represents a basic channel.
  17255. */
  17256. var Channel = function () {
  17257. function Channel() {
  17258. classCallCheck(this, Channel);
  17259. }
  17260. createClass(Channel, [{
  17261. key: 'listenForWhisper',
  17262. /**
  17263. * Listen for a whisper event on the channel instance.
  17264. */
  17265. value: function listenForWhisper(event, callback) {
  17266. return this.listen('.client-' + event, callback);
  17267. }
  17268. /**
  17269. * Listen for an event on the channel instance.
  17270. */
  17271. }, {
  17272. key: 'notification',
  17273. value: function notification(callback) {
  17274. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17275. }
  17276. /**
  17277. * Stop listening for a whispser event on the channel instance.
  17278. */
  17279. }, {
  17280. key: 'stopListeningForWhisper',
  17281. value: function stopListeningForWhisper(event) {
  17282. return this.stopListening('.client-' + event);
  17283. }
  17284. }]);
  17285. return Channel;
  17286. }();
  17287. /**
  17288. * Event name formatter
  17289. */
  17290. var EventFormatter = function () {
  17291. /**
  17292. * Create a new class instance.
  17293. */
  17294. function EventFormatter(namespace) {
  17295. classCallCheck(this, EventFormatter);
  17296. this.setNamespace(namespace);
  17297. }
  17298. /**
  17299. * Format the given event name.
  17300. */
  17301. createClass(EventFormatter, [{
  17302. key: 'format',
  17303. value: function format(event) {
  17304. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17305. return event.substr(1);
  17306. } else if (this.namespace) {
  17307. event = this.namespace + '.' + event;
  17308. }
  17309. return event.replace(/\./g, '\\');
  17310. }
  17311. /**
  17312. * Set the event namespace.
  17313. */
  17314. }, {
  17315. key: 'setNamespace',
  17316. value: function setNamespace(value) {
  17317. this.namespace = value;
  17318. }
  17319. }]);
  17320. return EventFormatter;
  17321. }();
  17322. /**
  17323. * This class represents a Pusher channel.
  17324. */
  17325. var PusherChannel = function (_Channel) {
  17326. inherits(PusherChannel, _Channel);
  17327. /**
  17328. * Create a new class instance.
  17329. */
  17330. function PusherChannel(pusher, name, options) {
  17331. classCallCheck(this, PusherChannel);
  17332. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17333. _this.name = name;
  17334. _this.pusher = pusher;
  17335. _this.options = options;
  17336. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17337. _this.subscribe();
  17338. return _this;
  17339. }
  17340. /**
  17341. * Subscribe to a Pusher channel.
  17342. */
  17343. createClass(PusherChannel, [{
  17344. key: 'subscribe',
  17345. value: function subscribe() {
  17346. this.subscription = this.pusher.subscribe(this.name);
  17347. }
  17348. /**
  17349. * Unsubscribe from a Pusher channel.
  17350. */
  17351. }, {
  17352. key: 'unsubscribe',
  17353. value: function unsubscribe() {
  17354. this.pusher.unsubscribe(this.name);
  17355. }
  17356. /**
  17357. * Listen for an event on the channel instance.
  17358. */
  17359. }, {
  17360. key: 'listen',
  17361. value: function listen(event, callback) {
  17362. this.on(this.eventFormatter.format(event), callback);
  17363. return this;
  17364. }
  17365. /**
  17366. * Stop listening for an event on the channel instance.
  17367. */
  17368. }, {
  17369. key: 'stopListening',
  17370. value: function stopListening(event) {
  17371. this.subscription.unbind(this.eventFormatter.format(event));
  17372. return this;
  17373. }
  17374. /**
  17375. * Bind a channel to an event.
  17376. */
  17377. }, {
  17378. key: 'on',
  17379. value: function on(event, callback) {
  17380. this.subscription.bind(event, callback);
  17381. return this;
  17382. }
  17383. }]);
  17384. return PusherChannel;
  17385. }(Channel);
  17386. /**
  17387. * This class represents a Pusher private channel.
  17388. */
  17389. var PusherPrivateChannel = function (_PusherChannel) {
  17390. inherits(PusherPrivateChannel, _PusherChannel);
  17391. function PusherPrivateChannel() {
  17392. classCallCheck(this, PusherPrivateChannel);
  17393. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17394. }
  17395. createClass(PusherPrivateChannel, [{
  17396. key: 'whisper',
  17397. /**
  17398. * Trigger client event on the channel.
  17399. */
  17400. value: function whisper(eventName, data) {
  17401. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17402. return this;
  17403. }
  17404. }]);
  17405. return PusherPrivateChannel;
  17406. }(PusherChannel);
  17407. /**
  17408. * This class represents a Pusher presence channel.
  17409. */
  17410. var PusherPresenceChannel = function (_PusherChannel) {
  17411. inherits(PusherPresenceChannel, _PusherChannel);
  17412. function PusherPresenceChannel() {
  17413. classCallCheck(this, PusherPresenceChannel);
  17414. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17415. }
  17416. createClass(PusherPresenceChannel, [{
  17417. key: 'here',
  17418. /**
  17419. * Register a callback to be called anytime the member list changes.
  17420. */
  17421. value: function here(callback) {
  17422. this.on('pusher:subscription_succeeded', function (data) {
  17423. callback(Object.keys(data.members).map(function (k) {
  17424. return data.members[k];
  17425. }));
  17426. });
  17427. return this;
  17428. }
  17429. /**
  17430. * Listen for someone joining the channel.
  17431. */
  17432. }, {
  17433. key: 'joining',
  17434. value: function joining(callback) {
  17435. this.on('pusher:member_added', function (member) {
  17436. callback(member.info);
  17437. });
  17438. return this;
  17439. }
  17440. /**
  17441. * Listen for someone leaving the channel.
  17442. */
  17443. }, {
  17444. key: 'leaving',
  17445. value: function leaving(callback) {
  17446. this.on('pusher:member_removed', function (member) {
  17447. callback(member.info);
  17448. });
  17449. return this;
  17450. }
  17451. /**
  17452. * Trigger client event on the channel.
  17453. */
  17454. }, {
  17455. key: 'whisper',
  17456. value: function whisper(eventName, data) {
  17457. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17458. return this;
  17459. }
  17460. }]);
  17461. return PusherPresenceChannel;
  17462. }(PusherChannel);
  17463. /**
  17464. * This class represents a Socket.io channel.
  17465. */
  17466. var SocketIoChannel = function (_Channel) {
  17467. inherits(SocketIoChannel, _Channel);
  17468. /**
  17469. * Create a new class instance.
  17470. */
  17471. function SocketIoChannel(socket, name, options) {
  17472. classCallCheck(this, SocketIoChannel);
  17473. /**
  17474. * The event callbacks applied to the channel.
  17475. */
  17476. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17477. _this.events = {};
  17478. _this.name = name;
  17479. _this.socket = socket;
  17480. _this.options = options;
  17481. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17482. _this.subscribe();
  17483. _this.configureReconnector();
  17484. return _this;
  17485. }
  17486. /**
  17487. * Subscribe to a Socket.io channel.
  17488. */
  17489. createClass(SocketIoChannel, [{
  17490. key: 'subscribe',
  17491. value: function subscribe() {
  17492. this.socket.emit('subscribe', {
  17493. channel: this.name,
  17494. auth: this.options.auth || {}
  17495. });
  17496. }
  17497. /**
  17498. * Unsubscribe from channel and ubind event callbacks.
  17499. */
  17500. }, {
  17501. key: 'unsubscribe',
  17502. value: function unsubscribe() {
  17503. this.unbind();
  17504. this.socket.emit('unsubscribe', {
  17505. channel: this.name,
  17506. auth: this.options.auth || {}
  17507. });
  17508. }
  17509. /**
  17510. * Listen for an event on the channel instance.
  17511. */
  17512. }, {
  17513. key: 'listen',
  17514. value: function listen(event, callback) {
  17515. this.on(this.eventFormatter.format(event), callback);
  17516. return this;
  17517. }
  17518. /**
  17519. * Stop listening for an event on the channel instance.
  17520. */
  17521. }, {
  17522. key: 'stopListening',
  17523. value: function stopListening(event) {
  17524. var name = this.eventFormatter.format(event);
  17525. this.socket.removeListener(name);
  17526. delete this.events[name];
  17527. return this;
  17528. }
  17529. /**
  17530. * Bind the channel's socket to an event and store the callback.
  17531. */
  17532. }, {
  17533. key: 'on',
  17534. value: function on(event, callback) {
  17535. var _this2 = this;
  17536. var listener = function listener(channel, data) {
  17537. if (_this2.name == channel) {
  17538. callback(data);
  17539. }
  17540. };
  17541. this.socket.on(event, listener);
  17542. this.bind(event, listener);
  17543. }
  17544. /**
  17545. * Attach a 'reconnect' listener and bind the event.
  17546. */
  17547. }, {
  17548. key: 'configureReconnector',
  17549. value: function configureReconnector() {
  17550. var _this3 = this;
  17551. var listener = function listener() {
  17552. _this3.subscribe();
  17553. };
  17554. this.socket.on('reconnect', listener);
  17555. this.bind('reconnect', listener);
  17556. }
  17557. /**
  17558. * Bind the channel's socket to an event and store the callback.
  17559. */
  17560. }, {
  17561. key: 'bind',
  17562. value: function bind(event, callback) {
  17563. this.events[event] = this.events[event] || [];
  17564. this.events[event].push(callback);
  17565. }
  17566. /**
  17567. * Unbind the channel's socket from all stored event callbacks.
  17568. */
  17569. }, {
  17570. key: 'unbind',
  17571. value: function unbind() {
  17572. var _this4 = this;
  17573. Object.keys(this.events).forEach(function (event) {
  17574. _this4.events[event].forEach(function (callback) {
  17575. _this4.socket.removeListener(event, callback);
  17576. });
  17577. delete _this4.events[event];
  17578. });
  17579. }
  17580. }]);
  17581. return SocketIoChannel;
  17582. }(Channel);
  17583. /**
  17584. * This class represents a Socket.io presence channel.
  17585. */
  17586. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17587. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17588. function SocketIoPrivateChannel() {
  17589. classCallCheck(this, SocketIoPrivateChannel);
  17590. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17591. }
  17592. createClass(SocketIoPrivateChannel, [{
  17593. key: 'whisper',
  17594. /**
  17595. * Trigger client event on the channel.
  17596. */
  17597. value: function whisper(eventName, data) {
  17598. this.socket.emit('client event', {
  17599. channel: this.name,
  17600. event: 'client-' + eventName,
  17601. data: data
  17602. });
  17603. return this;
  17604. }
  17605. }]);
  17606. return SocketIoPrivateChannel;
  17607. }(SocketIoChannel);
  17608. /**
  17609. * This class represents a Socket.io presence channel.
  17610. */
  17611. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17612. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17613. function SocketIoPresenceChannel() {
  17614. classCallCheck(this, SocketIoPresenceChannel);
  17615. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17616. }
  17617. createClass(SocketIoPresenceChannel, [{
  17618. key: 'here',
  17619. /**
  17620. * Register a callback to be called anytime the member list changes.
  17621. */
  17622. value: function here(callback) {
  17623. this.on('presence:subscribed', function (members) {
  17624. callback(members.map(function (m) {
  17625. return m.user_info;
  17626. }));
  17627. });
  17628. return this;
  17629. }
  17630. /**
  17631. * Listen for someone joining the channel.
  17632. */
  17633. }, {
  17634. key: 'joining',
  17635. value: function joining(callback) {
  17636. this.on('presence:joining', function (member) {
  17637. return callback(member.user_info);
  17638. });
  17639. return this;
  17640. }
  17641. /**
  17642. * Listen for someone leaving the channel.
  17643. */
  17644. }, {
  17645. key: 'leaving',
  17646. value: function leaving(callback) {
  17647. this.on('presence:leaving', function (member) {
  17648. return callback(member.user_info);
  17649. });
  17650. return this;
  17651. }
  17652. }]);
  17653. return SocketIoPresenceChannel;
  17654. }(SocketIoPrivateChannel);
  17655. /**
  17656. * This class represents a null channel.
  17657. */
  17658. var NullChannel = function (_Channel) {
  17659. inherits(NullChannel, _Channel);
  17660. function NullChannel() {
  17661. classCallCheck(this, NullChannel);
  17662. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17663. }
  17664. createClass(NullChannel, [{
  17665. key: 'subscribe',
  17666. /**
  17667. * Subscribe to a channel.
  17668. */
  17669. value: function subscribe() {}
  17670. //
  17671. /**
  17672. * Unsubscribe from a channel.
  17673. */
  17674. }, {
  17675. key: 'unsubscribe',
  17676. value: function unsubscribe() {}
  17677. //
  17678. /**
  17679. * Listen for an event on the channel instance.
  17680. */
  17681. }, {
  17682. key: 'listen',
  17683. value: function listen(event, callback) {
  17684. return this;
  17685. }
  17686. /**
  17687. * Stop listening for an event on the channel instance.
  17688. */
  17689. }, {
  17690. key: 'stopListening',
  17691. value: function stopListening(event) {
  17692. return this;
  17693. }
  17694. /**
  17695. * Bind a channel to an event.
  17696. */
  17697. }, {
  17698. key: 'on',
  17699. value: function on(event, callback) {
  17700. return this;
  17701. }
  17702. }]);
  17703. return NullChannel;
  17704. }(Channel);
  17705. /**
  17706. * This class represents a null private channel.
  17707. */
  17708. var NullPrivateChannel = function (_NullChannel) {
  17709. inherits(NullPrivateChannel, _NullChannel);
  17710. function NullPrivateChannel() {
  17711. classCallCheck(this, NullPrivateChannel);
  17712. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17713. }
  17714. createClass(NullPrivateChannel, [{
  17715. key: 'whisper',
  17716. /**
  17717. * Trigger client event on the channel.
  17718. */
  17719. value: function whisper(eventName, data) {
  17720. return this;
  17721. }
  17722. }]);
  17723. return NullPrivateChannel;
  17724. }(NullChannel);
  17725. /**
  17726. * This class represents a null presence channel.
  17727. */
  17728. var NullPresenceChannel = function (_NullChannel) {
  17729. inherits(NullPresenceChannel, _NullChannel);
  17730. function NullPresenceChannel() {
  17731. classCallCheck(this, NullPresenceChannel);
  17732. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17733. }
  17734. createClass(NullPresenceChannel, [{
  17735. key: 'here',
  17736. /**
  17737. * Register a callback to be called anytime the member list changes.
  17738. */
  17739. value: function here(callback) {
  17740. return this;
  17741. }
  17742. /**
  17743. * Listen for someone joining the channel.
  17744. */
  17745. }, {
  17746. key: 'joining',
  17747. value: function joining(callback) {
  17748. return this;
  17749. }
  17750. /**
  17751. * Listen for someone leaving the channel.
  17752. */
  17753. }, {
  17754. key: 'leaving',
  17755. value: function leaving(callback) {
  17756. return this;
  17757. }
  17758. /**
  17759. * Trigger client event on the channel.
  17760. */
  17761. }, {
  17762. key: 'whisper',
  17763. value: function whisper(eventName, data) {
  17764. return this;
  17765. }
  17766. }]);
  17767. return NullPresenceChannel;
  17768. }(NullChannel);
  17769. /**
  17770. * This class creates a connector to Pusher.
  17771. */
  17772. var PusherConnector = function (_Connector) {
  17773. inherits(PusherConnector, _Connector);
  17774. function PusherConnector() {
  17775. classCallCheck(this, PusherConnector);
  17776. /**
  17777. * All of the subscribed channel names.
  17778. */
  17779. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17780. _this.channels = {};
  17781. return _this;
  17782. }
  17783. /**
  17784. * Create a fresh Pusher connection.
  17785. */
  17786. createClass(PusherConnector, [{
  17787. key: 'connect',
  17788. value: function connect() {
  17789. if (typeof this.options.client !== 'undefined') {
  17790. this.pusher = this.options.client;
  17791. } else {
  17792. this.pusher = new Pusher(this.options.key, this.options);
  17793. }
  17794. }
  17795. /**
  17796. * Listen for an event on a channel instance.
  17797. */
  17798. }, {
  17799. key: 'listen',
  17800. value: function listen(name, event, callback) {
  17801. return this.channel(name).listen(event, callback);
  17802. }
  17803. /**
  17804. * Get a channel instance by name.
  17805. */
  17806. }, {
  17807. key: 'channel',
  17808. value: function channel(name) {
  17809. if (!this.channels[name]) {
  17810. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17811. }
  17812. return this.channels[name];
  17813. }
  17814. /**
  17815. * Get a private channel instance by name.
  17816. */
  17817. }, {
  17818. key: 'privateChannel',
  17819. value: function privateChannel(name) {
  17820. if (!this.channels['private-' + name]) {
  17821. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17822. }
  17823. return this.channels['private-' + name];
  17824. }
  17825. /**
  17826. * Get a presence channel instance by name.
  17827. */
  17828. }, {
  17829. key: 'presenceChannel',
  17830. value: function presenceChannel(name) {
  17831. if (!this.channels['presence-' + name]) {
  17832. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17833. }
  17834. return this.channels['presence-' + name];
  17835. }
  17836. /**
  17837. * Leave the given channel, as well as its private and presence variants.
  17838. */
  17839. }, {
  17840. key: 'leave',
  17841. value: function leave(name) {
  17842. var _this2 = this;
  17843. var channels = [name, 'private-' + name, 'presence-' + name];
  17844. channels.forEach(function (name, index) {
  17845. _this2.leaveChannel(name);
  17846. });
  17847. }
  17848. /**
  17849. * Leave the given channel.
  17850. */
  17851. }, {
  17852. key: 'leaveChannel',
  17853. value: function leaveChannel(name) {
  17854. if (this.channels[name]) {
  17855. this.channels[name].unsubscribe();
  17856. delete this.channels[name];
  17857. }
  17858. }
  17859. /**
  17860. * Get the socket ID for the connection.
  17861. */
  17862. }, {
  17863. key: 'socketId',
  17864. value: function socketId() {
  17865. return this.pusher.connection.socket_id;
  17866. }
  17867. /**
  17868. * Disconnect Pusher connection.
  17869. */
  17870. }, {
  17871. key: 'disconnect',
  17872. value: function disconnect() {
  17873. this.pusher.disconnect();
  17874. }
  17875. }]);
  17876. return PusherConnector;
  17877. }(Connector);
  17878. /**
  17879. * This class creates a connnector to a Socket.io server.
  17880. */
  17881. var SocketIoConnector = function (_Connector) {
  17882. inherits(SocketIoConnector, _Connector);
  17883. function SocketIoConnector() {
  17884. classCallCheck(this, SocketIoConnector);
  17885. /**
  17886. * All of the subscribed channel names.
  17887. */
  17888. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17889. _this.channels = {};
  17890. return _this;
  17891. }
  17892. /**
  17893. * Create a fresh Socket.io connection.
  17894. */
  17895. createClass(SocketIoConnector, [{
  17896. key: 'connect',
  17897. value: function connect() {
  17898. var io = this.getSocketIO();
  17899. this.socket = io(this.options.host, this.options);
  17900. return this.socket;
  17901. }
  17902. /**
  17903. * Get socket.io module from global scope or options.
  17904. */
  17905. }, {
  17906. key: 'getSocketIO',
  17907. value: function getSocketIO() {
  17908. if (typeof this.options.client !== 'undefined') {
  17909. return this.options.client;
  17910. }
  17911. if (typeof io !== 'undefined') {
  17912. return io;
  17913. }
  17914. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17915. }
  17916. /**
  17917. * Listen for an event on a channel instance.
  17918. */
  17919. }, {
  17920. key: 'listen',
  17921. value: function listen(name, event, callback) {
  17922. return this.channel(name).listen(event, callback);
  17923. }
  17924. /**
  17925. * Get a channel instance by name.
  17926. */
  17927. }, {
  17928. key: 'channel',
  17929. value: function channel(name) {
  17930. if (!this.channels[name]) {
  17931. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17932. }
  17933. return this.channels[name];
  17934. }
  17935. /**
  17936. * Get a private channel instance by name.
  17937. */
  17938. }, {
  17939. key: 'privateChannel',
  17940. value: function privateChannel(name) {
  17941. if (!this.channels['private-' + name]) {
  17942. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17943. }
  17944. return this.channels['private-' + name];
  17945. }
  17946. /**
  17947. * Get a presence channel instance by name.
  17948. */
  17949. }, {
  17950. key: 'presenceChannel',
  17951. value: function presenceChannel(name) {
  17952. if (!this.channels['presence-' + name]) {
  17953. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17954. }
  17955. return this.channels['presence-' + name];
  17956. }
  17957. /**
  17958. * Leave the given channel, as well as its private and presence variants.
  17959. */
  17960. }, {
  17961. key: 'leave',
  17962. value: function leave(name) {
  17963. var _this2 = this;
  17964. var channels = [name, 'private-' + name, 'presence-' + name];
  17965. channels.forEach(function (name) {
  17966. _this2.leaveChannel(name);
  17967. });
  17968. }
  17969. /**
  17970. * Leave the given channel.
  17971. */
  17972. }, {
  17973. key: 'leaveChannel',
  17974. value: function leaveChannel(name) {
  17975. if (this.channels[name]) {
  17976. this.channels[name].unsubscribe();
  17977. delete this.channels[name];
  17978. }
  17979. }
  17980. /**
  17981. * Get the socket ID for the connection.
  17982. */
  17983. }, {
  17984. key: 'socketId',
  17985. value: function socketId() {
  17986. return this.socket.id;
  17987. }
  17988. /**
  17989. * Disconnect Socketio connection.
  17990. */
  17991. }, {
  17992. key: 'disconnect',
  17993. value: function disconnect() {
  17994. this.socket.disconnect();
  17995. }
  17996. }]);
  17997. return SocketIoConnector;
  17998. }(Connector);
  17999. /**
  18000. * This class creates a null connector.
  18001. */
  18002. var NullConnector = function (_Connector) {
  18003. inherits(NullConnector, _Connector);
  18004. function NullConnector() {
  18005. classCallCheck(this, NullConnector);
  18006. /**
  18007. * All of the subscribed channel names.
  18008. */
  18009. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18010. _this.channels = {};
  18011. return _this;
  18012. }
  18013. /**
  18014. * Create a fresh connection.
  18015. */
  18016. createClass(NullConnector, [{
  18017. key: 'connect',
  18018. value: function connect() {}
  18019. //
  18020. /**
  18021. * Listen for an event on a channel instance.
  18022. */
  18023. }, {
  18024. key: 'listen',
  18025. value: function listen(name, event, callback) {
  18026. return new NullChannel();
  18027. }
  18028. /**
  18029. * Get a channel instance by name.
  18030. */
  18031. }, {
  18032. key: 'channel',
  18033. value: function channel(name) {
  18034. return new NullChannel();
  18035. }
  18036. /**
  18037. * Get a private channel instance by name.
  18038. */
  18039. }, {
  18040. key: 'privateChannel',
  18041. value: function privateChannel(name) {
  18042. return new NullPrivateChannel();
  18043. }
  18044. /**
  18045. * Get a presence channel instance by name.
  18046. */
  18047. }, {
  18048. key: 'presenceChannel',
  18049. value: function presenceChannel(name) {
  18050. return new NullPresenceChannel();
  18051. }
  18052. /**
  18053. * Leave the given channel, as well as its private and presence variants.
  18054. */
  18055. }, {
  18056. key: 'leave',
  18057. value: function leave(name) {}
  18058. //
  18059. /**
  18060. * Leave the given channel.
  18061. */
  18062. }, {
  18063. key: 'leaveChannel',
  18064. value: function leaveChannel(name) {}
  18065. //
  18066. /**
  18067. * Get the socket ID for the connection.
  18068. */
  18069. }, {
  18070. key: 'socketId',
  18071. value: function socketId() {
  18072. return 'fake-socket-id';
  18073. }
  18074. /**
  18075. * Disconnect the connection.
  18076. */
  18077. }, {
  18078. key: 'disconnect',
  18079. value: function disconnect() {
  18080. //
  18081. }
  18082. }]);
  18083. return NullConnector;
  18084. }(Connector);
  18085. /**
  18086. * This class is the primary API for interacting with broadcasting.
  18087. */
  18088. var Echo = function () {
  18089. /**
  18090. * Create a new class instance.
  18091. */
  18092. function Echo(options) {
  18093. classCallCheck(this, Echo);
  18094. this.options = options;
  18095. this.connect();
  18096. if (!this.options.withoutInterceptors) {
  18097. this.registerInterceptors();
  18098. }
  18099. }
  18100. /**
  18101. * Get a channel instance by name.
  18102. */
  18103. createClass(Echo, [{
  18104. key: 'channel',
  18105. value: function channel(_channel) {
  18106. return this.connector.channel(_channel);
  18107. }
  18108. /**
  18109. * Create a new connection.
  18110. */
  18111. }, {
  18112. key: 'connect',
  18113. value: function connect() {
  18114. if (this.options.broadcaster == 'pusher') {
  18115. this.connector = new PusherConnector(this.options);
  18116. } else if (this.options.broadcaster == 'socket.io') {
  18117. this.connector = new SocketIoConnector(this.options);
  18118. } else if (this.options.broadcaster == 'null') {
  18119. this.connector = new NullConnector(this.options);
  18120. } else if (typeof this.options.broadcaster == 'function') {
  18121. this.connector = new this.options.broadcaster(this.options);
  18122. }
  18123. }
  18124. /**
  18125. * Disconnect from the Echo server.
  18126. */
  18127. }, {
  18128. key: 'disconnect',
  18129. value: function disconnect() {
  18130. this.connector.disconnect();
  18131. }
  18132. /**
  18133. * Get a presence channel instance by name.
  18134. */
  18135. }, {
  18136. key: 'join',
  18137. value: function join(channel) {
  18138. return this.connector.presenceChannel(channel);
  18139. }
  18140. /**
  18141. * Leave the given channel, as well as its private and presence variants.
  18142. */
  18143. }, {
  18144. key: 'leave',
  18145. value: function leave(channel) {
  18146. this.connector.leave(channel);
  18147. }
  18148. /**
  18149. * Leave the given channel.
  18150. */
  18151. }, {
  18152. key: 'leaveChannel',
  18153. value: function leaveChannel(channel) {
  18154. this.connector.leaveChannel(channel);
  18155. }
  18156. /**
  18157. * Listen for an event on a channel instance.
  18158. */
  18159. }, {
  18160. key: 'listen',
  18161. value: function listen(channel, event, callback) {
  18162. return this.connector.listen(channel, event, callback);
  18163. }
  18164. /**
  18165. * Get a private channel instance by name.
  18166. */
  18167. }, {
  18168. key: 'private',
  18169. value: function _private(channel) {
  18170. return this.connector.privateChannel(channel);
  18171. }
  18172. /**
  18173. * Get the Socket ID for the connection.
  18174. */
  18175. }, {
  18176. key: 'socketId',
  18177. value: function socketId() {
  18178. return this.connector.socketId();
  18179. }
  18180. /**
  18181. * Register 3rd party request interceptiors. These are used to automatically
  18182. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18183. */
  18184. }, {
  18185. key: 'registerInterceptors',
  18186. value: function registerInterceptors() {
  18187. if (typeof Vue === 'function' && Vue.http) {
  18188. this.registerVueRequestInterceptor();
  18189. }
  18190. if (typeof axios === 'function') {
  18191. this.registerAxiosRequestInterceptor();
  18192. }
  18193. if (typeof jQuery === 'function') {
  18194. this.registerjQueryAjaxSetup();
  18195. }
  18196. }
  18197. /**
  18198. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18199. */
  18200. }, {
  18201. key: 'registerVueRequestInterceptor',
  18202. value: function registerVueRequestInterceptor() {
  18203. var _this = this;
  18204. Vue.http.interceptors.push(function (request, next) {
  18205. if (_this.socketId()) {
  18206. request.headers.set('X-Socket-ID', _this.socketId());
  18207. }
  18208. next();
  18209. });
  18210. }
  18211. /**
  18212. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18213. */
  18214. }, {
  18215. key: 'registerAxiosRequestInterceptor',
  18216. value: function registerAxiosRequestInterceptor() {
  18217. var _this2 = this;
  18218. axios.interceptors.request.use(function (config) {
  18219. if (_this2.socketId()) {
  18220. config.headers['X-Socket-Id'] = _this2.socketId();
  18221. }
  18222. return config;
  18223. });
  18224. }
  18225. /**
  18226. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18227. */
  18228. }, {
  18229. key: 'registerjQueryAjaxSetup',
  18230. value: function registerjQueryAjaxSetup() {
  18231. var _this3 = this;
  18232. if (typeof jQuery.ajax != 'undefined') {
  18233. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18234. if (_this3.socketId()) {
  18235. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18236. }
  18237. });
  18238. }
  18239. }
  18240. }]);
  18241. return Echo;
  18242. }();
  18243. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18244. /***/ }),
  18245. /***/ "./node_modules/lodash/lodash.js":
  18246. /*!***************************************!*\
  18247. !*** ./node_modules/lodash/lodash.js ***!
  18248. \***************************************/
  18249. /*! no static exports found */
  18250. /***/ (function(module, exports, __webpack_require__) {
  18251. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18252. * @license
  18253. * Lodash <https://lodash.com/>
  18254. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18255. * Released under MIT license <https://lodash.com/license>
  18256. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18257. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18258. */
  18259. ;(function() {
  18260. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18261. var undefined;
  18262. /** Used as the semantic version number. */
  18263. var VERSION = '4.17.15';
  18264. /** Used as the size to enable large array optimizations. */
  18265. var LARGE_ARRAY_SIZE = 200;
  18266. /** Error message constants. */
  18267. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18268. FUNC_ERROR_TEXT = 'Expected a function';
  18269. /** Used to stand-in for `undefined` hash values. */
  18270. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18271. /** Used as the maximum memoize cache size. */
  18272. var MAX_MEMOIZE_SIZE = 500;
  18273. /** Used as the internal argument placeholder. */
  18274. var PLACEHOLDER = '__lodash_placeholder__';
  18275. /** Used to compose bitmasks for cloning. */
  18276. var CLONE_DEEP_FLAG = 1,
  18277. CLONE_FLAT_FLAG = 2,
  18278. CLONE_SYMBOLS_FLAG = 4;
  18279. /** Used to compose bitmasks for value comparisons. */
  18280. var COMPARE_PARTIAL_FLAG = 1,
  18281. COMPARE_UNORDERED_FLAG = 2;
  18282. /** Used to compose bitmasks for function metadata. */
  18283. var WRAP_BIND_FLAG = 1,
  18284. WRAP_BIND_KEY_FLAG = 2,
  18285. WRAP_CURRY_BOUND_FLAG = 4,
  18286. WRAP_CURRY_FLAG = 8,
  18287. WRAP_CURRY_RIGHT_FLAG = 16,
  18288. WRAP_PARTIAL_FLAG = 32,
  18289. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18290. WRAP_ARY_FLAG = 128,
  18291. WRAP_REARG_FLAG = 256,
  18292. WRAP_FLIP_FLAG = 512;
  18293. /** Used as default options for `_.truncate`. */
  18294. var DEFAULT_TRUNC_LENGTH = 30,
  18295. DEFAULT_TRUNC_OMISSION = '...';
  18296. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18297. var HOT_COUNT = 800,
  18298. HOT_SPAN = 16;
  18299. /** Used to indicate the type of lazy iteratees. */
  18300. var LAZY_FILTER_FLAG = 1,
  18301. LAZY_MAP_FLAG = 2,
  18302. LAZY_WHILE_FLAG = 3;
  18303. /** Used as references for various `Number` constants. */
  18304. var INFINITY = 1 / 0,
  18305. MAX_SAFE_INTEGER = 9007199254740991,
  18306. MAX_INTEGER = 1.7976931348623157e+308,
  18307. NAN = 0 / 0;
  18308. /** Used as references for the maximum length and index of an array. */
  18309. var MAX_ARRAY_LENGTH = 4294967295,
  18310. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18311. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18312. /** Used to associate wrap methods with their bit flags. */
  18313. var wrapFlags = [
  18314. ['ary', WRAP_ARY_FLAG],
  18315. ['bind', WRAP_BIND_FLAG],
  18316. ['bindKey', WRAP_BIND_KEY_FLAG],
  18317. ['curry', WRAP_CURRY_FLAG],
  18318. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18319. ['flip', WRAP_FLIP_FLAG],
  18320. ['partial', WRAP_PARTIAL_FLAG],
  18321. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18322. ['rearg', WRAP_REARG_FLAG]
  18323. ];
  18324. /** `Object#toString` result references. */
  18325. var argsTag = '[object Arguments]',
  18326. arrayTag = '[object Array]',
  18327. asyncTag = '[object AsyncFunction]',
  18328. boolTag = '[object Boolean]',
  18329. dateTag = '[object Date]',
  18330. domExcTag = '[object DOMException]',
  18331. errorTag = '[object Error]',
  18332. funcTag = '[object Function]',
  18333. genTag = '[object GeneratorFunction]',
  18334. mapTag = '[object Map]',
  18335. numberTag = '[object Number]',
  18336. nullTag = '[object Null]',
  18337. objectTag = '[object Object]',
  18338. promiseTag = '[object Promise]',
  18339. proxyTag = '[object Proxy]',
  18340. regexpTag = '[object RegExp]',
  18341. setTag = '[object Set]',
  18342. stringTag = '[object String]',
  18343. symbolTag = '[object Symbol]',
  18344. undefinedTag = '[object Undefined]',
  18345. weakMapTag = '[object WeakMap]',
  18346. weakSetTag = '[object WeakSet]';
  18347. var arrayBufferTag = '[object ArrayBuffer]',
  18348. dataViewTag = '[object DataView]',
  18349. float32Tag = '[object Float32Array]',
  18350. float64Tag = '[object Float64Array]',
  18351. int8Tag = '[object Int8Array]',
  18352. int16Tag = '[object Int16Array]',
  18353. int32Tag = '[object Int32Array]',
  18354. uint8Tag = '[object Uint8Array]',
  18355. uint8ClampedTag = '[object Uint8ClampedArray]',
  18356. uint16Tag = '[object Uint16Array]',
  18357. uint32Tag = '[object Uint32Array]';
  18358. /** Used to match empty string literals in compiled template source. */
  18359. var reEmptyStringLeading = /\b__p \+= '';/g,
  18360. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18361. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18362. /** Used to match HTML entities and HTML characters. */
  18363. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18364. reUnescapedHtml = /[&<>"']/g,
  18365. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18366. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18367. /** Used to match template delimiters. */
  18368. var reEscape = /<%-([\s\S]+?)%>/g,
  18369. reEvaluate = /<%([\s\S]+?)%>/g,
  18370. reInterpolate = /<%=([\s\S]+?)%>/g;
  18371. /** Used to match property names within property paths. */
  18372. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18373. reIsPlainProp = /^\w*$/,
  18374. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18375. /**
  18376. * Used to match `RegExp`
  18377. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18378. */
  18379. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18380. reHasRegExpChar = RegExp(reRegExpChar.source);
  18381. /** Used to match leading and trailing whitespace. */
  18382. var reTrim = /^\s+|\s+$/g,
  18383. reTrimStart = /^\s+/,
  18384. reTrimEnd = /\s+$/;
  18385. /** Used to match wrap detail comments. */
  18386. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18387. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18388. reSplitDetails = /,? & /;
  18389. /** Used to match words composed of alphanumeric characters. */
  18390. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18391. /** Used to match backslashes in property paths. */
  18392. var reEscapeChar = /\\(\\)?/g;
  18393. /**
  18394. * Used to match
  18395. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18396. */
  18397. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18398. /** Used to match `RegExp` flags from their coerced string values. */
  18399. var reFlags = /\w*$/;
  18400. /** Used to detect bad signed hexadecimal string values. */
  18401. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18402. /** Used to detect binary string values. */
  18403. var reIsBinary = /^0b[01]+$/i;
  18404. /** Used to detect host constructors (Safari). */
  18405. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18406. /** Used to detect octal string values. */
  18407. var reIsOctal = /^0o[0-7]+$/i;
  18408. /** Used to detect unsigned integer values. */
  18409. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18410. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18411. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18412. /** Used to ensure capturing order of template delimiters. */
  18413. var reNoMatch = /($^)/;
  18414. /** Used to match unescaped characters in compiled string literals. */
  18415. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18416. /** Used to compose unicode character classes. */
  18417. var rsAstralRange = '\\ud800-\\udfff',
  18418. rsComboMarksRange = '\\u0300-\\u036f',
  18419. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18420. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18421. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18422. rsDingbatRange = '\\u2700-\\u27bf',
  18423. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18424. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18425. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18426. rsPunctuationRange = '\\u2000-\\u206f',
  18427. 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',
  18428. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18429. rsVarRange = '\\ufe0e\\ufe0f',
  18430. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18431. /** Used to compose unicode capture groups. */
  18432. var rsApos = "['\u2019]",
  18433. rsAstral = '[' + rsAstralRange + ']',
  18434. rsBreak = '[' + rsBreakRange + ']',
  18435. rsCombo = '[' + rsComboRange + ']',
  18436. rsDigits = '\\d+',
  18437. rsDingbat = '[' + rsDingbatRange + ']',
  18438. rsLower = '[' + rsLowerRange + ']',
  18439. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18440. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18441. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18442. rsNonAstral = '[^' + rsAstralRange + ']',
  18443. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18444. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18445. rsUpper = '[' + rsUpperRange + ']',
  18446. rsZWJ = '\\u200d';
  18447. /** Used to compose unicode regexes. */
  18448. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18449. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18450. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18451. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18452. reOptMod = rsModifier + '?',
  18453. rsOptVar = '[' + rsVarRange + ']?',
  18454. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18455. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18456. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18457. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18458. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18459. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18460. /** Used to match apostrophes. */
  18461. var reApos = RegExp(rsApos, 'g');
  18462. /**
  18463. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18464. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18465. */
  18466. var reComboMark = RegExp(rsCombo, 'g');
  18467. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18468. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18469. /** Used to match complex or compound words. */
  18470. var reUnicodeWord = RegExp([
  18471. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18472. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18473. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18474. rsUpper + '+' + rsOptContrUpper,
  18475. rsOrdUpper,
  18476. rsOrdLower,
  18477. rsDigits,
  18478. rsEmoji
  18479. ].join('|'), 'g');
  18480. /** 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/). */
  18481. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18482. /** Used to detect strings that need a more robust regexp to match words. */
  18483. 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 ]/;
  18484. /** Used to assign default `context` object properties. */
  18485. var contextProps = [
  18486. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18487. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18488. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18489. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18490. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18491. ];
  18492. /** Used to make template sourceURLs easier to identify. */
  18493. var templateCounter = -1;
  18494. /** Used to identify `toStringTag` values of typed arrays. */
  18495. var typedArrayTags = {};
  18496. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18497. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18498. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18499. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18500. typedArrayTags[uint32Tag] = true;
  18501. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18502. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18503. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18504. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18505. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18506. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18507. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18508. typedArrayTags[weakMapTag] = false;
  18509. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18510. var cloneableTags = {};
  18511. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18512. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18513. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18514. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18515. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18516. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18517. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18518. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18519. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18520. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18521. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18522. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18523. cloneableTags[weakMapTag] = false;
  18524. /** Used to map Latin Unicode letters to basic Latin letters. */
  18525. var deburredLetters = {
  18526. // Latin-1 Supplement block.
  18527. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18528. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18529. '\xc7': 'C', '\xe7': 'c',
  18530. '\xd0': 'D', '\xf0': 'd',
  18531. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18532. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18533. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18534. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18535. '\xd1': 'N', '\xf1': 'n',
  18536. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18537. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18538. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18539. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18540. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18541. '\xc6': 'Ae', '\xe6': 'ae',
  18542. '\xde': 'Th', '\xfe': 'th',
  18543. '\xdf': 'ss',
  18544. // Latin Extended-A block.
  18545. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18546. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18547. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18548. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18549. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18550. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18551. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18552. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18553. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18554. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18555. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18556. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18557. '\u0134': 'J', '\u0135': 'j',
  18558. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18559. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18560. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18561. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18562. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18563. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18564. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18565. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18566. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18567. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18568. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18569. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18570. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18571. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18572. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18573. '\u0174': 'W', '\u0175': 'w',
  18574. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18575. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18576. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18577. '\u0132': 'IJ', '\u0133': 'ij',
  18578. '\u0152': 'Oe', '\u0153': 'oe',
  18579. '\u0149': "'n", '\u017f': 's'
  18580. };
  18581. /** Used to map characters to HTML entities. */
  18582. var htmlEscapes = {
  18583. '&': '&amp;',
  18584. '<': '&lt;',
  18585. '>': '&gt;',
  18586. '"': '&quot;',
  18587. "'": '&#39;'
  18588. };
  18589. /** Used to map HTML entities to characters. */
  18590. var htmlUnescapes = {
  18591. '&amp;': '&',
  18592. '&lt;': '<',
  18593. '&gt;': '>',
  18594. '&quot;': '"',
  18595. '&#39;': "'"
  18596. };
  18597. /** Used to escape characters for inclusion in compiled string literals. */
  18598. var stringEscapes = {
  18599. '\\': '\\',
  18600. "'": "'",
  18601. '\n': 'n',
  18602. '\r': 'r',
  18603. '\u2028': 'u2028',
  18604. '\u2029': 'u2029'
  18605. };
  18606. /** Built-in method references without a dependency on `root`. */
  18607. var freeParseFloat = parseFloat,
  18608. freeParseInt = parseInt;
  18609. /** Detect free variable `global` from Node.js. */
  18610. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18611. /** Detect free variable `self`. */
  18612. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18613. /** Used as a reference to the global object. */
  18614. var root = freeGlobal || freeSelf || Function('return this')();
  18615. /** Detect free variable `exports`. */
  18616. var freeExports = true && exports && !exports.nodeType && exports;
  18617. /** Detect free variable `module`. */
  18618. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18619. /** Detect the popular CommonJS extension `module.exports`. */
  18620. var moduleExports = freeModule && freeModule.exports === freeExports;
  18621. /** Detect free variable `process` from Node.js. */
  18622. var freeProcess = moduleExports && freeGlobal.process;
  18623. /** Used to access faster Node.js helpers. */
  18624. var nodeUtil = (function() {
  18625. try {
  18626. // Use `util.types` for Node.js 10+.
  18627. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18628. if (types) {
  18629. return types;
  18630. }
  18631. // Legacy `process.binding('util')` for Node.js < 10.
  18632. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18633. } catch (e) {}
  18634. }());
  18635. /* Node.js helper references. */
  18636. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18637. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18638. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18639. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18640. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18641. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18642. /*--------------------------------------------------------------------------*/
  18643. /**
  18644. * A faster alternative to `Function#apply`, this function invokes `func`
  18645. * with the `this` binding of `thisArg` and the arguments of `args`.
  18646. *
  18647. * @private
  18648. * @param {Function} func The function to invoke.
  18649. * @param {*} thisArg The `this` binding of `func`.
  18650. * @param {Array} args The arguments to invoke `func` with.
  18651. * @returns {*} Returns the result of `func`.
  18652. */
  18653. function apply(func, thisArg, args) {
  18654. switch (args.length) {
  18655. case 0: return func.call(thisArg);
  18656. case 1: return func.call(thisArg, args[0]);
  18657. case 2: return func.call(thisArg, args[0], args[1]);
  18658. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18659. }
  18660. return func.apply(thisArg, args);
  18661. }
  18662. /**
  18663. * A specialized version of `baseAggregator` for arrays.
  18664. *
  18665. * @private
  18666. * @param {Array} [array] The array to iterate over.
  18667. * @param {Function} setter The function to set `accumulator` values.
  18668. * @param {Function} iteratee The iteratee to transform keys.
  18669. * @param {Object} accumulator The initial aggregated object.
  18670. * @returns {Function} Returns `accumulator`.
  18671. */
  18672. function arrayAggregator(array, setter, iteratee, accumulator) {
  18673. var index = -1,
  18674. length = array == null ? 0 : array.length;
  18675. while (++index < length) {
  18676. var value = array[index];
  18677. setter(accumulator, value, iteratee(value), array);
  18678. }
  18679. return accumulator;
  18680. }
  18681. /**
  18682. * A specialized version of `_.forEach` for arrays without support for
  18683. * iteratee shorthands.
  18684. *
  18685. * @private
  18686. * @param {Array} [array] The array to iterate over.
  18687. * @param {Function} iteratee The function invoked per iteration.
  18688. * @returns {Array} Returns `array`.
  18689. */
  18690. function arrayEach(array, iteratee) {
  18691. var index = -1,
  18692. length = array == null ? 0 : array.length;
  18693. while (++index < length) {
  18694. if (iteratee(array[index], index, array) === false) {
  18695. break;
  18696. }
  18697. }
  18698. return array;
  18699. }
  18700. /**
  18701. * A specialized version of `_.forEachRight` for arrays without support for
  18702. * iteratee shorthands.
  18703. *
  18704. * @private
  18705. * @param {Array} [array] The array to iterate over.
  18706. * @param {Function} iteratee The function invoked per iteration.
  18707. * @returns {Array} Returns `array`.
  18708. */
  18709. function arrayEachRight(array, iteratee) {
  18710. var length = array == null ? 0 : array.length;
  18711. while (length--) {
  18712. if (iteratee(array[length], length, array) === false) {
  18713. break;
  18714. }
  18715. }
  18716. return array;
  18717. }
  18718. /**
  18719. * A specialized version of `_.every` for arrays without support for
  18720. * iteratee shorthands.
  18721. *
  18722. * @private
  18723. * @param {Array} [array] The array to iterate over.
  18724. * @param {Function} predicate The function invoked per iteration.
  18725. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18726. * else `false`.
  18727. */
  18728. function arrayEvery(array, predicate) {
  18729. var index = -1,
  18730. length = array == null ? 0 : array.length;
  18731. while (++index < length) {
  18732. if (!predicate(array[index], index, array)) {
  18733. return false;
  18734. }
  18735. }
  18736. return true;
  18737. }
  18738. /**
  18739. * A specialized version of `_.filter` for arrays without support for
  18740. * iteratee shorthands.
  18741. *
  18742. * @private
  18743. * @param {Array} [array] The array to iterate over.
  18744. * @param {Function} predicate The function invoked per iteration.
  18745. * @returns {Array} Returns the new filtered array.
  18746. */
  18747. function arrayFilter(array, predicate) {
  18748. var index = -1,
  18749. length = array == null ? 0 : array.length,
  18750. resIndex = 0,
  18751. result = [];
  18752. while (++index < length) {
  18753. var value = array[index];
  18754. if (predicate(value, index, array)) {
  18755. result[resIndex++] = value;
  18756. }
  18757. }
  18758. return result;
  18759. }
  18760. /**
  18761. * A specialized version of `_.includes` for arrays without support for
  18762. * specifying an index to search from.
  18763. *
  18764. * @private
  18765. * @param {Array} [array] The array to inspect.
  18766. * @param {*} target The value to search for.
  18767. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18768. */
  18769. function arrayIncludes(array, value) {
  18770. var length = array == null ? 0 : array.length;
  18771. return !!length && baseIndexOf(array, value, 0) > -1;
  18772. }
  18773. /**
  18774. * This function is like `arrayIncludes` except that it accepts a comparator.
  18775. *
  18776. * @private
  18777. * @param {Array} [array] The array to inspect.
  18778. * @param {*} target The value to search for.
  18779. * @param {Function} comparator The comparator invoked per element.
  18780. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18781. */
  18782. function arrayIncludesWith(array, value, comparator) {
  18783. var index = -1,
  18784. length = array == null ? 0 : array.length;
  18785. while (++index < length) {
  18786. if (comparator(value, array[index])) {
  18787. return true;
  18788. }
  18789. }
  18790. return false;
  18791. }
  18792. /**
  18793. * A specialized version of `_.map` for arrays without support for iteratee
  18794. * shorthands.
  18795. *
  18796. * @private
  18797. * @param {Array} [array] The array to iterate over.
  18798. * @param {Function} iteratee The function invoked per iteration.
  18799. * @returns {Array} Returns the new mapped array.
  18800. */
  18801. function arrayMap(array, iteratee) {
  18802. var index = -1,
  18803. length = array == null ? 0 : array.length,
  18804. result = Array(length);
  18805. while (++index < length) {
  18806. result[index] = iteratee(array[index], index, array);
  18807. }
  18808. return result;
  18809. }
  18810. /**
  18811. * Appends the elements of `values` to `array`.
  18812. *
  18813. * @private
  18814. * @param {Array} array The array to modify.
  18815. * @param {Array} values The values to append.
  18816. * @returns {Array} Returns `array`.
  18817. */
  18818. function arrayPush(array, values) {
  18819. var index = -1,
  18820. length = values.length,
  18821. offset = array.length;
  18822. while (++index < length) {
  18823. array[offset + index] = values[index];
  18824. }
  18825. return array;
  18826. }
  18827. /**
  18828. * A specialized version of `_.reduce` for arrays without support for
  18829. * iteratee shorthands.
  18830. *
  18831. * @private
  18832. * @param {Array} [array] The array to iterate over.
  18833. * @param {Function} iteratee The function invoked per iteration.
  18834. * @param {*} [accumulator] The initial value.
  18835. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18836. * the initial value.
  18837. * @returns {*} Returns the accumulated value.
  18838. */
  18839. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18840. var index = -1,
  18841. length = array == null ? 0 : array.length;
  18842. if (initAccum && length) {
  18843. accumulator = array[++index];
  18844. }
  18845. while (++index < length) {
  18846. accumulator = iteratee(accumulator, array[index], index, array);
  18847. }
  18848. return accumulator;
  18849. }
  18850. /**
  18851. * A specialized version of `_.reduceRight` for arrays without support for
  18852. * iteratee shorthands.
  18853. *
  18854. * @private
  18855. * @param {Array} [array] The array to iterate over.
  18856. * @param {Function} iteratee The function invoked per iteration.
  18857. * @param {*} [accumulator] The initial value.
  18858. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18859. * the initial value.
  18860. * @returns {*} Returns the accumulated value.
  18861. */
  18862. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18863. var length = array == null ? 0 : array.length;
  18864. if (initAccum && length) {
  18865. accumulator = array[--length];
  18866. }
  18867. while (length--) {
  18868. accumulator = iteratee(accumulator, array[length], length, array);
  18869. }
  18870. return accumulator;
  18871. }
  18872. /**
  18873. * A specialized version of `_.some` for arrays without support for iteratee
  18874. * shorthands.
  18875. *
  18876. * @private
  18877. * @param {Array} [array] The array to iterate over.
  18878. * @param {Function} predicate The function invoked per iteration.
  18879. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18880. * else `false`.
  18881. */
  18882. function arraySome(array, predicate) {
  18883. var index = -1,
  18884. length = array == null ? 0 : array.length;
  18885. while (++index < length) {
  18886. if (predicate(array[index], index, array)) {
  18887. return true;
  18888. }
  18889. }
  18890. return false;
  18891. }
  18892. /**
  18893. * Gets the size of an ASCII `string`.
  18894. *
  18895. * @private
  18896. * @param {string} string The string inspect.
  18897. * @returns {number} Returns the string size.
  18898. */
  18899. var asciiSize = baseProperty('length');
  18900. /**
  18901. * Converts an ASCII `string` to an array.
  18902. *
  18903. * @private
  18904. * @param {string} string The string to convert.
  18905. * @returns {Array} Returns the converted array.
  18906. */
  18907. function asciiToArray(string) {
  18908. return string.split('');
  18909. }
  18910. /**
  18911. * Splits an ASCII `string` into an array of its words.
  18912. *
  18913. * @private
  18914. * @param {string} The string to inspect.
  18915. * @returns {Array} Returns the words of `string`.
  18916. */
  18917. function asciiWords(string) {
  18918. return string.match(reAsciiWord) || [];
  18919. }
  18920. /**
  18921. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18922. * without support for iteratee shorthands, which iterates over `collection`
  18923. * using `eachFunc`.
  18924. *
  18925. * @private
  18926. * @param {Array|Object} collection The collection to inspect.
  18927. * @param {Function} predicate The function invoked per iteration.
  18928. * @param {Function} eachFunc The function to iterate over `collection`.
  18929. * @returns {*} Returns the found element or its key, else `undefined`.
  18930. */
  18931. function baseFindKey(collection, predicate, eachFunc) {
  18932. var result;
  18933. eachFunc(collection, function(value, key, collection) {
  18934. if (predicate(value, key, collection)) {
  18935. result = key;
  18936. return false;
  18937. }
  18938. });
  18939. return result;
  18940. }
  18941. /**
  18942. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18943. * support for iteratee shorthands.
  18944. *
  18945. * @private
  18946. * @param {Array} array The array to inspect.
  18947. * @param {Function} predicate The function invoked per iteration.
  18948. * @param {number} fromIndex The index to search from.
  18949. * @param {boolean} [fromRight] Specify iterating from right to left.
  18950. * @returns {number} Returns the index of the matched value, else `-1`.
  18951. */
  18952. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18953. var length = array.length,
  18954. index = fromIndex + (fromRight ? 1 : -1);
  18955. while ((fromRight ? index-- : ++index < length)) {
  18956. if (predicate(array[index], index, array)) {
  18957. return index;
  18958. }
  18959. }
  18960. return -1;
  18961. }
  18962. /**
  18963. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18964. *
  18965. * @private
  18966. * @param {Array} array The array to inspect.
  18967. * @param {*} value The value to search for.
  18968. * @param {number} fromIndex The index to search from.
  18969. * @returns {number} Returns the index of the matched value, else `-1`.
  18970. */
  18971. function baseIndexOf(array, value, fromIndex) {
  18972. return value === value
  18973. ? strictIndexOf(array, value, fromIndex)
  18974. : baseFindIndex(array, baseIsNaN, fromIndex);
  18975. }
  18976. /**
  18977. * This function is like `baseIndexOf` except that it accepts a comparator.
  18978. *
  18979. * @private
  18980. * @param {Array} array The array to inspect.
  18981. * @param {*} value The value to search for.
  18982. * @param {number} fromIndex The index to search from.
  18983. * @param {Function} comparator The comparator invoked per element.
  18984. * @returns {number} Returns the index of the matched value, else `-1`.
  18985. */
  18986. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18987. var index = fromIndex - 1,
  18988. length = array.length;
  18989. while (++index < length) {
  18990. if (comparator(array[index], value)) {
  18991. return index;
  18992. }
  18993. }
  18994. return -1;
  18995. }
  18996. /**
  18997. * The base implementation of `_.isNaN` without support for number objects.
  18998. *
  18999. * @private
  19000. * @param {*} value The value to check.
  19001. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19002. */
  19003. function baseIsNaN(value) {
  19004. return value !== value;
  19005. }
  19006. /**
  19007. * The base implementation of `_.mean` and `_.meanBy` without support for
  19008. * iteratee shorthands.
  19009. *
  19010. * @private
  19011. * @param {Array} array The array to iterate over.
  19012. * @param {Function} iteratee The function invoked per iteration.
  19013. * @returns {number} Returns the mean.
  19014. */
  19015. function baseMean(array, iteratee) {
  19016. var length = array == null ? 0 : array.length;
  19017. return length ? (baseSum(array, iteratee) / length) : NAN;
  19018. }
  19019. /**
  19020. * The base implementation of `_.property` without support for deep paths.
  19021. *
  19022. * @private
  19023. * @param {string} key The key of the property to get.
  19024. * @returns {Function} Returns the new accessor function.
  19025. */
  19026. function baseProperty(key) {
  19027. return function(object) {
  19028. return object == null ? undefined : object[key];
  19029. };
  19030. }
  19031. /**
  19032. * The base implementation of `_.propertyOf` without support for deep paths.
  19033. *
  19034. * @private
  19035. * @param {Object} object The object to query.
  19036. * @returns {Function} Returns the new accessor function.
  19037. */
  19038. function basePropertyOf(object) {
  19039. return function(key) {
  19040. return object == null ? undefined : object[key];
  19041. };
  19042. }
  19043. /**
  19044. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19045. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19046. *
  19047. * @private
  19048. * @param {Array|Object} collection The collection to iterate over.
  19049. * @param {Function} iteratee The function invoked per iteration.
  19050. * @param {*} accumulator The initial value.
  19051. * @param {boolean} initAccum Specify using the first or last element of
  19052. * `collection` as the initial value.
  19053. * @param {Function} eachFunc The function to iterate over `collection`.
  19054. * @returns {*} Returns the accumulated value.
  19055. */
  19056. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19057. eachFunc(collection, function(value, index, collection) {
  19058. accumulator = initAccum
  19059. ? (initAccum = false, value)
  19060. : iteratee(accumulator, value, index, collection);
  19061. });
  19062. return accumulator;
  19063. }
  19064. /**
  19065. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19066. * sort order of `array` and replaces criteria objects with their corresponding
  19067. * values.
  19068. *
  19069. * @private
  19070. * @param {Array} array The array to sort.
  19071. * @param {Function} comparer The function to define sort order.
  19072. * @returns {Array} Returns `array`.
  19073. */
  19074. function baseSortBy(array, comparer) {
  19075. var length = array.length;
  19076. array.sort(comparer);
  19077. while (length--) {
  19078. array[length] = array[length].value;
  19079. }
  19080. return array;
  19081. }
  19082. /**
  19083. * The base implementation of `_.sum` and `_.sumBy` without support for
  19084. * iteratee shorthands.
  19085. *
  19086. * @private
  19087. * @param {Array} array The array to iterate over.
  19088. * @param {Function} iteratee The function invoked per iteration.
  19089. * @returns {number} Returns the sum.
  19090. */
  19091. function baseSum(array, iteratee) {
  19092. var result,
  19093. index = -1,
  19094. length = array.length;
  19095. while (++index < length) {
  19096. var current = iteratee(array[index]);
  19097. if (current !== undefined) {
  19098. result = result === undefined ? current : (result + current);
  19099. }
  19100. }
  19101. return result;
  19102. }
  19103. /**
  19104. * The base implementation of `_.times` without support for iteratee shorthands
  19105. * or max array length checks.
  19106. *
  19107. * @private
  19108. * @param {number} n The number of times to invoke `iteratee`.
  19109. * @param {Function} iteratee The function invoked per iteration.
  19110. * @returns {Array} Returns the array of results.
  19111. */
  19112. function baseTimes(n, iteratee) {
  19113. var index = -1,
  19114. result = Array(n);
  19115. while (++index < n) {
  19116. result[index] = iteratee(index);
  19117. }
  19118. return result;
  19119. }
  19120. /**
  19121. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19122. * of key-value pairs for `object` corresponding to the property names of `props`.
  19123. *
  19124. * @private
  19125. * @param {Object} object The object to query.
  19126. * @param {Array} props The property names to get values for.
  19127. * @returns {Object} Returns the key-value pairs.
  19128. */
  19129. function baseToPairs(object, props) {
  19130. return arrayMap(props, function(key) {
  19131. return [key, object[key]];
  19132. });
  19133. }
  19134. /**
  19135. * The base implementation of `_.unary` without support for storing metadata.
  19136. *
  19137. * @private
  19138. * @param {Function} func The function to cap arguments for.
  19139. * @returns {Function} Returns the new capped function.
  19140. */
  19141. function baseUnary(func) {
  19142. return function(value) {
  19143. return func(value);
  19144. };
  19145. }
  19146. /**
  19147. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19148. * array of `object` property values corresponding to the property names
  19149. * of `props`.
  19150. *
  19151. * @private
  19152. * @param {Object} object The object to query.
  19153. * @param {Array} props The property names to get values for.
  19154. * @returns {Object} Returns the array of property values.
  19155. */
  19156. function baseValues(object, props) {
  19157. return arrayMap(props, function(key) {
  19158. return object[key];
  19159. });
  19160. }
  19161. /**
  19162. * Checks if a `cache` value for `key` exists.
  19163. *
  19164. * @private
  19165. * @param {Object} cache The cache to query.
  19166. * @param {string} key The key of the entry to check.
  19167. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19168. */
  19169. function cacheHas(cache, key) {
  19170. return cache.has(key);
  19171. }
  19172. /**
  19173. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19174. * that is not found in the character symbols.
  19175. *
  19176. * @private
  19177. * @param {Array} strSymbols The string symbols to inspect.
  19178. * @param {Array} chrSymbols The character symbols to find.
  19179. * @returns {number} Returns the index of the first unmatched string symbol.
  19180. */
  19181. function charsStartIndex(strSymbols, chrSymbols) {
  19182. var index = -1,
  19183. length = strSymbols.length;
  19184. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19185. return index;
  19186. }
  19187. /**
  19188. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19189. * that is not found in the character symbols.
  19190. *
  19191. * @private
  19192. * @param {Array} strSymbols The string symbols to inspect.
  19193. * @param {Array} chrSymbols The character symbols to find.
  19194. * @returns {number} Returns the index of the last unmatched string symbol.
  19195. */
  19196. function charsEndIndex(strSymbols, chrSymbols) {
  19197. var index = strSymbols.length;
  19198. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19199. return index;
  19200. }
  19201. /**
  19202. * Gets the number of `placeholder` occurrences in `array`.
  19203. *
  19204. * @private
  19205. * @param {Array} array The array to inspect.
  19206. * @param {*} placeholder The placeholder to search for.
  19207. * @returns {number} Returns the placeholder count.
  19208. */
  19209. function countHolders(array, placeholder) {
  19210. var length = array.length,
  19211. result = 0;
  19212. while (length--) {
  19213. if (array[length] === placeholder) {
  19214. ++result;
  19215. }
  19216. }
  19217. return result;
  19218. }
  19219. /**
  19220. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19221. * letters to basic Latin letters.
  19222. *
  19223. * @private
  19224. * @param {string} letter The matched letter to deburr.
  19225. * @returns {string} Returns the deburred letter.
  19226. */
  19227. var deburrLetter = basePropertyOf(deburredLetters);
  19228. /**
  19229. * Used by `_.escape` to convert characters to HTML entities.
  19230. *
  19231. * @private
  19232. * @param {string} chr The matched character to escape.
  19233. * @returns {string} Returns the escaped character.
  19234. */
  19235. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19236. /**
  19237. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19238. *
  19239. * @private
  19240. * @param {string} chr The matched character to escape.
  19241. * @returns {string} Returns the escaped character.
  19242. */
  19243. function escapeStringChar(chr) {
  19244. return '\\' + stringEscapes[chr];
  19245. }
  19246. /**
  19247. * Gets the value at `key` of `object`.
  19248. *
  19249. * @private
  19250. * @param {Object} [object] The object to query.
  19251. * @param {string} key The key of the property to get.
  19252. * @returns {*} Returns the property value.
  19253. */
  19254. function getValue(object, key) {
  19255. return object == null ? undefined : object[key];
  19256. }
  19257. /**
  19258. * Checks if `string` contains Unicode symbols.
  19259. *
  19260. * @private
  19261. * @param {string} string The string to inspect.
  19262. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19263. */
  19264. function hasUnicode(string) {
  19265. return reHasUnicode.test(string);
  19266. }
  19267. /**
  19268. * Checks if `string` contains a word composed of Unicode symbols.
  19269. *
  19270. * @private
  19271. * @param {string} string The string to inspect.
  19272. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19273. */
  19274. function hasUnicodeWord(string) {
  19275. return reHasUnicodeWord.test(string);
  19276. }
  19277. /**
  19278. * Converts `iterator` to an array.
  19279. *
  19280. * @private
  19281. * @param {Object} iterator The iterator to convert.
  19282. * @returns {Array} Returns the converted array.
  19283. */
  19284. function iteratorToArray(iterator) {
  19285. var data,
  19286. result = [];
  19287. while (!(data = iterator.next()).done) {
  19288. result.push(data.value);
  19289. }
  19290. return result;
  19291. }
  19292. /**
  19293. * Converts `map` to its key-value pairs.
  19294. *
  19295. * @private
  19296. * @param {Object} map The map to convert.
  19297. * @returns {Array} Returns the key-value pairs.
  19298. */
  19299. function mapToArray(map) {
  19300. var index = -1,
  19301. result = Array(map.size);
  19302. map.forEach(function(value, key) {
  19303. result[++index] = [key, value];
  19304. });
  19305. return result;
  19306. }
  19307. /**
  19308. * Creates a unary function that invokes `func` with its argument transformed.
  19309. *
  19310. * @private
  19311. * @param {Function} func The function to wrap.
  19312. * @param {Function} transform The argument transform.
  19313. * @returns {Function} Returns the new function.
  19314. */
  19315. function overArg(func, transform) {
  19316. return function(arg) {
  19317. return func(transform(arg));
  19318. };
  19319. }
  19320. /**
  19321. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19322. * and returns an array of their indexes.
  19323. *
  19324. * @private
  19325. * @param {Array} array The array to modify.
  19326. * @param {*} placeholder The placeholder to replace.
  19327. * @returns {Array} Returns the new array of placeholder indexes.
  19328. */
  19329. function replaceHolders(array, placeholder) {
  19330. var index = -1,
  19331. length = array.length,
  19332. resIndex = 0,
  19333. result = [];
  19334. while (++index < length) {
  19335. var value = array[index];
  19336. if (value === placeholder || value === PLACEHOLDER) {
  19337. array[index] = PLACEHOLDER;
  19338. result[resIndex++] = index;
  19339. }
  19340. }
  19341. return result;
  19342. }
  19343. /**
  19344. * Converts `set` to an array of its values.
  19345. *
  19346. * @private
  19347. * @param {Object} set The set to convert.
  19348. * @returns {Array} Returns the values.
  19349. */
  19350. function setToArray(set) {
  19351. var index = -1,
  19352. result = Array(set.size);
  19353. set.forEach(function(value) {
  19354. result[++index] = value;
  19355. });
  19356. return result;
  19357. }
  19358. /**
  19359. * Converts `set` to its value-value pairs.
  19360. *
  19361. * @private
  19362. * @param {Object} set The set to convert.
  19363. * @returns {Array} Returns the value-value pairs.
  19364. */
  19365. function setToPairs(set) {
  19366. var index = -1,
  19367. result = Array(set.size);
  19368. set.forEach(function(value) {
  19369. result[++index] = [value, value];
  19370. });
  19371. return result;
  19372. }
  19373. /**
  19374. * A specialized version of `_.indexOf` which performs strict equality
  19375. * comparisons of values, i.e. `===`.
  19376. *
  19377. * @private
  19378. * @param {Array} array The array to inspect.
  19379. * @param {*} value The value to search for.
  19380. * @param {number} fromIndex The index to search from.
  19381. * @returns {number} Returns the index of the matched value, else `-1`.
  19382. */
  19383. function strictIndexOf(array, value, fromIndex) {
  19384. var index = fromIndex - 1,
  19385. length = array.length;
  19386. while (++index < length) {
  19387. if (array[index] === value) {
  19388. return index;
  19389. }
  19390. }
  19391. return -1;
  19392. }
  19393. /**
  19394. * A specialized version of `_.lastIndexOf` which performs strict equality
  19395. * comparisons of values, i.e. `===`.
  19396. *
  19397. * @private
  19398. * @param {Array} array The array to inspect.
  19399. * @param {*} value The value to search for.
  19400. * @param {number} fromIndex The index to search from.
  19401. * @returns {number} Returns the index of the matched value, else `-1`.
  19402. */
  19403. function strictLastIndexOf(array, value, fromIndex) {
  19404. var index = fromIndex + 1;
  19405. while (index--) {
  19406. if (array[index] === value) {
  19407. return index;
  19408. }
  19409. }
  19410. return index;
  19411. }
  19412. /**
  19413. * Gets the number of symbols in `string`.
  19414. *
  19415. * @private
  19416. * @param {string} string The string to inspect.
  19417. * @returns {number} Returns the string size.
  19418. */
  19419. function stringSize(string) {
  19420. return hasUnicode(string)
  19421. ? unicodeSize(string)
  19422. : asciiSize(string);
  19423. }
  19424. /**
  19425. * Converts `string` to an array.
  19426. *
  19427. * @private
  19428. * @param {string} string The string to convert.
  19429. * @returns {Array} Returns the converted array.
  19430. */
  19431. function stringToArray(string) {
  19432. return hasUnicode(string)
  19433. ? unicodeToArray(string)
  19434. : asciiToArray(string);
  19435. }
  19436. /**
  19437. * Used by `_.unescape` to convert HTML entities to characters.
  19438. *
  19439. * @private
  19440. * @param {string} chr The matched character to unescape.
  19441. * @returns {string} Returns the unescaped character.
  19442. */
  19443. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19444. /**
  19445. * Gets the size of a Unicode `string`.
  19446. *
  19447. * @private
  19448. * @param {string} string The string inspect.
  19449. * @returns {number} Returns the string size.
  19450. */
  19451. function unicodeSize(string) {
  19452. var result = reUnicode.lastIndex = 0;
  19453. while (reUnicode.test(string)) {
  19454. ++result;
  19455. }
  19456. return result;
  19457. }
  19458. /**
  19459. * Converts a Unicode `string` to an array.
  19460. *
  19461. * @private
  19462. * @param {string} string The string to convert.
  19463. * @returns {Array} Returns the converted array.
  19464. */
  19465. function unicodeToArray(string) {
  19466. return string.match(reUnicode) || [];
  19467. }
  19468. /**
  19469. * Splits a Unicode `string` into an array of its words.
  19470. *
  19471. * @private
  19472. * @param {string} The string to inspect.
  19473. * @returns {Array} Returns the words of `string`.
  19474. */
  19475. function unicodeWords(string) {
  19476. return string.match(reUnicodeWord) || [];
  19477. }
  19478. /*--------------------------------------------------------------------------*/
  19479. /**
  19480. * Create a new pristine `lodash` function using the `context` object.
  19481. *
  19482. * @static
  19483. * @memberOf _
  19484. * @since 1.1.0
  19485. * @category Util
  19486. * @param {Object} [context=root] The context object.
  19487. * @returns {Function} Returns a new `lodash` function.
  19488. * @example
  19489. *
  19490. * _.mixin({ 'foo': _.constant('foo') });
  19491. *
  19492. * var lodash = _.runInContext();
  19493. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19494. *
  19495. * _.isFunction(_.foo);
  19496. * // => true
  19497. * _.isFunction(_.bar);
  19498. * // => false
  19499. *
  19500. * lodash.isFunction(lodash.foo);
  19501. * // => false
  19502. * lodash.isFunction(lodash.bar);
  19503. * // => true
  19504. *
  19505. * // Create a suped-up `defer` in Node.js.
  19506. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19507. */
  19508. var runInContext = (function runInContext(context) {
  19509. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19510. /** Built-in constructor references. */
  19511. var Array = context.Array,
  19512. Date = context.Date,
  19513. Error = context.Error,
  19514. Function = context.Function,
  19515. Math = context.Math,
  19516. Object = context.Object,
  19517. RegExp = context.RegExp,
  19518. String = context.String,
  19519. TypeError = context.TypeError;
  19520. /** Used for built-in method references. */
  19521. var arrayProto = Array.prototype,
  19522. funcProto = Function.prototype,
  19523. objectProto = Object.prototype;
  19524. /** Used to detect overreaching core-js shims. */
  19525. var coreJsData = context['__core-js_shared__'];
  19526. /** Used to resolve the decompiled source of functions. */
  19527. var funcToString = funcProto.toString;
  19528. /** Used to check objects for own properties. */
  19529. var hasOwnProperty = objectProto.hasOwnProperty;
  19530. /** Used to generate unique IDs. */
  19531. var idCounter = 0;
  19532. /** Used to detect methods masquerading as native. */
  19533. var maskSrcKey = (function() {
  19534. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19535. return uid ? ('Symbol(src)_1.' + uid) : '';
  19536. }());
  19537. /**
  19538. * Used to resolve the
  19539. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19540. * of values.
  19541. */
  19542. var nativeObjectToString = objectProto.toString;
  19543. /** Used to infer the `Object` constructor. */
  19544. var objectCtorString = funcToString.call(Object);
  19545. /** Used to restore the original `_` reference in `_.noConflict`. */
  19546. var oldDash = root._;
  19547. /** Used to detect if a method is native. */
  19548. var reIsNative = RegExp('^' +
  19549. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19550. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19551. );
  19552. /** Built-in value references. */
  19553. var Buffer = moduleExports ? context.Buffer : undefined,
  19554. Symbol = context.Symbol,
  19555. Uint8Array = context.Uint8Array,
  19556. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19557. getPrototype = overArg(Object.getPrototypeOf, Object),
  19558. objectCreate = Object.create,
  19559. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19560. splice = arrayProto.splice,
  19561. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19562. symIterator = Symbol ? Symbol.iterator : undefined,
  19563. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19564. var defineProperty = (function() {
  19565. try {
  19566. var func = getNative(Object, 'defineProperty');
  19567. func({}, '', {});
  19568. return func;
  19569. } catch (e) {}
  19570. }());
  19571. /** Mocked built-ins. */
  19572. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19573. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19574. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19575. /* Built-in method references for those with the same name as other `lodash` methods. */
  19576. var nativeCeil = Math.ceil,
  19577. nativeFloor = Math.floor,
  19578. nativeGetSymbols = Object.getOwnPropertySymbols,
  19579. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19580. nativeIsFinite = context.isFinite,
  19581. nativeJoin = arrayProto.join,
  19582. nativeKeys = overArg(Object.keys, Object),
  19583. nativeMax = Math.max,
  19584. nativeMin = Math.min,
  19585. nativeNow = Date.now,
  19586. nativeParseInt = context.parseInt,
  19587. nativeRandom = Math.random,
  19588. nativeReverse = arrayProto.reverse;
  19589. /* Built-in method references that are verified to be native. */
  19590. var DataView = getNative(context, 'DataView'),
  19591. Map = getNative(context, 'Map'),
  19592. Promise = getNative(context, 'Promise'),
  19593. Set = getNative(context, 'Set'),
  19594. WeakMap = getNative(context, 'WeakMap'),
  19595. nativeCreate = getNative(Object, 'create');
  19596. /** Used to store function metadata. */
  19597. var metaMap = WeakMap && new WeakMap;
  19598. /** Used to lookup unminified function names. */
  19599. var realNames = {};
  19600. /** Used to detect maps, sets, and weakmaps. */
  19601. var dataViewCtorString = toSource(DataView),
  19602. mapCtorString = toSource(Map),
  19603. promiseCtorString = toSource(Promise),
  19604. setCtorString = toSource(Set),
  19605. weakMapCtorString = toSource(WeakMap);
  19606. /** Used to convert symbols to primitives and strings. */
  19607. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19608. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19609. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19610. /*------------------------------------------------------------------------*/
  19611. /**
  19612. * Creates a `lodash` object which wraps `value` to enable implicit method
  19613. * chain sequences. Methods that operate on and return arrays, collections,
  19614. * and functions can be chained together. Methods that retrieve a single value
  19615. * or may return a primitive value will automatically end the chain sequence
  19616. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19617. * with `_#value`.
  19618. *
  19619. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19620. * enabled using `_.chain`.
  19621. *
  19622. * The execution of chained methods is lazy, that is, it's deferred until
  19623. * `_#value` is implicitly or explicitly called.
  19624. *
  19625. * Lazy evaluation allows several methods to support shortcut fusion.
  19626. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19627. * the creation of intermediate arrays and can greatly reduce the number of
  19628. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19629. * fusion if the section is applied to an array and iteratees accept only
  19630. * one argument. The heuristic for whether a section qualifies for shortcut
  19631. * fusion is subject to change.
  19632. *
  19633. * Chaining is supported in custom builds as long as the `_#value` method is
  19634. * directly or indirectly included in the build.
  19635. *
  19636. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19637. *
  19638. * The wrapper `Array` methods are:
  19639. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19640. *
  19641. * The wrapper `String` methods are:
  19642. * `replace` and `split`
  19643. *
  19644. * The wrapper methods that support shortcut fusion are:
  19645. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19646. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19647. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19648. *
  19649. * The chainable wrapper methods are:
  19650. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19651. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19652. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19653. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19654. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19655. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19656. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19657. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19658. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19659. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19660. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19661. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19662. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19663. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19664. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19665. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19666. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19667. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19668. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19669. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19670. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19671. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19672. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19673. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19674. *
  19675. * The wrapper methods that are **not** chainable by default are:
  19676. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19677. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19678. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19679. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19680. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19681. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19682. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19683. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19684. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19685. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19686. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19687. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19688. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19689. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19690. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19691. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19692. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19693. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19694. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19695. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19696. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19697. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19698. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19699. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19700. * `upperFirst`, `value`, and `words`
  19701. *
  19702. * @name _
  19703. * @constructor
  19704. * @category Seq
  19705. * @param {*} value The value to wrap in a `lodash` instance.
  19706. * @returns {Object} Returns the new `lodash` wrapper instance.
  19707. * @example
  19708. *
  19709. * function square(n) {
  19710. * return n * n;
  19711. * }
  19712. *
  19713. * var wrapped = _([1, 2, 3]);
  19714. *
  19715. * // Returns an unwrapped value.
  19716. * wrapped.reduce(_.add);
  19717. * // => 6
  19718. *
  19719. * // Returns a wrapped value.
  19720. * var squares = wrapped.map(square);
  19721. *
  19722. * _.isArray(squares);
  19723. * // => false
  19724. *
  19725. * _.isArray(squares.value());
  19726. * // => true
  19727. */
  19728. function lodash(value) {
  19729. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19730. if (value instanceof LodashWrapper) {
  19731. return value;
  19732. }
  19733. if (hasOwnProperty.call(value, '__wrapped__')) {
  19734. return wrapperClone(value);
  19735. }
  19736. }
  19737. return new LodashWrapper(value);
  19738. }
  19739. /**
  19740. * The base implementation of `_.create` without support for assigning
  19741. * properties to the created object.
  19742. *
  19743. * @private
  19744. * @param {Object} proto The object to inherit from.
  19745. * @returns {Object} Returns the new object.
  19746. */
  19747. var baseCreate = (function() {
  19748. function object() {}
  19749. return function(proto) {
  19750. if (!isObject(proto)) {
  19751. return {};
  19752. }
  19753. if (objectCreate) {
  19754. return objectCreate(proto);
  19755. }
  19756. object.prototype = proto;
  19757. var result = new object;
  19758. object.prototype = undefined;
  19759. return result;
  19760. };
  19761. }());
  19762. /**
  19763. * The function whose prototype chain sequence wrappers inherit from.
  19764. *
  19765. * @private
  19766. */
  19767. function baseLodash() {
  19768. // No operation performed.
  19769. }
  19770. /**
  19771. * The base constructor for creating `lodash` wrapper objects.
  19772. *
  19773. * @private
  19774. * @param {*} value The value to wrap.
  19775. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19776. */
  19777. function LodashWrapper(value, chainAll) {
  19778. this.__wrapped__ = value;
  19779. this.__actions__ = [];
  19780. this.__chain__ = !!chainAll;
  19781. this.__index__ = 0;
  19782. this.__values__ = undefined;
  19783. }
  19784. /**
  19785. * By default, the template delimiters used by lodash are like those in
  19786. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19787. * following template settings to use alternative delimiters.
  19788. *
  19789. * @static
  19790. * @memberOf _
  19791. * @type {Object}
  19792. */
  19793. lodash.templateSettings = {
  19794. /**
  19795. * Used to detect `data` property values to be HTML-escaped.
  19796. *
  19797. * @memberOf _.templateSettings
  19798. * @type {RegExp}
  19799. */
  19800. 'escape': reEscape,
  19801. /**
  19802. * Used to detect code to be evaluated.
  19803. *
  19804. * @memberOf _.templateSettings
  19805. * @type {RegExp}
  19806. */
  19807. 'evaluate': reEvaluate,
  19808. /**
  19809. * Used to detect `data` property values to inject.
  19810. *
  19811. * @memberOf _.templateSettings
  19812. * @type {RegExp}
  19813. */
  19814. 'interpolate': reInterpolate,
  19815. /**
  19816. * Used to reference the data object in the template text.
  19817. *
  19818. * @memberOf _.templateSettings
  19819. * @type {string}
  19820. */
  19821. 'variable': '',
  19822. /**
  19823. * Used to import variables into the compiled template.
  19824. *
  19825. * @memberOf _.templateSettings
  19826. * @type {Object}
  19827. */
  19828. 'imports': {
  19829. /**
  19830. * A reference to the `lodash` function.
  19831. *
  19832. * @memberOf _.templateSettings.imports
  19833. * @type {Function}
  19834. */
  19835. '_': lodash
  19836. }
  19837. };
  19838. // Ensure wrappers are instances of `baseLodash`.
  19839. lodash.prototype = baseLodash.prototype;
  19840. lodash.prototype.constructor = lodash;
  19841. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19842. LodashWrapper.prototype.constructor = LodashWrapper;
  19843. /*------------------------------------------------------------------------*/
  19844. /**
  19845. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19846. *
  19847. * @private
  19848. * @constructor
  19849. * @param {*} value The value to wrap.
  19850. */
  19851. function LazyWrapper(value) {
  19852. this.__wrapped__ = value;
  19853. this.__actions__ = [];
  19854. this.__dir__ = 1;
  19855. this.__filtered__ = false;
  19856. this.__iteratees__ = [];
  19857. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19858. this.__views__ = [];
  19859. }
  19860. /**
  19861. * Creates a clone of the lazy wrapper object.
  19862. *
  19863. * @private
  19864. * @name clone
  19865. * @memberOf LazyWrapper
  19866. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19867. */
  19868. function lazyClone() {
  19869. var result = new LazyWrapper(this.__wrapped__);
  19870. result.__actions__ = copyArray(this.__actions__);
  19871. result.__dir__ = this.__dir__;
  19872. result.__filtered__ = this.__filtered__;
  19873. result.__iteratees__ = copyArray(this.__iteratees__);
  19874. result.__takeCount__ = this.__takeCount__;
  19875. result.__views__ = copyArray(this.__views__);
  19876. return result;
  19877. }
  19878. /**
  19879. * Reverses the direction of lazy iteration.
  19880. *
  19881. * @private
  19882. * @name reverse
  19883. * @memberOf LazyWrapper
  19884. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19885. */
  19886. function lazyReverse() {
  19887. if (this.__filtered__) {
  19888. var result = new LazyWrapper(this);
  19889. result.__dir__ = -1;
  19890. result.__filtered__ = true;
  19891. } else {
  19892. result = this.clone();
  19893. result.__dir__ *= -1;
  19894. }
  19895. return result;
  19896. }
  19897. /**
  19898. * Extracts the unwrapped value from its lazy wrapper.
  19899. *
  19900. * @private
  19901. * @name value
  19902. * @memberOf LazyWrapper
  19903. * @returns {*} Returns the unwrapped value.
  19904. */
  19905. function lazyValue() {
  19906. var array = this.__wrapped__.value(),
  19907. dir = this.__dir__,
  19908. isArr = isArray(array),
  19909. isRight = dir < 0,
  19910. arrLength = isArr ? array.length : 0,
  19911. view = getView(0, arrLength, this.__views__),
  19912. start = view.start,
  19913. end = view.end,
  19914. length = end - start,
  19915. index = isRight ? end : (start - 1),
  19916. iteratees = this.__iteratees__,
  19917. iterLength = iteratees.length,
  19918. resIndex = 0,
  19919. takeCount = nativeMin(length, this.__takeCount__);
  19920. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19921. return baseWrapperValue(array, this.__actions__);
  19922. }
  19923. var result = [];
  19924. outer:
  19925. while (length-- && resIndex < takeCount) {
  19926. index += dir;
  19927. var iterIndex = -1,
  19928. value = array[index];
  19929. while (++iterIndex < iterLength) {
  19930. var data = iteratees[iterIndex],
  19931. iteratee = data.iteratee,
  19932. type = data.type,
  19933. computed = iteratee(value);
  19934. if (type == LAZY_MAP_FLAG) {
  19935. value = computed;
  19936. } else if (!computed) {
  19937. if (type == LAZY_FILTER_FLAG) {
  19938. continue outer;
  19939. } else {
  19940. break outer;
  19941. }
  19942. }
  19943. }
  19944. result[resIndex++] = value;
  19945. }
  19946. return result;
  19947. }
  19948. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19949. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19950. LazyWrapper.prototype.constructor = LazyWrapper;
  19951. /*------------------------------------------------------------------------*/
  19952. /**
  19953. * Creates a hash object.
  19954. *
  19955. * @private
  19956. * @constructor
  19957. * @param {Array} [entries] The key-value pairs to cache.
  19958. */
  19959. function Hash(entries) {
  19960. var index = -1,
  19961. length = entries == null ? 0 : entries.length;
  19962. this.clear();
  19963. while (++index < length) {
  19964. var entry = entries[index];
  19965. this.set(entry[0], entry[1]);
  19966. }
  19967. }
  19968. /**
  19969. * Removes all key-value entries from the hash.
  19970. *
  19971. * @private
  19972. * @name clear
  19973. * @memberOf Hash
  19974. */
  19975. function hashClear() {
  19976. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19977. this.size = 0;
  19978. }
  19979. /**
  19980. * Removes `key` and its value from the hash.
  19981. *
  19982. * @private
  19983. * @name delete
  19984. * @memberOf Hash
  19985. * @param {Object} hash The hash to modify.
  19986. * @param {string} key The key of the value to remove.
  19987. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19988. */
  19989. function hashDelete(key) {
  19990. var result = this.has(key) && delete this.__data__[key];
  19991. this.size -= result ? 1 : 0;
  19992. return result;
  19993. }
  19994. /**
  19995. * Gets the hash value for `key`.
  19996. *
  19997. * @private
  19998. * @name get
  19999. * @memberOf Hash
  20000. * @param {string} key The key of the value to get.
  20001. * @returns {*} Returns the entry value.
  20002. */
  20003. function hashGet(key) {
  20004. var data = this.__data__;
  20005. if (nativeCreate) {
  20006. var result = data[key];
  20007. return result === HASH_UNDEFINED ? undefined : result;
  20008. }
  20009. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20010. }
  20011. /**
  20012. * Checks if a hash value for `key` exists.
  20013. *
  20014. * @private
  20015. * @name has
  20016. * @memberOf Hash
  20017. * @param {string} key The key of the entry to check.
  20018. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20019. */
  20020. function hashHas(key) {
  20021. var data = this.__data__;
  20022. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20023. }
  20024. /**
  20025. * Sets the hash `key` to `value`.
  20026. *
  20027. * @private
  20028. * @name set
  20029. * @memberOf Hash
  20030. * @param {string} key The key of the value to set.
  20031. * @param {*} value The value to set.
  20032. * @returns {Object} Returns the hash instance.
  20033. */
  20034. function hashSet(key, value) {
  20035. var data = this.__data__;
  20036. this.size += this.has(key) ? 0 : 1;
  20037. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20038. return this;
  20039. }
  20040. // Add methods to `Hash`.
  20041. Hash.prototype.clear = hashClear;
  20042. Hash.prototype['delete'] = hashDelete;
  20043. Hash.prototype.get = hashGet;
  20044. Hash.prototype.has = hashHas;
  20045. Hash.prototype.set = hashSet;
  20046. /*------------------------------------------------------------------------*/
  20047. /**
  20048. * Creates an list cache object.
  20049. *
  20050. * @private
  20051. * @constructor
  20052. * @param {Array} [entries] The key-value pairs to cache.
  20053. */
  20054. function ListCache(entries) {
  20055. var index = -1,
  20056. length = entries == null ? 0 : entries.length;
  20057. this.clear();
  20058. while (++index < length) {
  20059. var entry = entries[index];
  20060. this.set(entry[0], entry[1]);
  20061. }
  20062. }
  20063. /**
  20064. * Removes all key-value entries from the list cache.
  20065. *
  20066. * @private
  20067. * @name clear
  20068. * @memberOf ListCache
  20069. */
  20070. function listCacheClear() {
  20071. this.__data__ = [];
  20072. this.size = 0;
  20073. }
  20074. /**
  20075. * Removes `key` and its value from the list cache.
  20076. *
  20077. * @private
  20078. * @name delete
  20079. * @memberOf ListCache
  20080. * @param {string} key The key of the value to remove.
  20081. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20082. */
  20083. function listCacheDelete(key) {
  20084. var data = this.__data__,
  20085. index = assocIndexOf(data, key);
  20086. if (index < 0) {
  20087. return false;
  20088. }
  20089. var lastIndex = data.length - 1;
  20090. if (index == lastIndex) {
  20091. data.pop();
  20092. } else {
  20093. splice.call(data, index, 1);
  20094. }
  20095. --this.size;
  20096. return true;
  20097. }
  20098. /**
  20099. * Gets the list cache value for `key`.
  20100. *
  20101. * @private
  20102. * @name get
  20103. * @memberOf ListCache
  20104. * @param {string} key The key of the value to get.
  20105. * @returns {*} Returns the entry value.
  20106. */
  20107. function listCacheGet(key) {
  20108. var data = this.__data__,
  20109. index = assocIndexOf(data, key);
  20110. return index < 0 ? undefined : data[index][1];
  20111. }
  20112. /**
  20113. * Checks if a list cache value for `key` exists.
  20114. *
  20115. * @private
  20116. * @name has
  20117. * @memberOf ListCache
  20118. * @param {string} key The key of the entry to check.
  20119. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20120. */
  20121. function listCacheHas(key) {
  20122. return assocIndexOf(this.__data__, key) > -1;
  20123. }
  20124. /**
  20125. * Sets the list cache `key` to `value`.
  20126. *
  20127. * @private
  20128. * @name set
  20129. * @memberOf ListCache
  20130. * @param {string} key The key of the value to set.
  20131. * @param {*} value The value to set.
  20132. * @returns {Object} Returns the list cache instance.
  20133. */
  20134. function listCacheSet(key, value) {
  20135. var data = this.__data__,
  20136. index = assocIndexOf(data, key);
  20137. if (index < 0) {
  20138. ++this.size;
  20139. data.push([key, value]);
  20140. } else {
  20141. data[index][1] = value;
  20142. }
  20143. return this;
  20144. }
  20145. // Add methods to `ListCache`.
  20146. ListCache.prototype.clear = listCacheClear;
  20147. ListCache.prototype['delete'] = listCacheDelete;
  20148. ListCache.prototype.get = listCacheGet;
  20149. ListCache.prototype.has = listCacheHas;
  20150. ListCache.prototype.set = listCacheSet;
  20151. /*------------------------------------------------------------------------*/
  20152. /**
  20153. * Creates a map cache object to store key-value pairs.
  20154. *
  20155. * @private
  20156. * @constructor
  20157. * @param {Array} [entries] The key-value pairs to cache.
  20158. */
  20159. function MapCache(entries) {
  20160. var index = -1,
  20161. length = entries == null ? 0 : entries.length;
  20162. this.clear();
  20163. while (++index < length) {
  20164. var entry = entries[index];
  20165. this.set(entry[0], entry[1]);
  20166. }
  20167. }
  20168. /**
  20169. * Removes all key-value entries from the map.
  20170. *
  20171. * @private
  20172. * @name clear
  20173. * @memberOf MapCache
  20174. */
  20175. function mapCacheClear() {
  20176. this.size = 0;
  20177. this.__data__ = {
  20178. 'hash': new Hash,
  20179. 'map': new (Map || ListCache),
  20180. 'string': new Hash
  20181. };
  20182. }
  20183. /**
  20184. * Removes `key` and its value from the map.
  20185. *
  20186. * @private
  20187. * @name delete
  20188. * @memberOf MapCache
  20189. * @param {string} key The key of the value to remove.
  20190. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20191. */
  20192. function mapCacheDelete(key) {
  20193. var result = getMapData(this, key)['delete'](key);
  20194. this.size -= result ? 1 : 0;
  20195. return result;
  20196. }
  20197. /**
  20198. * Gets the map value for `key`.
  20199. *
  20200. * @private
  20201. * @name get
  20202. * @memberOf MapCache
  20203. * @param {string} key The key of the value to get.
  20204. * @returns {*} Returns the entry value.
  20205. */
  20206. function mapCacheGet(key) {
  20207. return getMapData(this, key).get(key);
  20208. }
  20209. /**
  20210. * Checks if a map value for `key` exists.
  20211. *
  20212. * @private
  20213. * @name has
  20214. * @memberOf MapCache
  20215. * @param {string} key The key of the entry to check.
  20216. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20217. */
  20218. function mapCacheHas(key) {
  20219. return getMapData(this, key).has(key);
  20220. }
  20221. /**
  20222. * Sets the map `key` to `value`.
  20223. *
  20224. * @private
  20225. * @name set
  20226. * @memberOf MapCache
  20227. * @param {string} key The key of the value to set.
  20228. * @param {*} value The value to set.
  20229. * @returns {Object} Returns the map cache instance.
  20230. */
  20231. function mapCacheSet(key, value) {
  20232. var data = getMapData(this, key),
  20233. size = data.size;
  20234. data.set(key, value);
  20235. this.size += data.size == size ? 0 : 1;
  20236. return this;
  20237. }
  20238. // Add methods to `MapCache`.
  20239. MapCache.prototype.clear = mapCacheClear;
  20240. MapCache.prototype['delete'] = mapCacheDelete;
  20241. MapCache.prototype.get = mapCacheGet;
  20242. MapCache.prototype.has = mapCacheHas;
  20243. MapCache.prototype.set = mapCacheSet;
  20244. /*------------------------------------------------------------------------*/
  20245. /**
  20246. *
  20247. * Creates an array cache object to store unique values.
  20248. *
  20249. * @private
  20250. * @constructor
  20251. * @param {Array} [values] The values to cache.
  20252. */
  20253. function SetCache(values) {
  20254. var index = -1,
  20255. length = values == null ? 0 : values.length;
  20256. this.__data__ = new MapCache;
  20257. while (++index < length) {
  20258. this.add(values[index]);
  20259. }
  20260. }
  20261. /**
  20262. * Adds `value` to the array cache.
  20263. *
  20264. * @private
  20265. * @name add
  20266. * @memberOf SetCache
  20267. * @alias push
  20268. * @param {*} value The value to cache.
  20269. * @returns {Object} Returns the cache instance.
  20270. */
  20271. function setCacheAdd(value) {
  20272. this.__data__.set(value, HASH_UNDEFINED);
  20273. return this;
  20274. }
  20275. /**
  20276. * Checks if `value` is in the array cache.
  20277. *
  20278. * @private
  20279. * @name has
  20280. * @memberOf SetCache
  20281. * @param {*} value The value to search for.
  20282. * @returns {number} Returns `true` if `value` is found, else `false`.
  20283. */
  20284. function setCacheHas(value) {
  20285. return this.__data__.has(value);
  20286. }
  20287. // Add methods to `SetCache`.
  20288. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20289. SetCache.prototype.has = setCacheHas;
  20290. /*------------------------------------------------------------------------*/
  20291. /**
  20292. * Creates a stack cache object to store key-value pairs.
  20293. *
  20294. * @private
  20295. * @constructor
  20296. * @param {Array} [entries] The key-value pairs to cache.
  20297. */
  20298. function Stack(entries) {
  20299. var data = this.__data__ = new ListCache(entries);
  20300. this.size = data.size;
  20301. }
  20302. /**
  20303. * Removes all key-value entries from the stack.
  20304. *
  20305. * @private
  20306. * @name clear
  20307. * @memberOf Stack
  20308. */
  20309. function stackClear() {
  20310. this.__data__ = new ListCache;
  20311. this.size = 0;
  20312. }
  20313. /**
  20314. * Removes `key` and its value from the stack.
  20315. *
  20316. * @private
  20317. * @name delete
  20318. * @memberOf Stack
  20319. * @param {string} key The key of the value to remove.
  20320. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20321. */
  20322. function stackDelete(key) {
  20323. var data = this.__data__,
  20324. result = data['delete'](key);
  20325. this.size = data.size;
  20326. return result;
  20327. }
  20328. /**
  20329. * Gets the stack value for `key`.
  20330. *
  20331. * @private
  20332. * @name get
  20333. * @memberOf Stack
  20334. * @param {string} key The key of the value to get.
  20335. * @returns {*} Returns the entry value.
  20336. */
  20337. function stackGet(key) {
  20338. return this.__data__.get(key);
  20339. }
  20340. /**
  20341. * Checks if a stack value for `key` exists.
  20342. *
  20343. * @private
  20344. * @name has
  20345. * @memberOf Stack
  20346. * @param {string} key The key of the entry to check.
  20347. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20348. */
  20349. function stackHas(key) {
  20350. return this.__data__.has(key);
  20351. }
  20352. /**
  20353. * Sets the stack `key` to `value`.
  20354. *
  20355. * @private
  20356. * @name set
  20357. * @memberOf Stack
  20358. * @param {string} key The key of the value to set.
  20359. * @param {*} value The value to set.
  20360. * @returns {Object} Returns the stack cache instance.
  20361. */
  20362. function stackSet(key, value) {
  20363. var data = this.__data__;
  20364. if (data instanceof ListCache) {
  20365. var pairs = data.__data__;
  20366. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20367. pairs.push([key, value]);
  20368. this.size = ++data.size;
  20369. return this;
  20370. }
  20371. data = this.__data__ = new MapCache(pairs);
  20372. }
  20373. data.set(key, value);
  20374. this.size = data.size;
  20375. return this;
  20376. }
  20377. // Add methods to `Stack`.
  20378. Stack.prototype.clear = stackClear;
  20379. Stack.prototype['delete'] = stackDelete;
  20380. Stack.prototype.get = stackGet;
  20381. Stack.prototype.has = stackHas;
  20382. Stack.prototype.set = stackSet;
  20383. /*------------------------------------------------------------------------*/
  20384. /**
  20385. * Creates an array of the enumerable property names of the array-like `value`.
  20386. *
  20387. * @private
  20388. * @param {*} value The value to query.
  20389. * @param {boolean} inherited Specify returning inherited property names.
  20390. * @returns {Array} Returns the array of property names.
  20391. */
  20392. function arrayLikeKeys(value, inherited) {
  20393. var isArr = isArray(value),
  20394. isArg = !isArr && isArguments(value),
  20395. isBuff = !isArr && !isArg && isBuffer(value),
  20396. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20397. skipIndexes = isArr || isArg || isBuff || isType,
  20398. result = skipIndexes ? baseTimes(value.length, String) : [],
  20399. length = result.length;
  20400. for (var key in value) {
  20401. if ((inherited || hasOwnProperty.call(value, key)) &&
  20402. !(skipIndexes && (
  20403. // Safari 9 has enumerable `arguments.length` in strict mode.
  20404. key == 'length' ||
  20405. // Node.js 0.10 has enumerable non-index properties on buffers.
  20406. (isBuff && (key == 'offset' || key == 'parent')) ||
  20407. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20408. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20409. // Skip index properties.
  20410. isIndex(key, length)
  20411. ))) {
  20412. result.push(key);
  20413. }
  20414. }
  20415. return result;
  20416. }
  20417. /**
  20418. * A specialized version of `_.sample` for arrays.
  20419. *
  20420. * @private
  20421. * @param {Array} array The array to sample.
  20422. * @returns {*} Returns the random element.
  20423. */
  20424. function arraySample(array) {
  20425. var length = array.length;
  20426. return length ? array[baseRandom(0, length - 1)] : undefined;
  20427. }
  20428. /**
  20429. * A specialized version of `_.sampleSize` for arrays.
  20430. *
  20431. * @private
  20432. * @param {Array} array The array to sample.
  20433. * @param {number} n The number of elements to sample.
  20434. * @returns {Array} Returns the random elements.
  20435. */
  20436. function arraySampleSize(array, n) {
  20437. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20438. }
  20439. /**
  20440. * A specialized version of `_.shuffle` for arrays.
  20441. *
  20442. * @private
  20443. * @param {Array} array The array to shuffle.
  20444. * @returns {Array} Returns the new shuffled array.
  20445. */
  20446. function arrayShuffle(array) {
  20447. return shuffleSelf(copyArray(array));
  20448. }
  20449. /**
  20450. * This function is like `assignValue` except that it doesn't assign
  20451. * `undefined` values.
  20452. *
  20453. * @private
  20454. * @param {Object} object The object to modify.
  20455. * @param {string} key The key of the property to assign.
  20456. * @param {*} value The value to assign.
  20457. */
  20458. function assignMergeValue(object, key, value) {
  20459. if ((value !== undefined && !eq(object[key], value)) ||
  20460. (value === undefined && !(key in object))) {
  20461. baseAssignValue(object, key, value);
  20462. }
  20463. }
  20464. /**
  20465. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20466. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20467. * for equality comparisons.
  20468. *
  20469. * @private
  20470. * @param {Object} object The object to modify.
  20471. * @param {string} key The key of the property to assign.
  20472. * @param {*} value The value to assign.
  20473. */
  20474. function assignValue(object, key, value) {
  20475. var objValue = object[key];
  20476. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20477. (value === undefined && !(key in object))) {
  20478. baseAssignValue(object, key, value);
  20479. }
  20480. }
  20481. /**
  20482. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20483. *
  20484. * @private
  20485. * @param {Array} array The array to inspect.
  20486. * @param {*} key The key to search for.
  20487. * @returns {number} Returns the index of the matched value, else `-1`.
  20488. */
  20489. function assocIndexOf(array, key) {
  20490. var length = array.length;
  20491. while (length--) {
  20492. if (eq(array[length][0], key)) {
  20493. return length;
  20494. }
  20495. }
  20496. return -1;
  20497. }
  20498. /**
  20499. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20500. * by `iteratee` and values set by `setter`.
  20501. *
  20502. * @private
  20503. * @param {Array|Object} collection The collection to iterate over.
  20504. * @param {Function} setter The function to set `accumulator` values.
  20505. * @param {Function} iteratee The iteratee to transform keys.
  20506. * @param {Object} accumulator The initial aggregated object.
  20507. * @returns {Function} Returns `accumulator`.
  20508. */
  20509. function baseAggregator(collection, setter, iteratee, accumulator) {
  20510. baseEach(collection, function(value, key, collection) {
  20511. setter(accumulator, value, iteratee(value), collection);
  20512. });
  20513. return accumulator;
  20514. }
  20515. /**
  20516. * The base implementation of `_.assign` without support for multiple sources
  20517. * or `customizer` functions.
  20518. *
  20519. * @private
  20520. * @param {Object} object The destination object.
  20521. * @param {Object} source The source object.
  20522. * @returns {Object} Returns `object`.
  20523. */
  20524. function baseAssign(object, source) {
  20525. return object && copyObject(source, keys(source), object);
  20526. }
  20527. /**
  20528. * The base implementation of `_.assignIn` without support for multiple sources
  20529. * or `customizer` functions.
  20530. *
  20531. * @private
  20532. * @param {Object} object The destination object.
  20533. * @param {Object} source The source object.
  20534. * @returns {Object} Returns `object`.
  20535. */
  20536. function baseAssignIn(object, source) {
  20537. return object && copyObject(source, keysIn(source), object);
  20538. }
  20539. /**
  20540. * The base implementation of `assignValue` and `assignMergeValue` without
  20541. * value checks.
  20542. *
  20543. * @private
  20544. * @param {Object} object The object to modify.
  20545. * @param {string} key The key of the property to assign.
  20546. * @param {*} value The value to assign.
  20547. */
  20548. function baseAssignValue(object, key, value) {
  20549. if (key == '__proto__' && defineProperty) {
  20550. defineProperty(object, key, {
  20551. 'configurable': true,
  20552. 'enumerable': true,
  20553. 'value': value,
  20554. 'writable': true
  20555. });
  20556. } else {
  20557. object[key] = value;
  20558. }
  20559. }
  20560. /**
  20561. * The base implementation of `_.at` without support for individual paths.
  20562. *
  20563. * @private
  20564. * @param {Object} object The object to iterate over.
  20565. * @param {string[]} paths The property paths to pick.
  20566. * @returns {Array} Returns the picked elements.
  20567. */
  20568. function baseAt(object, paths) {
  20569. var index = -1,
  20570. length = paths.length,
  20571. result = Array(length),
  20572. skip = object == null;
  20573. while (++index < length) {
  20574. result[index] = skip ? undefined : get(object, paths[index]);
  20575. }
  20576. return result;
  20577. }
  20578. /**
  20579. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20580. *
  20581. * @private
  20582. * @param {number} number The number to clamp.
  20583. * @param {number} [lower] The lower bound.
  20584. * @param {number} upper The upper bound.
  20585. * @returns {number} Returns the clamped number.
  20586. */
  20587. function baseClamp(number, lower, upper) {
  20588. if (number === number) {
  20589. if (upper !== undefined) {
  20590. number = number <= upper ? number : upper;
  20591. }
  20592. if (lower !== undefined) {
  20593. number = number >= lower ? number : lower;
  20594. }
  20595. }
  20596. return number;
  20597. }
  20598. /**
  20599. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20600. * traversed objects.
  20601. *
  20602. * @private
  20603. * @param {*} value The value to clone.
  20604. * @param {boolean} bitmask The bitmask flags.
  20605. * 1 - Deep clone
  20606. * 2 - Flatten inherited properties
  20607. * 4 - Clone symbols
  20608. * @param {Function} [customizer] The function to customize cloning.
  20609. * @param {string} [key] The key of `value`.
  20610. * @param {Object} [object] The parent object of `value`.
  20611. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20612. * @returns {*} Returns the cloned value.
  20613. */
  20614. function baseClone(value, bitmask, customizer, key, object, stack) {
  20615. var result,
  20616. isDeep = bitmask & CLONE_DEEP_FLAG,
  20617. isFlat = bitmask & CLONE_FLAT_FLAG,
  20618. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20619. if (customizer) {
  20620. result = object ? customizer(value, key, object, stack) : customizer(value);
  20621. }
  20622. if (result !== undefined) {
  20623. return result;
  20624. }
  20625. if (!isObject(value)) {
  20626. return value;
  20627. }
  20628. var isArr = isArray(value);
  20629. if (isArr) {
  20630. result = initCloneArray(value);
  20631. if (!isDeep) {
  20632. return copyArray(value, result);
  20633. }
  20634. } else {
  20635. var tag = getTag(value),
  20636. isFunc = tag == funcTag || tag == genTag;
  20637. if (isBuffer(value)) {
  20638. return cloneBuffer(value, isDeep);
  20639. }
  20640. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20641. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20642. if (!isDeep) {
  20643. return isFlat
  20644. ? copySymbolsIn(value, baseAssignIn(result, value))
  20645. : copySymbols(value, baseAssign(result, value));
  20646. }
  20647. } else {
  20648. if (!cloneableTags[tag]) {
  20649. return object ? value : {};
  20650. }
  20651. result = initCloneByTag(value, tag, isDeep);
  20652. }
  20653. }
  20654. // Check for circular references and return its corresponding clone.
  20655. stack || (stack = new Stack);
  20656. var stacked = stack.get(value);
  20657. if (stacked) {
  20658. return stacked;
  20659. }
  20660. stack.set(value, result);
  20661. if (isSet(value)) {
  20662. value.forEach(function(subValue) {
  20663. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20664. });
  20665. } else if (isMap(value)) {
  20666. value.forEach(function(subValue, key) {
  20667. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20668. });
  20669. }
  20670. var keysFunc = isFull
  20671. ? (isFlat ? getAllKeysIn : getAllKeys)
  20672. : (isFlat ? keysIn : keys);
  20673. var props = isArr ? undefined : keysFunc(value);
  20674. arrayEach(props || value, function(subValue, key) {
  20675. if (props) {
  20676. key = subValue;
  20677. subValue = value[key];
  20678. }
  20679. // Recursively populate clone (susceptible to call stack limits).
  20680. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20681. });
  20682. return result;
  20683. }
  20684. /**
  20685. * The base implementation of `_.conforms` which doesn't clone `source`.
  20686. *
  20687. * @private
  20688. * @param {Object} source The object of property predicates to conform to.
  20689. * @returns {Function} Returns the new spec function.
  20690. */
  20691. function baseConforms(source) {
  20692. var props = keys(source);
  20693. return function(object) {
  20694. return baseConformsTo(object, source, props);
  20695. };
  20696. }
  20697. /**
  20698. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20699. *
  20700. * @private
  20701. * @param {Object} object The object to inspect.
  20702. * @param {Object} source The object of property predicates to conform to.
  20703. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20704. */
  20705. function baseConformsTo(object, source, props) {
  20706. var length = props.length;
  20707. if (object == null) {
  20708. return !length;
  20709. }
  20710. object = Object(object);
  20711. while (length--) {
  20712. var key = props[length],
  20713. predicate = source[key],
  20714. value = object[key];
  20715. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20716. return false;
  20717. }
  20718. }
  20719. return true;
  20720. }
  20721. /**
  20722. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20723. * to provide to `func`.
  20724. *
  20725. * @private
  20726. * @param {Function} func The function to delay.
  20727. * @param {number} wait The number of milliseconds to delay invocation.
  20728. * @param {Array} args The arguments to provide to `func`.
  20729. * @returns {number|Object} Returns the timer id or timeout object.
  20730. */
  20731. function baseDelay(func, wait, args) {
  20732. if (typeof func != 'function') {
  20733. throw new TypeError(FUNC_ERROR_TEXT);
  20734. }
  20735. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20736. }
  20737. /**
  20738. * The base implementation of methods like `_.difference` without support
  20739. * for excluding multiple arrays or iteratee shorthands.
  20740. *
  20741. * @private
  20742. * @param {Array} array The array to inspect.
  20743. * @param {Array} values The values to exclude.
  20744. * @param {Function} [iteratee] The iteratee invoked per element.
  20745. * @param {Function} [comparator] The comparator invoked per element.
  20746. * @returns {Array} Returns the new array of filtered values.
  20747. */
  20748. function baseDifference(array, values, iteratee, comparator) {
  20749. var index = -1,
  20750. includes = arrayIncludes,
  20751. isCommon = true,
  20752. length = array.length,
  20753. result = [],
  20754. valuesLength = values.length;
  20755. if (!length) {
  20756. return result;
  20757. }
  20758. if (iteratee) {
  20759. values = arrayMap(values, baseUnary(iteratee));
  20760. }
  20761. if (comparator) {
  20762. includes = arrayIncludesWith;
  20763. isCommon = false;
  20764. }
  20765. else if (values.length >= LARGE_ARRAY_SIZE) {
  20766. includes = cacheHas;
  20767. isCommon = false;
  20768. values = new SetCache(values);
  20769. }
  20770. outer:
  20771. while (++index < length) {
  20772. var value = array[index],
  20773. computed = iteratee == null ? value : iteratee(value);
  20774. value = (comparator || value !== 0) ? value : 0;
  20775. if (isCommon && computed === computed) {
  20776. var valuesIndex = valuesLength;
  20777. while (valuesIndex--) {
  20778. if (values[valuesIndex] === computed) {
  20779. continue outer;
  20780. }
  20781. }
  20782. result.push(value);
  20783. }
  20784. else if (!includes(values, computed, comparator)) {
  20785. result.push(value);
  20786. }
  20787. }
  20788. return result;
  20789. }
  20790. /**
  20791. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20792. *
  20793. * @private
  20794. * @param {Array|Object} collection The collection to iterate over.
  20795. * @param {Function} iteratee The function invoked per iteration.
  20796. * @returns {Array|Object} Returns `collection`.
  20797. */
  20798. var baseEach = createBaseEach(baseForOwn);
  20799. /**
  20800. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20801. *
  20802. * @private
  20803. * @param {Array|Object} collection The collection to iterate over.
  20804. * @param {Function} iteratee The function invoked per iteration.
  20805. * @returns {Array|Object} Returns `collection`.
  20806. */
  20807. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20808. /**
  20809. * The base implementation of `_.every` without support for iteratee shorthands.
  20810. *
  20811. * @private
  20812. * @param {Array|Object} collection The collection to iterate over.
  20813. * @param {Function} predicate The function invoked per iteration.
  20814. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20815. * else `false`
  20816. */
  20817. function baseEvery(collection, predicate) {
  20818. var result = true;
  20819. baseEach(collection, function(value, index, collection) {
  20820. result = !!predicate(value, index, collection);
  20821. return result;
  20822. });
  20823. return result;
  20824. }
  20825. /**
  20826. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20827. * `comparator` to determine the extremum value.
  20828. *
  20829. * @private
  20830. * @param {Array} array The array to iterate over.
  20831. * @param {Function} iteratee The iteratee invoked per iteration.
  20832. * @param {Function} comparator The comparator used to compare values.
  20833. * @returns {*} Returns the extremum value.
  20834. */
  20835. function baseExtremum(array, iteratee, comparator) {
  20836. var index = -1,
  20837. length = array.length;
  20838. while (++index < length) {
  20839. var value = array[index],
  20840. current = iteratee(value);
  20841. if (current != null && (computed === undefined
  20842. ? (current === current && !isSymbol(current))
  20843. : comparator(current, computed)
  20844. )) {
  20845. var computed = current,
  20846. result = value;
  20847. }
  20848. }
  20849. return result;
  20850. }
  20851. /**
  20852. * The base implementation of `_.fill` without an iteratee call guard.
  20853. *
  20854. * @private
  20855. * @param {Array} array The array to fill.
  20856. * @param {*} value The value to fill `array` with.
  20857. * @param {number} [start=0] The start position.
  20858. * @param {number} [end=array.length] The end position.
  20859. * @returns {Array} Returns `array`.
  20860. */
  20861. function baseFill(array, value, start, end) {
  20862. var length = array.length;
  20863. start = toInteger(start);
  20864. if (start < 0) {
  20865. start = -start > length ? 0 : (length + start);
  20866. }
  20867. end = (end === undefined || end > length) ? length : toInteger(end);
  20868. if (end < 0) {
  20869. end += length;
  20870. }
  20871. end = start > end ? 0 : toLength(end);
  20872. while (start < end) {
  20873. array[start++] = value;
  20874. }
  20875. return array;
  20876. }
  20877. /**
  20878. * The base implementation of `_.filter` without support for iteratee shorthands.
  20879. *
  20880. * @private
  20881. * @param {Array|Object} collection The collection to iterate over.
  20882. * @param {Function} predicate The function invoked per iteration.
  20883. * @returns {Array} Returns the new filtered array.
  20884. */
  20885. function baseFilter(collection, predicate) {
  20886. var result = [];
  20887. baseEach(collection, function(value, index, collection) {
  20888. if (predicate(value, index, collection)) {
  20889. result.push(value);
  20890. }
  20891. });
  20892. return result;
  20893. }
  20894. /**
  20895. * The base implementation of `_.flatten` with support for restricting flattening.
  20896. *
  20897. * @private
  20898. * @param {Array} array The array to flatten.
  20899. * @param {number} depth The maximum recursion depth.
  20900. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20901. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20902. * @param {Array} [result=[]] The initial result value.
  20903. * @returns {Array} Returns the new flattened array.
  20904. */
  20905. function baseFlatten(array, depth, predicate, isStrict, result) {
  20906. var index = -1,
  20907. length = array.length;
  20908. predicate || (predicate = isFlattenable);
  20909. result || (result = []);
  20910. while (++index < length) {
  20911. var value = array[index];
  20912. if (depth > 0 && predicate(value)) {
  20913. if (depth > 1) {
  20914. // Recursively flatten arrays (susceptible to call stack limits).
  20915. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20916. } else {
  20917. arrayPush(result, value);
  20918. }
  20919. } else if (!isStrict) {
  20920. result[result.length] = value;
  20921. }
  20922. }
  20923. return result;
  20924. }
  20925. /**
  20926. * The base implementation of `baseForOwn` which iterates over `object`
  20927. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20928. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20929. *
  20930. * @private
  20931. * @param {Object} object The object to iterate over.
  20932. * @param {Function} iteratee The function invoked per iteration.
  20933. * @param {Function} keysFunc The function to get the keys of `object`.
  20934. * @returns {Object} Returns `object`.
  20935. */
  20936. var baseFor = createBaseFor();
  20937. /**
  20938. * This function is like `baseFor` except that it iterates over properties
  20939. * in the opposite order.
  20940. *
  20941. * @private
  20942. * @param {Object} object The object to iterate over.
  20943. * @param {Function} iteratee The function invoked per iteration.
  20944. * @param {Function} keysFunc The function to get the keys of `object`.
  20945. * @returns {Object} Returns `object`.
  20946. */
  20947. var baseForRight = createBaseFor(true);
  20948. /**
  20949. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20950. *
  20951. * @private
  20952. * @param {Object} object The object to iterate over.
  20953. * @param {Function} iteratee The function invoked per iteration.
  20954. * @returns {Object} Returns `object`.
  20955. */
  20956. function baseForOwn(object, iteratee) {
  20957. return object && baseFor(object, iteratee, keys);
  20958. }
  20959. /**
  20960. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20961. *
  20962. * @private
  20963. * @param {Object} object The object to iterate over.
  20964. * @param {Function} iteratee The function invoked per iteration.
  20965. * @returns {Object} Returns `object`.
  20966. */
  20967. function baseForOwnRight(object, iteratee) {
  20968. return object && baseForRight(object, iteratee, keys);
  20969. }
  20970. /**
  20971. * The base implementation of `_.functions` which creates an array of
  20972. * `object` function property names filtered from `props`.
  20973. *
  20974. * @private
  20975. * @param {Object} object The object to inspect.
  20976. * @param {Array} props The property names to filter.
  20977. * @returns {Array} Returns the function names.
  20978. */
  20979. function baseFunctions(object, props) {
  20980. return arrayFilter(props, function(key) {
  20981. return isFunction(object[key]);
  20982. });
  20983. }
  20984. /**
  20985. * The base implementation of `_.get` without support for default values.
  20986. *
  20987. * @private
  20988. * @param {Object} object The object to query.
  20989. * @param {Array|string} path The path of the property to get.
  20990. * @returns {*} Returns the resolved value.
  20991. */
  20992. function baseGet(object, path) {
  20993. path = castPath(path, object);
  20994. var index = 0,
  20995. length = path.length;
  20996. while (object != null && index < length) {
  20997. object = object[toKey(path[index++])];
  20998. }
  20999. return (index && index == length) ? object : undefined;
  21000. }
  21001. /**
  21002. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21003. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21004. * symbols of `object`.
  21005. *
  21006. * @private
  21007. * @param {Object} object The object to query.
  21008. * @param {Function} keysFunc The function to get the keys of `object`.
  21009. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21010. * @returns {Array} Returns the array of property names and symbols.
  21011. */
  21012. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21013. var result = keysFunc(object);
  21014. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21015. }
  21016. /**
  21017. * The base implementation of `getTag` without fallbacks for buggy environments.
  21018. *
  21019. * @private
  21020. * @param {*} value The value to query.
  21021. * @returns {string} Returns the `toStringTag`.
  21022. */
  21023. function baseGetTag(value) {
  21024. if (value == null) {
  21025. return value === undefined ? undefinedTag : nullTag;
  21026. }
  21027. return (symToStringTag && symToStringTag in Object(value))
  21028. ? getRawTag(value)
  21029. : objectToString(value);
  21030. }
  21031. /**
  21032. * The base implementation of `_.gt` which doesn't coerce arguments.
  21033. *
  21034. * @private
  21035. * @param {*} value The value to compare.
  21036. * @param {*} other The other value to compare.
  21037. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21038. * else `false`.
  21039. */
  21040. function baseGt(value, other) {
  21041. return value > other;
  21042. }
  21043. /**
  21044. * The base implementation of `_.has` without support for deep paths.
  21045. *
  21046. * @private
  21047. * @param {Object} [object] The object to query.
  21048. * @param {Array|string} key The key to check.
  21049. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21050. */
  21051. function baseHas(object, key) {
  21052. return object != null && hasOwnProperty.call(object, key);
  21053. }
  21054. /**
  21055. * The base implementation of `_.hasIn` without support for deep paths.
  21056. *
  21057. * @private
  21058. * @param {Object} [object] The object to query.
  21059. * @param {Array|string} key The key to check.
  21060. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21061. */
  21062. function baseHasIn(object, key) {
  21063. return object != null && key in Object(object);
  21064. }
  21065. /**
  21066. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21067. *
  21068. * @private
  21069. * @param {number} number The number to check.
  21070. * @param {number} start The start of the range.
  21071. * @param {number} end The end of the range.
  21072. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21073. */
  21074. function baseInRange(number, start, end) {
  21075. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21076. }
  21077. /**
  21078. * The base implementation of methods like `_.intersection`, without support
  21079. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21080. *
  21081. * @private
  21082. * @param {Array} arrays The arrays to inspect.
  21083. * @param {Function} [iteratee] The iteratee invoked per element.
  21084. * @param {Function} [comparator] The comparator invoked per element.
  21085. * @returns {Array} Returns the new array of shared values.
  21086. */
  21087. function baseIntersection(arrays, iteratee, comparator) {
  21088. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21089. length = arrays[0].length,
  21090. othLength = arrays.length,
  21091. othIndex = othLength,
  21092. caches = Array(othLength),
  21093. maxLength = Infinity,
  21094. result = [];
  21095. while (othIndex--) {
  21096. var array = arrays[othIndex];
  21097. if (othIndex && iteratee) {
  21098. array = arrayMap(array, baseUnary(iteratee));
  21099. }
  21100. maxLength = nativeMin(array.length, maxLength);
  21101. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21102. ? new SetCache(othIndex && array)
  21103. : undefined;
  21104. }
  21105. array = arrays[0];
  21106. var index = -1,
  21107. seen = caches[0];
  21108. outer:
  21109. while (++index < length && result.length < maxLength) {
  21110. var value = array[index],
  21111. computed = iteratee ? iteratee(value) : value;
  21112. value = (comparator || value !== 0) ? value : 0;
  21113. if (!(seen
  21114. ? cacheHas(seen, computed)
  21115. : includes(result, computed, comparator)
  21116. )) {
  21117. othIndex = othLength;
  21118. while (--othIndex) {
  21119. var cache = caches[othIndex];
  21120. if (!(cache
  21121. ? cacheHas(cache, computed)
  21122. : includes(arrays[othIndex], computed, comparator))
  21123. ) {
  21124. continue outer;
  21125. }
  21126. }
  21127. if (seen) {
  21128. seen.push(computed);
  21129. }
  21130. result.push(value);
  21131. }
  21132. }
  21133. return result;
  21134. }
  21135. /**
  21136. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21137. * `object` with values transformed by `iteratee` and set by `setter`.
  21138. *
  21139. * @private
  21140. * @param {Object} object The object to iterate over.
  21141. * @param {Function} setter The function to set `accumulator` values.
  21142. * @param {Function} iteratee The iteratee to transform values.
  21143. * @param {Object} accumulator The initial inverted object.
  21144. * @returns {Function} Returns `accumulator`.
  21145. */
  21146. function baseInverter(object, setter, iteratee, accumulator) {
  21147. baseForOwn(object, function(value, key, object) {
  21148. setter(accumulator, iteratee(value), key, object);
  21149. });
  21150. return accumulator;
  21151. }
  21152. /**
  21153. * The base implementation of `_.invoke` without support for individual
  21154. * method arguments.
  21155. *
  21156. * @private
  21157. * @param {Object} object The object to query.
  21158. * @param {Array|string} path The path of the method to invoke.
  21159. * @param {Array} args The arguments to invoke the method with.
  21160. * @returns {*} Returns the result of the invoked method.
  21161. */
  21162. function baseInvoke(object, path, args) {
  21163. path = castPath(path, object);
  21164. object = parent(object, path);
  21165. var func = object == null ? object : object[toKey(last(path))];
  21166. return func == null ? undefined : apply(func, object, args);
  21167. }
  21168. /**
  21169. * The base implementation of `_.isArguments`.
  21170. *
  21171. * @private
  21172. * @param {*} value The value to check.
  21173. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21174. */
  21175. function baseIsArguments(value) {
  21176. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21177. }
  21178. /**
  21179. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21180. *
  21181. * @private
  21182. * @param {*} value The value to check.
  21183. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21184. */
  21185. function baseIsArrayBuffer(value) {
  21186. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21187. }
  21188. /**
  21189. * The base implementation of `_.isDate` without Node.js optimizations.
  21190. *
  21191. * @private
  21192. * @param {*} value The value to check.
  21193. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21194. */
  21195. function baseIsDate(value) {
  21196. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21197. }
  21198. /**
  21199. * The base implementation of `_.isEqual` which supports partial comparisons
  21200. * and tracks traversed objects.
  21201. *
  21202. * @private
  21203. * @param {*} value The value to compare.
  21204. * @param {*} other The other value to compare.
  21205. * @param {boolean} bitmask The bitmask flags.
  21206. * 1 - Unordered comparison
  21207. * 2 - Partial comparison
  21208. * @param {Function} [customizer] The function to customize comparisons.
  21209. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21210. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21211. */
  21212. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21213. if (value === other) {
  21214. return true;
  21215. }
  21216. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21217. return value !== value && other !== other;
  21218. }
  21219. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21220. }
  21221. /**
  21222. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21223. * deep comparisons and tracks traversed objects enabling objects with circular
  21224. * references to be compared.
  21225. *
  21226. * @private
  21227. * @param {Object} object The object to compare.
  21228. * @param {Object} other The other object to compare.
  21229. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21230. * @param {Function} customizer The function to customize comparisons.
  21231. * @param {Function} equalFunc The function to determine equivalents of values.
  21232. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21233. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21234. */
  21235. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21236. var objIsArr = isArray(object),
  21237. othIsArr = isArray(other),
  21238. objTag = objIsArr ? arrayTag : getTag(object),
  21239. othTag = othIsArr ? arrayTag : getTag(other);
  21240. objTag = objTag == argsTag ? objectTag : objTag;
  21241. othTag = othTag == argsTag ? objectTag : othTag;
  21242. var objIsObj = objTag == objectTag,
  21243. othIsObj = othTag == objectTag,
  21244. isSameTag = objTag == othTag;
  21245. if (isSameTag && isBuffer(object)) {
  21246. if (!isBuffer(other)) {
  21247. return false;
  21248. }
  21249. objIsArr = true;
  21250. objIsObj = false;
  21251. }
  21252. if (isSameTag && !objIsObj) {
  21253. stack || (stack = new Stack);
  21254. return (objIsArr || isTypedArray(object))
  21255. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21256. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21257. }
  21258. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21259. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21260. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21261. if (objIsWrapped || othIsWrapped) {
  21262. var objUnwrapped = objIsWrapped ? object.value() : object,
  21263. othUnwrapped = othIsWrapped ? other.value() : other;
  21264. stack || (stack = new Stack);
  21265. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21266. }
  21267. }
  21268. if (!isSameTag) {
  21269. return false;
  21270. }
  21271. stack || (stack = new Stack);
  21272. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21273. }
  21274. /**
  21275. * The base implementation of `_.isMap` without Node.js optimizations.
  21276. *
  21277. * @private
  21278. * @param {*} value The value to check.
  21279. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21280. */
  21281. function baseIsMap(value) {
  21282. return isObjectLike(value) && getTag(value) == mapTag;
  21283. }
  21284. /**
  21285. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21286. *
  21287. * @private
  21288. * @param {Object} object The object to inspect.
  21289. * @param {Object} source The object of property values to match.
  21290. * @param {Array} matchData The property names, values, and compare flags to match.
  21291. * @param {Function} [customizer] The function to customize comparisons.
  21292. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21293. */
  21294. function baseIsMatch(object, source, matchData, customizer) {
  21295. var index = matchData.length,
  21296. length = index,
  21297. noCustomizer = !customizer;
  21298. if (object == null) {
  21299. return !length;
  21300. }
  21301. object = Object(object);
  21302. while (index--) {
  21303. var data = matchData[index];
  21304. if ((noCustomizer && data[2])
  21305. ? data[1] !== object[data[0]]
  21306. : !(data[0] in object)
  21307. ) {
  21308. return false;
  21309. }
  21310. }
  21311. while (++index < length) {
  21312. data = matchData[index];
  21313. var key = data[0],
  21314. objValue = object[key],
  21315. srcValue = data[1];
  21316. if (noCustomizer && data[2]) {
  21317. if (objValue === undefined && !(key in object)) {
  21318. return false;
  21319. }
  21320. } else {
  21321. var stack = new Stack;
  21322. if (customizer) {
  21323. var result = customizer(objValue, srcValue, key, object, source, stack);
  21324. }
  21325. if (!(result === undefined
  21326. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21327. : result
  21328. )) {
  21329. return false;
  21330. }
  21331. }
  21332. }
  21333. return true;
  21334. }
  21335. /**
  21336. * The base implementation of `_.isNative` without bad shim checks.
  21337. *
  21338. * @private
  21339. * @param {*} value The value to check.
  21340. * @returns {boolean} Returns `true` if `value` is a native function,
  21341. * else `false`.
  21342. */
  21343. function baseIsNative(value) {
  21344. if (!isObject(value) || isMasked(value)) {
  21345. return false;
  21346. }
  21347. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21348. return pattern.test(toSource(value));
  21349. }
  21350. /**
  21351. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21352. *
  21353. * @private
  21354. * @param {*} value The value to check.
  21355. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21356. */
  21357. function baseIsRegExp(value) {
  21358. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21359. }
  21360. /**
  21361. * The base implementation of `_.isSet` without Node.js optimizations.
  21362. *
  21363. * @private
  21364. * @param {*} value The value to check.
  21365. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21366. */
  21367. function baseIsSet(value) {
  21368. return isObjectLike(value) && getTag(value) == setTag;
  21369. }
  21370. /**
  21371. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21372. *
  21373. * @private
  21374. * @param {*} value The value to check.
  21375. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21376. */
  21377. function baseIsTypedArray(value) {
  21378. return isObjectLike(value) &&
  21379. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21380. }
  21381. /**
  21382. * The base implementation of `_.iteratee`.
  21383. *
  21384. * @private
  21385. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21386. * @returns {Function} Returns the iteratee.
  21387. */
  21388. function baseIteratee(value) {
  21389. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21390. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21391. if (typeof value == 'function') {
  21392. return value;
  21393. }
  21394. if (value == null) {
  21395. return identity;
  21396. }
  21397. if (typeof value == 'object') {
  21398. return isArray(value)
  21399. ? baseMatchesProperty(value[0], value[1])
  21400. : baseMatches(value);
  21401. }
  21402. return property(value);
  21403. }
  21404. /**
  21405. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21406. *
  21407. * @private
  21408. * @param {Object} object The object to query.
  21409. * @returns {Array} Returns the array of property names.
  21410. */
  21411. function baseKeys(object) {
  21412. if (!isPrototype(object)) {
  21413. return nativeKeys(object);
  21414. }
  21415. var result = [];
  21416. for (var key in Object(object)) {
  21417. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21418. result.push(key);
  21419. }
  21420. }
  21421. return result;
  21422. }
  21423. /**
  21424. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21425. *
  21426. * @private
  21427. * @param {Object} object The object to query.
  21428. * @returns {Array} Returns the array of property names.
  21429. */
  21430. function baseKeysIn(object) {
  21431. if (!isObject(object)) {
  21432. return nativeKeysIn(object);
  21433. }
  21434. var isProto = isPrototype(object),
  21435. result = [];
  21436. for (var key in object) {
  21437. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21438. result.push(key);
  21439. }
  21440. }
  21441. return result;
  21442. }
  21443. /**
  21444. * The base implementation of `_.lt` which doesn't coerce arguments.
  21445. *
  21446. * @private
  21447. * @param {*} value The value to compare.
  21448. * @param {*} other The other value to compare.
  21449. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21450. * else `false`.
  21451. */
  21452. function baseLt(value, other) {
  21453. return value < other;
  21454. }
  21455. /**
  21456. * The base implementation of `_.map` without support for iteratee shorthands.
  21457. *
  21458. * @private
  21459. * @param {Array|Object} collection The collection to iterate over.
  21460. * @param {Function} iteratee The function invoked per iteration.
  21461. * @returns {Array} Returns the new mapped array.
  21462. */
  21463. function baseMap(collection, iteratee) {
  21464. var index = -1,
  21465. result = isArrayLike(collection) ? Array(collection.length) : [];
  21466. baseEach(collection, function(value, key, collection) {
  21467. result[++index] = iteratee(value, key, collection);
  21468. });
  21469. return result;
  21470. }
  21471. /**
  21472. * The base implementation of `_.matches` which doesn't clone `source`.
  21473. *
  21474. * @private
  21475. * @param {Object} source The object of property values to match.
  21476. * @returns {Function} Returns the new spec function.
  21477. */
  21478. function baseMatches(source) {
  21479. var matchData = getMatchData(source);
  21480. if (matchData.length == 1 && matchData[0][2]) {
  21481. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21482. }
  21483. return function(object) {
  21484. return object === source || baseIsMatch(object, source, matchData);
  21485. };
  21486. }
  21487. /**
  21488. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21489. *
  21490. * @private
  21491. * @param {string} path The path of the property to get.
  21492. * @param {*} srcValue The value to match.
  21493. * @returns {Function} Returns the new spec function.
  21494. */
  21495. function baseMatchesProperty(path, srcValue) {
  21496. if (isKey(path) && isStrictComparable(srcValue)) {
  21497. return matchesStrictComparable(toKey(path), srcValue);
  21498. }
  21499. return function(object) {
  21500. var objValue = get(object, path);
  21501. return (objValue === undefined && objValue === srcValue)
  21502. ? hasIn(object, path)
  21503. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21504. };
  21505. }
  21506. /**
  21507. * The base implementation of `_.merge` without support for multiple sources.
  21508. *
  21509. * @private
  21510. * @param {Object} object The destination object.
  21511. * @param {Object} source The source object.
  21512. * @param {number} srcIndex The index of `source`.
  21513. * @param {Function} [customizer] The function to customize merged values.
  21514. * @param {Object} [stack] Tracks traversed source values and their merged
  21515. * counterparts.
  21516. */
  21517. function baseMerge(object, source, srcIndex, customizer, stack) {
  21518. if (object === source) {
  21519. return;
  21520. }
  21521. baseFor(source, function(srcValue, key) {
  21522. stack || (stack = new Stack);
  21523. if (isObject(srcValue)) {
  21524. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21525. }
  21526. else {
  21527. var newValue = customizer
  21528. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21529. : undefined;
  21530. if (newValue === undefined) {
  21531. newValue = srcValue;
  21532. }
  21533. assignMergeValue(object, key, newValue);
  21534. }
  21535. }, keysIn);
  21536. }
  21537. /**
  21538. * A specialized version of `baseMerge` for arrays and objects which performs
  21539. * deep merges and tracks traversed objects enabling objects with circular
  21540. * references to be merged.
  21541. *
  21542. * @private
  21543. * @param {Object} object The destination object.
  21544. * @param {Object} source The source object.
  21545. * @param {string} key The key of the value to merge.
  21546. * @param {number} srcIndex The index of `source`.
  21547. * @param {Function} mergeFunc The function to merge values.
  21548. * @param {Function} [customizer] The function to customize assigned values.
  21549. * @param {Object} [stack] Tracks traversed source values and their merged
  21550. * counterparts.
  21551. */
  21552. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21553. var objValue = safeGet(object, key),
  21554. srcValue = safeGet(source, key),
  21555. stacked = stack.get(srcValue);
  21556. if (stacked) {
  21557. assignMergeValue(object, key, stacked);
  21558. return;
  21559. }
  21560. var newValue = customizer
  21561. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21562. : undefined;
  21563. var isCommon = newValue === undefined;
  21564. if (isCommon) {
  21565. var isArr = isArray(srcValue),
  21566. isBuff = !isArr && isBuffer(srcValue),
  21567. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21568. newValue = srcValue;
  21569. if (isArr || isBuff || isTyped) {
  21570. if (isArray(objValue)) {
  21571. newValue = objValue;
  21572. }
  21573. else if (isArrayLikeObject(objValue)) {
  21574. newValue = copyArray(objValue);
  21575. }
  21576. else if (isBuff) {
  21577. isCommon = false;
  21578. newValue = cloneBuffer(srcValue, true);
  21579. }
  21580. else if (isTyped) {
  21581. isCommon = false;
  21582. newValue = cloneTypedArray(srcValue, true);
  21583. }
  21584. else {
  21585. newValue = [];
  21586. }
  21587. }
  21588. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21589. newValue = objValue;
  21590. if (isArguments(objValue)) {
  21591. newValue = toPlainObject(objValue);
  21592. }
  21593. else if (!isObject(objValue) || isFunction(objValue)) {
  21594. newValue = initCloneObject(srcValue);
  21595. }
  21596. }
  21597. else {
  21598. isCommon = false;
  21599. }
  21600. }
  21601. if (isCommon) {
  21602. // Recursively merge objects and arrays (susceptible to call stack limits).
  21603. stack.set(srcValue, newValue);
  21604. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21605. stack['delete'](srcValue);
  21606. }
  21607. assignMergeValue(object, key, newValue);
  21608. }
  21609. /**
  21610. * The base implementation of `_.nth` which doesn't coerce arguments.
  21611. *
  21612. * @private
  21613. * @param {Array} array The array to query.
  21614. * @param {number} n The index of the element to return.
  21615. * @returns {*} Returns the nth element of `array`.
  21616. */
  21617. function baseNth(array, n) {
  21618. var length = array.length;
  21619. if (!length) {
  21620. return;
  21621. }
  21622. n += n < 0 ? length : 0;
  21623. return isIndex(n, length) ? array[n] : undefined;
  21624. }
  21625. /**
  21626. * The base implementation of `_.orderBy` without param guards.
  21627. *
  21628. * @private
  21629. * @param {Array|Object} collection The collection to iterate over.
  21630. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21631. * @param {string[]} orders The sort orders of `iteratees`.
  21632. * @returns {Array} Returns the new sorted array.
  21633. */
  21634. function baseOrderBy(collection, iteratees, orders) {
  21635. var index = -1;
  21636. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21637. var result = baseMap(collection, function(value, key, collection) {
  21638. var criteria = arrayMap(iteratees, function(iteratee) {
  21639. return iteratee(value);
  21640. });
  21641. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21642. });
  21643. return baseSortBy(result, function(object, other) {
  21644. return compareMultiple(object, other, orders);
  21645. });
  21646. }
  21647. /**
  21648. * The base implementation of `_.pick` without support for individual
  21649. * property identifiers.
  21650. *
  21651. * @private
  21652. * @param {Object} object The source object.
  21653. * @param {string[]} paths The property paths to pick.
  21654. * @returns {Object} Returns the new object.
  21655. */
  21656. function basePick(object, paths) {
  21657. return basePickBy(object, paths, function(value, path) {
  21658. return hasIn(object, path);
  21659. });
  21660. }
  21661. /**
  21662. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21663. *
  21664. * @private
  21665. * @param {Object} object The source object.
  21666. * @param {string[]} paths The property paths to pick.
  21667. * @param {Function} predicate The function invoked per property.
  21668. * @returns {Object} Returns the new object.
  21669. */
  21670. function basePickBy(object, paths, predicate) {
  21671. var index = -1,
  21672. length = paths.length,
  21673. result = {};
  21674. while (++index < length) {
  21675. var path = paths[index],
  21676. value = baseGet(object, path);
  21677. if (predicate(value, path)) {
  21678. baseSet(result, castPath(path, object), value);
  21679. }
  21680. }
  21681. return result;
  21682. }
  21683. /**
  21684. * A specialized version of `baseProperty` which supports deep paths.
  21685. *
  21686. * @private
  21687. * @param {Array|string} path The path of the property to get.
  21688. * @returns {Function} Returns the new accessor function.
  21689. */
  21690. function basePropertyDeep(path) {
  21691. return function(object) {
  21692. return baseGet(object, path);
  21693. };
  21694. }
  21695. /**
  21696. * The base implementation of `_.pullAllBy` without support for iteratee
  21697. * shorthands.
  21698. *
  21699. * @private
  21700. * @param {Array} array The array to modify.
  21701. * @param {Array} values The values to remove.
  21702. * @param {Function} [iteratee] The iteratee invoked per element.
  21703. * @param {Function} [comparator] The comparator invoked per element.
  21704. * @returns {Array} Returns `array`.
  21705. */
  21706. function basePullAll(array, values, iteratee, comparator) {
  21707. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21708. index = -1,
  21709. length = values.length,
  21710. seen = array;
  21711. if (array === values) {
  21712. values = copyArray(values);
  21713. }
  21714. if (iteratee) {
  21715. seen = arrayMap(array, baseUnary(iteratee));
  21716. }
  21717. while (++index < length) {
  21718. var fromIndex = 0,
  21719. value = values[index],
  21720. computed = iteratee ? iteratee(value) : value;
  21721. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21722. if (seen !== array) {
  21723. splice.call(seen, fromIndex, 1);
  21724. }
  21725. splice.call(array, fromIndex, 1);
  21726. }
  21727. }
  21728. return array;
  21729. }
  21730. /**
  21731. * The base implementation of `_.pullAt` without support for individual
  21732. * indexes or capturing the removed elements.
  21733. *
  21734. * @private
  21735. * @param {Array} array The array to modify.
  21736. * @param {number[]} indexes The indexes of elements to remove.
  21737. * @returns {Array} Returns `array`.
  21738. */
  21739. function basePullAt(array, indexes) {
  21740. var length = array ? indexes.length : 0,
  21741. lastIndex = length - 1;
  21742. while (length--) {
  21743. var index = indexes[length];
  21744. if (length == lastIndex || index !== previous) {
  21745. var previous = index;
  21746. if (isIndex(index)) {
  21747. splice.call(array, index, 1);
  21748. } else {
  21749. baseUnset(array, index);
  21750. }
  21751. }
  21752. }
  21753. return array;
  21754. }
  21755. /**
  21756. * The base implementation of `_.random` without support for returning
  21757. * floating-point numbers.
  21758. *
  21759. * @private
  21760. * @param {number} lower The lower bound.
  21761. * @param {number} upper The upper bound.
  21762. * @returns {number} Returns the random number.
  21763. */
  21764. function baseRandom(lower, upper) {
  21765. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21766. }
  21767. /**
  21768. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21769. * coerce arguments.
  21770. *
  21771. * @private
  21772. * @param {number} start The start of the range.
  21773. * @param {number} end The end of the range.
  21774. * @param {number} step The value to increment or decrement by.
  21775. * @param {boolean} [fromRight] Specify iterating from right to left.
  21776. * @returns {Array} Returns the range of numbers.
  21777. */
  21778. function baseRange(start, end, step, fromRight) {
  21779. var index = -1,
  21780. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21781. result = Array(length);
  21782. while (length--) {
  21783. result[fromRight ? length : ++index] = start;
  21784. start += step;
  21785. }
  21786. return result;
  21787. }
  21788. /**
  21789. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21790. *
  21791. * @private
  21792. * @param {string} string The string to repeat.
  21793. * @param {number} n The number of times to repeat the string.
  21794. * @returns {string} Returns the repeated string.
  21795. */
  21796. function baseRepeat(string, n) {
  21797. var result = '';
  21798. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21799. return result;
  21800. }
  21801. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21802. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21803. do {
  21804. if (n % 2) {
  21805. result += string;
  21806. }
  21807. n = nativeFloor(n / 2);
  21808. if (n) {
  21809. string += string;
  21810. }
  21811. } while (n);
  21812. return result;
  21813. }
  21814. /**
  21815. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21816. *
  21817. * @private
  21818. * @param {Function} func The function to apply a rest parameter to.
  21819. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21820. * @returns {Function} Returns the new function.
  21821. */
  21822. function baseRest(func, start) {
  21823. return setToString(overRest(func, start, identity), func + '');
  21824. }
  21825. /**
  21826. * The base implementation of `_.sample`.
  21827. *
  21828. * @private
  21829. * @param {Array|Object} collection The collection to sample.
  21830. * @returns {*} Returns the random element.
  21831. */
  21832. function baseSample(collection) {
  21833. return arraySample(values(collection));
  21834. }
  21835. /**
  21836. * The base implementation of `_.sampleSize` without param guards.
  21837. *
  21838. * @private
  21839. * @param {Array|Object} collection The collection to sample.
  21840. * @param {number} n The number of elements to sample.
  21841. * @returns {Array} Returns the random elements.
  21842. */
  21843. function baseSampleSize(collection, n) {
  21844. var array = values(collection);
  21845. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21846. }
  21847. /**
  21848. * The base implementation of `_.set`.
  21849. *
  21850. * @private
  21851. * @param {Object} object The object to modify.
  21852. * @param {Array|string} path The path of the property to set.
  21853. * @param {*} value The value to set.
  21854. * @param {Function} [customizer] The function to customize path creation.
  21855. * @returns {Object} Returns `object`.
  21856. */
  21857. function baseSet(object, path, value, customizer) {
  21858. if (!isObject(object)) {
  21859. return object;
  21860. }
  21861. path = castPath(path, object);
  21862. var index = -1,
  21863. length = path.length,
  21864. lastIndex = length - 1,
  21865. nested = object;
  21866. while (nested != null && ++index < length) {
  21867. var key = toKey(path[index]),
  21868. newValue = value;
  21869. if (index != lastIndex) {
  21870. var objValue = nested[key];
  21871. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21872. if (newValue === undefined) {
  21873. newValue = isObject(objValue)
  21874. ? objValue
  21875. : (isIndex(path[index + 1]) ? [] : {});
  21876. }
  21877. }
  21878. assignValue(nested, key, newValue);
  21879. nested = nested[key];
  21880. }
  21881. return object;
  21882. }
  21883. /**
  21884. * The base implementation of `setData` without support for hot loop shorting.
  21885. *
  21886. * @private
  21887. * @param {Function} func The function to associate metadata with.
  21888. * @param {*} data The metadata.
  21889. * @returns {Function} Returns `func`.
  21890. */
  21891. var baseSetData = !metaMap ? identity : function(func, data) {
  21892. metaMap.set(func, data);
  21893. return func;
  21894. };
  21895. /**
  21896. * The base implementation of `setToString` without support for hot loop shorting.
  21897. *
  21898. * @private
  21899. * @param {Function} func The function to modify.
  21900. * @param {Function} string The `toString` result.
  21901. * @returns {Function} Returns `func`.
  21902. */
  21903. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21904. return defineProperty(func, 'toString', {
  21905. 'configurable': true,
  21906. 'enumerable': false,
  21907. 'value': constant(string),
  21908. 'writable': true
  21909. });
  21910. };
  21911. /**
  21912. * The base implementation of `_.shuffle`.
  21913. *
  21914. * @private
  21915. * @param {Array|Object} collection The collection to shuffle.
  21916. * @returns {Array} Returns the new shuffled array.
  21917. */
  21918. function baseShuffle(collection) {
  21919. return shuffleSelf(values(collection));
  21920. }
  21921. /**
  21922. * The base implementation of `_.slice` without an iteratee call guard.
  21923. *
  21924. * @private
  21925. * @param {Array} array The array to slice.
  21926. * @param {number} [start=0] The start position.
  21927. * @param {number} [end=array.length] The end position.
  21928. * @returns {Array} Returns the slice of `array`.
  21929. */
  21930. function baseSlice(array, start, end) {
  21931. var index = -1,
  21932. length = array.length;
  21933. if (start < 0) {
  21934. start = -start > length ? 0 : (length + start);
  21935. }
  21936. end = end > length ? length : end;
  21937. if (end < 0) {
  21938. end += length;
  21939. }
  21940. length = start > end ? 0 : ((end - start) >>> 0);
  21941. start >>>= 0;
  21942. var result = Array(length);
  21943. while (++index < length) {
  21944. result[index] = array[index + start];
  21945. }
  21946. return result;
  21947. }
  21948. /**
  21949. * The base implementation of `_.some` without support for iteratee shorthands.
  21950. *
  21951. * @private
  21952. * @param {Array|Object} collection The collection to iterate over.
  21953. * @param {Function} predicate The function invoked per iteration.
  21954. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21955. * else `false`.
  21956. */
  21957. function baseSome(collection, predicate) {
  21958. var result;
  21959. baseEach(collection, function(value, index, collection) {
  21960. result = predicate(value, index, collection);
  21961. return !result;
  21962. });
  21963. return !!result;
  21964. }
  21965. /**
  21966. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21967. * performs a binary search of `array` to determine the index at which `value`
  21968. * should be inserted into `array` in order to maintain its sort order.
  21969. *
  21970. * @private
  21971. * @param {Array} array The sorted array to inspect.
  21972. * @param {*} value The value to evaluate.
  21973. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21974. * @returns {number} Returns the index at which `value` should be inserted
  21975. * into `array`.
  21976. */
  21977. function baseSortedIndex(array, value, retHighest) {
  21978. var low = 0,
  21979. high = array == null ? low : array.length;
  21980. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21981. while (low < high) {
  21982. var mid = (low + high) >>> 1,
  21983. computed = array[mid];
  21984. if (computed !== null && !isSymbol(computed) &&
  21985. (retHighest ? (computed <= value) : (computed < value))) {
  21986. low = mid + 1;
  21987. } else {
  21988. high = mid;
  21989. }
  21990. }
  21991. return high;
  21992. }
  21993. return baseSortedIndexBy(array, value, identity, retHighest);
  21994. }
  21995. /**
  21996. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21997. * which invokes `iteratee` for `value` and each element of `array` to compute
  21998. * their sort ranking. The iteratee is invoked with one argument; (value).
  21999. *
  22000. * @private
  22001. * @param {Array} array The sorted array to inspect.
  22002. * @param {*} value The value to evaluate.
  22003. * @param {Function} iteratee The iteratee invoked per element.
  22004. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22005. * @returns {number} Returns the index at which `value` should be inserted
  22006. * into `array`.
  22007. */
  22008. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22009. value = iteratee(value);
  22010. var low = 0,
  22011. high = array == null ? 0 : array.length,
  22012. valIsNaN = value !== value,
  22013. valIsNull = value === null,
  22014. valIsSymbol = isSymbol(value),
  22015. valIsUndefined = value === undefined;
  22016. while (low < high) {
  22017. var mid = nativeFloor((low + high) / 2),
  22018. computed = iteratee(array[mid]),
  22019. othIsDefined = computed !== undefined,
  22020. othIsNull = computed === null,
  22021. othIsReflexive = computed === computed,
  22022. othIsSymbol = isSymbol(computed);
  22023. if (valIsNaN) {
  22024. var setLow = retHighest || othIsReflexive;
  22025. } else if (valIsUndefined) {
  22026. setLow = othIsReflexive && (retHighest || othIsDefined);
  22027. } else if (valIsNull) {
  22028. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22029. } else if (valIsSymbol) {
  22030. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22031. } else if (othIsNull || othIsSymbol) {
  22032. setLow = false;
  22033. } else {
  22034. setLow = retHighest ? (computed <= value) : (computed < value);
  22035. }
  22036. if (setLow) {
  22037. low = mid + 1;
  22038. } else {
  22039. high = mid;
  22040. }
  22041. }
  22042. return nativeMin(high, MAX_ARRAY_INDEX);
  22043. }
  22044. /**
  22045. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22046. * support for iteratee shorthands.
  22047. *
  22048. * @private
  22049. * @param {Array} array The array to inspect.
  22050. * @param {Function} [iteratee] The iteratee invoked per element.
  22051. * @returns {Array} Returns the new duplicate free array.
  22052. */
  22053. function baseSortedUniq(array, iteratee) {
  22054. var index = -1,
  22055. length = array.length,
  22056. resIndex = 0,
  22057. result = [];
  22058. while (++index < length) {
  22059. var value = array[index],
  22060. computed = iteratee ? iteratee(value) : value;
  22061. if (!index || !eq(computed, seen)) {
  22062. var seen = computed;
  22063. result[resIndex++] = value === 0 ? 0 : value;
  22064. }
  22065. }
  22066. return result;
  22067. }
  22068. /**
  22069. * The base implementation of `_.toNumber` which doesn't ensure correct
  22070. * conversions of binary, hexadecimal, or octal string values.
  22071. *
  22072. * @private
  22073. * @param {*} value The value to process.
  22074. * @returns {number} Returns the number.
  22075. */
  22076. function baseToNumber(value) {
  22077. if (typeof value == 'number') {
  22078. return value;
  22079. }
  22080. if (isSymbol(value)) {
  22081. return NAN;
  22082. }
  22083. return +value;
  22084. }
  22085. /**
  22086. * The base implementation of `_.toString` which doesn't convert nullish
  22087. * values to empty strings.
  22088. *
  22089. * @private
  22090. * @param {*} value The value to process.
  22091. * @returns {string} Returns the string.
  22092. */
  22093. function baseToString(value) {
  22094. // Exit early for strings to avoid a performance hit in some environments.
  22095. if (typeof value == 'string') {
  22096. return value;
  22097. }
  22098. if (isArray(value)) {
  22099. // Recursively convert values (susceptible to call stack limits).
  22100. return arrayMap(value, baseToString) + '';
  22101. }
  22102. if (isSymbol(value)) {
  22103. return symbolToString ? symbolToString.call(value) : '';
  22104. }
  22105. var result = (value + '');
  22106. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22107. }
  22108. /**
  22109. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22110. *
  22111. * @private
  22112. * @param {Array} array The array to inspect.
  22113. * @param {Function} [iteratee] The iteratee invoked per element.
  22114. * @param {Function} [comparator] The comparator invoked per element.
  22115. * @returns {Array} Returns the new duplicate free array.
  22116. */
  22117. function baseUniq(array, iteratee, comparator) {
  22118. var index = -1,
  22119. includes = arrayIncludes,
  22120. length = array.length,
  22121. isCommon = true,
  22122. result = [],
  22123. seen = result;
  22124. if (comparator) {
  22125. isCommon = false;
  22126. includes = arrayIncludesWith;
  22127. }
  22128. else if (length >= LARGE_ARRAY_SIZE) {
  22129. var set = iteratee ? null : createSet(array);
  22130. if (set) {
  22131. return setToArray(set);
  22132. }
  22133. isCommon = false;
  22134. includes = cacheHas;
  22135. seen = new SetCache;
  22136. }
  22137. else {
  22138. seen = iteratee ? [] : result;
  22139. }
  22140. outer:
  22141. while (++index < length) {
  22142. var value = array[index],
  22143. computed = iteratee ? iteratee(value) : value;
  22144. value = (comparator || value !== 0) ? value : 0;
  22145. if (isCommon && computed === computed) {
  22146. var seenIndex = seen.length;
  22147. while (seenIndex--) {
  22148. if (seen[seenIndex] === computed) {
  22149. continue outer;
  22150. }
  22151. }
  22152. if (iteratee) {
  22153. seen.push(computed);
  22154. }
  22155. result.push(value);
  22156. }
  22157. else if (!includes(seen, computed, comparator)) {
  22158. if (seen !== result) {
  22159. seen.push(computed);
  22160. }
  22161. result.push(value);
  22162. }
  22163. }
  22164. return result;
  22165. }
  22166. /**
  22167. * The base implementation of `_.unset`.
  22168. *
  22169. * @private
  22170. * @param {Object} object The object to modify.
  22171. * @param {Array|string} path The property path to unset.
  22172. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22173. */
  22174. function baseUnset(object, path) {
  22175. path = castPath(path, object);
  22176. object = parent(object, path);
  22177. return object == null || delete object[toKey(last(path))];
  22178. }
  22179. /**
  22180. * The base implementation of `_.update`.
  22181. *
  22182. * @private
  22183. * @param {Object} object The object to modify.
  22184. * @param {Array|string} path The path of the property to update.
  22185. * @param {Function} updater The function to produce the updated value.
  22186. * @param {Function} [customizer] The function to customize path creation.
  22187. * @returns {Object} Returns `object`.
  22188. */
  22189. function baseUpdate(object, path, updater, customizer) {
  22190. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22191. }
  22192. /**
  22193. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22194. * without support for iteratee shorthands.
  22195. *
  22196. * @private
  22197. * @param {Array} array The array to query.
  22198. * @param {Function} predicate The function invoked per iteration.
  22199. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22200. * @param {boolean} [fromRight] Specify iterating from right to left.
  22201. * @returns {Array} Returns the slice of `array`.
  22202. */
  22203. function baseWhile(array, predicate, isDrop, fromRight) {
  22204. var length = array.length,
  22205. index = fromRight ? length : -1;
  22206. while ((fromRight ? index-- : ++index < length) &&
  22207. predicate(array[index], index, array)) {}
  22208. return isDrop
  22209. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22210. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22211. }
  22212. /**
  22213. * The base implementation of `wrapperValue` which returns the result of
  22214. * performing a sequence of actions on the unwrapped `value`, where each
  22215. * successive action is supplied the return value of the previous.
  22216. *
  22217. * @private
  22218. * @param {*} value The unwrapped value.
  22219. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22220. * @returns {*} Returns the resolved value.
  22221. */
  22222. function baseWrapperValue(value, actions) {
  22223. var result = value;
  22224. if (result instanceof LazyWrapper) {
  22225. result = result.value();
  22226. }
  22227. return arrayReduce(actions, function(result, action) {
  22228. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22229. }, result);
  22230. }
  22231. /**
  22232. * The base implementation of methods like `_.xor`, without support for
  22233. * iteratee shorthands, that accepts an array of arrays to inspect.
  22234. *
  22235. * @private
  22236. * @param {Array} arrays The arrays to inspect.
  22237. * @param {Function} [iteratee] The iteratee invoked per element.
  22238. * @param {Function} [comparator] The comparator invoked per element.
  22239. * @returns {Array} Returns the new array of values.
  22240. */
  22241. function baseXor(arrays, iteratee, comparator) {
  22242. var length = arrays.length;
  22243. if (length < 2) {
  22244. return length ? baseUniq(arrays[0]) : [];
  22245. }
  22246. var index = -1,
  22247. result = Array(length);
  22248. while (++index < length) {
  22249. var array = arrays[index],
  22250. othIndex = -1;
  22251. while (++othIndex < length) {
  22252. if (othIndex != index) {
  22253. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22254. }
  22255. }
  22256. }
  22257. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22258. }
  22259. /**
  22260. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22261. *
  22262. * @private
  22263. * @param {Array} props The property identifiers.
  22264. * @param {Array} values The property values.
  22265. * @param {Function} assignFunc The function to assign values.
  22266. * @returns {Object} Returns the new object.
  22267. */
  22268. function baseZipObject(props, values, assignFunc) {
  22269. var index = -1,
  22270. length = props.length,
  22271. valsLength = values.length,
  22272. result = {};
  22273. while (++index < length) {
  22274. var value = index < valsLength ? values[index] : undefined;
  22275. assignFunc(result, props[index], value);
  22276. }
  22277. return result;
  22278. }
  22279. /**
  22280. * Casts `value` to an empty array if it's not an array like object.
  22281. *
  22282. * @private
  22283. * @param {*} value The value to inspect.
  22284. * @returns {Array|Object} Returns the cast array-like object.
  22285. */
  22286. function castArrayLikeObject(value) {
  22287. return isArrayLikeObject(value) ? value : [];
  22288. }
  22289. /**
  22290. * Casts `value` to `identity` if it's not a function.
  22291. *
  22292. * @private
  22293. * @param {*} value The value to inspect.
  22294. * @returns {Function} Returns cast function.
  22295. */
  22296. function castFunction(value) {
  22297. return typeof value == 'function' ? value : identity;
  22298. }
  22299. /**
  22300. * Casts `value` to a path array if it's not one.
  22301. *
  22302. * @private
  22303. * @param {*} value The value to inspect.
  22304. * @param {Object} [object] The object to query keys on.
  22305. * @returns {Array} Returns the cast property path array.
  22306. */
  22307. function castPath(value, object) {
  22308. if (isArray(value)) {
  22309. return value;
  22310. }
  22311. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22312. }
  22313. /**
  22314. * A `baseRest` alias which can be replaced with `identity` by module
  22315. * replacement plugins.
  22316. *
  22317. * @private
  22318. * @type {Function}
  22319. * @param {Function} func The function to apply a rest parameter to.
  22320. * @returns {Function} Returns the new function.
  22321. */
  22322. var castRest = baseRest;
  22323. /**
  22324. * Casts `array` to a slice if it's needed.
  22325. *
  22326. * @private
  22327. * @param {Array} array The array to inspect.
  22328. * @param {number} start The start position.
  22329. * @param {number} [end=array.length] The end position.
  22330. * @returns {Array} Returns the cast slice.
  22331. */
  22332. function castSlice(array, start, end) {
  22333. var length = array.length;
  22334. end = end === undefined ? length : end;
  22335. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22336. }
  22337. /**
  22338. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22339. *
  22340. * @private
  22341. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22342. */
  22343. var clearTimeout = ctxClearTimeout || function(id) {
  22344. return root.clearTimeout(id);
  22345. };
  22346. /**
  22347. * Creates a clone of `buffer`.
  22348. *
  22349. * @private
  22350. * @param {Buffer} buffer The buffer to clone.
  22351. * @param {boolean} [isDeep] Specify a deep clone.
  22352. * @returns {Buffer} Returns the cloned buffer.
  22353. */
  22354. function cloneBuffer(buffer, isDeep) {
  22355. if (isDeep) {
  22356. return buffer.slice();
  22357. }
  22358. var length = buffer.length,
  22359. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22360. buffer.copy(result);
  22361. return result;
  22362. }
  22363. /**
  22364. * Creates a clone of `arrayBuffer`.
  22365. *
  22366. * @private
  22367. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22368. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22369. */
  22370. function cloneArrayBuffer(arrayBuffer) {
  22371. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22372. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22373. return result;
  22374. }
  22375. /**
  22376. * Creates a clone of `dataView`.
  22377. *
  22378. * @private
  22379. * @param {Object} dataView The data view to clone.
  22380. * @param {boolean} [isDeep] Specify a deep clone.
  22381. * @returns {Object} Returns the cloned data view.
  22382. */
  22383. function cloneDataView(dataView, isDeep) {
  22384. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22385. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22386. }
  22387. /**
  22388. * Creates a clone of `regexp`.
  22389. *
  22390. * @private
  22391. * @param {Object} regexp The regexp to clone.
  22392. * @returns {Object} Returns the cloned regexp.
  22393. */
  22394. function cloneRegExp(regexp) {
  22395. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22396. result.lastIndex = regexp.lastIndex;
  22397. return result;
  22398. }
  22399. /**
  22400. * Creates a clone of the `symbol` object.
  22401. *
  22402. * @private
  22403. * @param {Object} symbol The symbol object to clone.
  22404. * @returns {Object} Returns the cloned symbol object.
  22405. */
  22406. function cloneSymbol(symbol) {
  22407. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22408. }
  22409. /**
  22410. * Creates a clone of `typedArray`.
  22411. *
  22412. * @private
  22413. * @param {Object} typedArray The typed array to clone.
  22414. * @param {boolean} [isDeep] Specify a deep clone.
  22415. * @returns {Object} Returns the cloned typed array.
  22416. */
  22417. function cloneTypedArray(typedArray, isDeep) {
  22418. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22419. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22420. }
  22421. /**
  22422. * Compares values to sort them in ascending order.
  22423. *
  22424. * @private
  22425. * @param {*} value The value to compare.
  22426. * @param {*} other The other value to compare.
  22427. * @returns {number} Returns the sort order indicator for `value`.
  22428. */
  22429. function compareAscending(value, other) {
  22430. if (value !== other) {
  22431. var valIsDefined = value !== undefined,
  22432. valIsNull = value === null,
  22433. valIsReflexive = value === value,
  22434. valIsSymbol = isSymbol(value);
  22435. var othIsDefined = other !== undefined,
  22436. othIsNull = other === null,
  22437. othIsReflexive = other === other,
  22438. othIsSymbol = isSymbol(other);
  22439. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22440. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22441. (valIsNull && othIsDefined && othIsReflexive) ||
  22442. (!valIsDefined && othIsReflexive) ||
  22443. !valIsReflexive) {
  22444. return 1;
  22445. }
  22446. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22447. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22448. (othIsNull && valIsDefined && valIsReflexive) ||
  22449. (!othIsDefined && valIsReflexive) ||
  22450. !othIsReflexive) {
  22451. return -1;
  22452. }
  22453. }
  22454. return 0;
  22455. }
  22456. /**
  22457. * Used by `_.orderBy` to compare multiple properties of a value to another
  22458. * and stable sort them.
  22459. *
  22460. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22461. * specify an order of "desc" for descending or "asc" for ascending sort order
  22462. * of corresponding values.
  22463. *
  22464. * @private
  22465. * @param {Object} object The object to compare.
  22466. * @param {Object} other The other object to compare.
  22467. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22468. * @returns {number} Returns the sort order indicator for `object`.
  22469. */
  22470. function compareMultiple(object, other, orders) {
  22471. var index = -1,
  22472. objCriteria = object.criteria,
  22473. othCriteria = other.criteria,
  22474. length = objCriteria.length,
  22475. ordersLength = orders.length;
  22476. while (++index < length) {
  22477. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22478. if (result) {
  22479. if (index >= ordersLength) {
  22480. return result;
  22481. }
  22482. var order = orders[index];
  22483. return result * (order == 'desc' ? -1 : 1);
  22484. }
  22485. }
  22486. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22487. // that causes it, under certain circumstances, to provide the same value for
  22488. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22489. // for more details.
  22490. //
  22491. // This also ensures a stable sort in V8 and other engines.
  22492. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22493. return object.index - other.index;
  22494. }
  22495. /**
  22496. * Creates an array that is the composition of partially applied arguments,
  22497. * placeholders, and provided arguments into a single array of arguments.
  22498. *
  22499. * @private
  22500. * @param {Array} args The provided arguments.
  22501. * @param {Array} partials The arguments to prepend to those provided.
  22502. * @param {Array} holders The `partials` placeholder indexes.
  22503. * @params {boolean} [isCurried] Specify composing for a curried function.
  22504. * @returns {Array} Returns the new array of composed arguments.
  22505. */
  22506. function composeArgs(args, partials, holders, isCurried) {
  22507. var argsIndex = -1,
  22508. argsLength = args.length,
  22509. holdersLength = holders.length,
  22510. leftIndex = -1,
  22511. leftLength = partials.length,
  22512. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22513. result = Array(leftLength + rangeLength),
  22514. isUncurried = !isCurried;
  22515. while (++leftIndex < leftLength) {
  22516. result[leftIndex] = partials[leftIndex];
  22517. }
  22518. while (++argsIndex < holdersLength) {
  22519. if (isUncurried || argsIndex < argsLength) {
  22520. result[holders[argsIndex]] = args[argsIndex];
  22521. }
  22522. }
  22523. while (rangeLength--) {
  22524. result[leftIndex++] = args[argsIndex++];
  22525. }
  22526. return result;
  22527. }
  22528. /**
  22529. * This function is like `composeArgs` except that the arguments composition
  22530. * is tailored for `_.partialRight`.
  22531. *
  22532. * @private
  22533. * @param {Array} args The provided arguments.
  22534. * @param {Array} partials The arguments to append to those provided.
  22535. * @param {Array} holders The `partials` placeholder indexes.
  22536. * @params {boolean} [isCurried] Specify composing for a curried function.
  22537. * @returns {Array} Returns the new array of composed arguments.
  22538. */
  22539. function composeArgsRight(args, partials, holders, isCurried) {
  22540. var argsIndex = -1,
  22541. argsLength = args.length,
  22542. holdersIndex = -1,
  22543. holdersLength = holders.length,
  22544. rightIndex = -1,
  22545. rightLength = partials.length,
  22546. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22547. result = Array(rangeLength + rightLength),
  22548. isUncurried = !isCurried;
  22549. while (++argsIndex < rangeLength) {
  22550. result[argsIndex] = args[argsIndex];
  22551. }
  22552. var offset = argsIndex;
  22553. while (++rightIndex < rightLength) {
  22554. result[offset + rightIndex] = partials[rightIndex];
  22555. }
  22556. while (++holdersIndex < holdersLength) {
  22557. if (isUncurried || argsIndex < argsLength) {
  22558. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22559. }
  22560. }
  22561. return result;
  22562. }
  22563. /**
  22564. * Copies the values of `source` to `array`.
  22565. *
  22566. * @private
  22567. * @param {Array} source The array to copy values from.
  22568. * @param {Array} [array=[]] The array to copy values to.
  22569. * @returns {Array} Returns `array`.
  22570. */
  22571. function copyArray(source, array) {
  22572. var index = -1,
  22573. length = source.length;
  22574. array || (array = Array(length));
  22575. while (++index < length) {
  22576. array[index] = source[index];
  22577. }
  22578. return array;
  22579. }
  22580. /**
  22581. * Copies properties of `source` to `object`.
  22582. *
  22583. * @private
  22584. * @param {Object} source The object to copy properties from.
  22585. * @param {Array} props The property identifiers to copy.
  22586. * @param {Object} [object={}] The object to copy properties to.
  22587. * @param {Function} [customizer] The function to customize copied values.
  22588. * @returns {Object} Returns `object`.
  22589. */
  22590. function copyObject(source, props, object, customizer) {
  22591. var isNew = !object;
  22592. object || (object = {});
  22593. var index = -1,
  22594. length = props.length;
  22595. while (++index < length) {
  22596. var key = props[index];
  22597. var newValue = customizer
  22598. ? customizer(object[key], source[key], key, object, source)
  22599. : undefined;
  22600. if (newValue === undefined) {
  22601. newValue = source[key];
  22602. }
  22603. if (isNew) {
  22604. baseAssignValue(object, key, newValue);
  22605. } else {
  22606. assignValue(object, key, newValue);
  22607. }
  22608. }
  22609. return object;
  22610. }
  22611. /**
  22612. * Copies own symbols of `source` to `object`.
  22613. *
  22614. * @private
  22615. * @param {Object} source The object to copy symbols from.
  22616. * @param {Object} [object={}] The object to copy symbols to.
  22617. * @returns {Object} Returns `object`.
  22618. */
  22619. function copySymbols(source, object) {
  22620. return copyObject(source, getSymbols(source), object);
  22621. }
  22622. /**
  22623. * Copies own and inherited symbols of `source` to `object`.
  22624. *
  22625. * @private
  22626. * @param {Object} source The object to copy symbols from.
  22627. * @param {Object} [object={}] The object to copy symbols to.
  22628. * @returns {Object} Returns `object`.
  22629. */
  22630. function copySymbolsIn(source, object) {
  22631. return copyObject(source, getSymbolsIn(source), object);
  22632. }
  22633. /**
  22634. * Creates a function like `_.groupBy`.
  22635. *
  22636. * @private
  22637. * @param {Function} setter The function to set accumulator values.
  22638. * @param {Function} [initializer] The accumulator object initializer.
  22639. * @returns {Function} Returns the new aggregator function.
  22640. */
  22641. function createAggregator(setter, initializer) {
  22642. return function(collection, iteratee) {
  22643. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22644. accumulator = initializer ? initializer() : {};
  22645. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22646. };
  22647. }
  22648. /**
  22649. * Creates a function like `_.assign`.
  22650. *
  22651. * @private
  22652. * @param {Function} assigner The function to assign values.
  22653. * @returns {Function} Returns the new assigner function.
  22654. */
  22655. function createAssigner(assigner) {
  22656. return baseRest(function(object, sources) {
  22657. var index = -1,
  22658. length = sources.length,
  22659. customizer = length > 1 ? sources[length - 1] : undefined,
  22660. guard = length > 2 ? sources[2] : undefined;
  22661. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22662. ? (length--, customizer)
  22663. : undefined;
  22664. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22665. customizer = length < 3 ? undefined : customizer;
  22666. length = 1;
  22667. }
  22668. object = Object(object);
  22669. while (++index < length) {
  22670. var source = sources[index];
  22671. if (source) {
  22672. assigner(object, source, index, customizer);
  22673. }
  22674. }
  22675. return object;
  22676. });
  22677. }
  22678. /**
  22679. * Creates a `baseEach` or `baseEachRight` function.
  22680. *
  22681. * @private
  22682. * @param {Function} eachFunc The function to iterate over a collection.
  22683. * @param {boolean} [fromRight] Specify iterating from right to left.
  22684. * @returns {Function} Returns the new base function.
  22685. */
  22686. function createBaseEach(eachFunc, fromRight) {
  22687. return function(collection, iteratee) {
  22688. if (collection == null) {
  22689. return collection;
  22690. }
  22691. if (!isArrayLike(collection)) {
  22692. return eachFunc(collection, iteratee);
  22693. }
  22694. var length = collection.length,
  22695. index = fromRight ? length : -1,
  22696. iterable = Object(collection);
  22697. while ((fromRight ? index-- : ++index < length)) {
  22698. if (iteratee(iterable[index], index, iterable) === false) {
  22699. break;
  22700. }
  22701. }
  22702. return collection;
  22703. };
  22704. }
  22705. /**
  22706. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22707. *
  22708. * @private
  22709. * @param {boolean} [fromRight] Specify iterating from right to left.
  22710. * @returns {Function} Returns the new base function.
  22711. */
  22712. function createBaseFor(fromRight) {
  22713. return function(object, iteratee, keysFunc) {
  22714. var index = -1,
  22715. iterable = Object(object),
  22716. props = keysFunc(object),
  22717. length = props.length;
  22718. while (length--) {
  22719. var key = props[fromRight ? length : ++index];
  22720. if (iteratee(iterable[key], key, iterable) === false) {
  22721. break;
  22722. }
  22723. }
  22724. return object;
  22725. };
  22726. }
  22727. /**
  22728. * Creates a function that wraps `func` to invoke it with the optional `this`
  22729. * binding of `thisArg`.
  22730. *
  22731. * @private
  22732. * @param {Function} func The function to wrap.
  22733. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22734. * @param {*} [thisArg] The `this` binding of `func`.
  22735. * @returns {Function} Returns the new wrapped function.
  22736. */
  22737. function createBind(func, bitmask, thisArg) {
  22738. var isBind = bitmask & WRAP_BIND_FLAG,
  22739. Ctor = createCtor(func);
  22740. function wrapper() {
  22741. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22742. return fn.apply(isBind ? thisArg : this, arguments);
  22743. }
  22744. return wrapper;
  22745. }
  22746. /**
  22747. * Creates a function like `_.lowerFirst`.
  22748. *
  22749. * @private
  22750. * @param {string} methodName The name of the `String` case method to use.
  22751. * @returns {Function} Returns the new case function.
  22752. */
  22753. function createCaseFirst(methodName) {
  22754. return function(string) {
  22755. string = toString(string);
  22756. var strSymbols = hasUnicode(string)
  22757. ? stringToArray(string)
  22758. : undefined;
  22759. var chr = strSymbols
  22760. ? strSymbols[0]
  22761. : string.charAt(0);
  22762. var trailing = strSymbols
  22763. ? castSlice(strSymbols, 1).join('')
  22764. : string.slice(1);
  22765. return chr[methodName]() + trailing;
  22766. };
  22767. }
  22768. /**
  22769. * Creates a function like `_.camelCase`.
  22770. *
  22771. * @private
  22772. * @param {Function} callback The function to combine each word.
  22773. * @returns {Function} Returns the new compounder function.
  22774. */
  22775. function createCompounder(callback) {
  22776. return function(string) {
  22777. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22778. };
  22779. }
  22780. /**
  22781. * Creates a function that produces an instance of `Ctor` regardless of
  22782. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22783. *
  22784. * @private
  22785. * @param {Function} Ctor The constructor to wrap.
  22786. * @returns {Function} Returns the new wrapped function.
  22787. */
  22788. function createCtor(Ctor) {
  22789. return function() {
  22790. // Use a `switch` statement to work with class constructors. See
  22791. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22792. // for more details.
  22793. var args = arguments;
  22794. switch (args.length) {
  22795. case 0: return new Ctor;
  22796. case 1: return new Ctor(args[0]);
  22797. case 2: return new Ctor(args[0], args[1]);
  22798. case 3: return new Ctor(args[0], args[1], args[2]);
  22799. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22800. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22801. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22802. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22803. }
  22804. var thisBinding = baseCreate(Ctor.prototype),
  22805. result = Ctor.apply(thisBinding, args);
  22806. // Mimic the constructor's `return` behavior.
  22807. // See https://es5.github.io/#x13.2.2 for more details.
  22808. return isObject(result) ? result : thisBinding;
  22809. };
  22810. }
  22811. /**
  22812. * Creates a function that wraps `func` to enable currying.
  22813. *
  22814. * @private
  22815. * @param {Function} func The function to wrap.
  22816. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22817. * @param {number} arity The arity of `func`.
  22818. * @returns {Function} Returns the new wrapped function.
  22819. */
  22820. function createCurry(func, bitmask, arity) {
  22821. var Ctor = createCtor(func);
  22822. function wrapper() {
  22823. var length = arguments.length,
  22824. args = Array(length),
  22825. index = length,
  22826. placeholder = getHolder(wrapper);
  22827. while (index--) {
  22828. args[index] = arguments[index];
  22829. }
  22830. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22831. ? []
  22832. : replaceHolders(args, placeholder);
  22833. length -= holders.length;
  22834. if (length < arity) {
  22835. return createRecurry(
  22836. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22837. args, holders, undefined, undefined, arity - length);
  22838. }
  22839. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22840. return apply(fn, this, args);
  22841. }
  22842. return wrapper;
  22843. }
  22844. /**
  22845. * Creates a `_.find` or `_.findLast` function.
  22846. *
  22847. * @private
  22848. * @param {Function} findIndexFunc The function to find the collection index.
  22849. * @returns {Function} Returns the new find function.
  22850. */
  22851. function createFind(findIndexFunc) {
  22852. return function(collection, predicate, fromIndex) {
  22853. var iterable = Object(collection);
  22854. if (!isArrayLike(collection)) {
  22855. var iteratee = getIteratee(predicate, 3);
  22856. collection = keys(collection);
  22857. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22858. }
  22859. var index = findIndexFunc(collection, predicate, fromIndex);
  22860. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22861. };
  22862. }
  22863. /**
  22864. * Creates a `_.flow` or `_.flowRight` function.
  22865. *
  22866. * @private
  22867. * @param {boolean} [fromRight] Specify iterating from right to left.
  22868. * @returns {Function} Returns the new flow function.
  22869. */
  22870. function createFlow(fromRight) {
  22871. return flatRest(function(funcs) {
  22872. var length = funcs.length,
  22873. index = length,
  22874. prereq = LodashWrapper.prototype.thru;
  22875. if (fromRight) {
  22876. funcs.reverse();
  22877. }
  22878. while (index--) {
  22879. var func = funcs[index];
  22880. if (typeof func != 'function') {
  22881. throw new TypeError(FUNC_ERROR_TEXT);
  22882. }
  22883. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22884. var wrapper = new LodashWrapper([], true);
  22885. }
  22886. }
  22887. index = wrapper ? index : length;
  22888. while (++index < length) {
  22889. func = funcs[index];
  22890. var funcName = getFuncName(func),
  22891. data = funcName == 'wrapper' ? getData(func) : undefined;
  22892. if (data && isLaziable(data[0]) &&
  22893. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22894. !data[4].length && data[9] == 1
  22895. ) {
  22896. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22897. } else {
  22898. wrapper = (func.length == 1 && isLaziable(func))
  22899. ? wrapper[funcName]()
  22900. : wrapper.thru(func);
  22901. }
  22902. }
  22903. return function() {
  22904. var args = arguments,
  22905. value = args[0];
  22906. if (wrapper && args.length == 1 && isArray(value)) {
  22907. return wrapper.plant(value).value();
  22908. }
  22909. var index = 0,
  22910. result = length ? funcs[index].apply(this, args) : value;
  22911. while (++index < length) {
  22912. result = funcs[index].call(this, result);
  22913. }
  22914. return result;
  22915. };
  22916. });
  22917. }
  22918. /**
  22919. * Creates a function that wraps `func` to invoke it with optional `this`
  22920. * binding of `thisArg`, partial application, and currying.
  22921. *
  22922. * @private
  22923. * @param {Function|string} func The function or method name to wrap.
  22924. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22925. * @param {*} [thisArg] The `this` binding of `func`.
  22926. * @param {Array} [partials] The arguments to prepend to those provided to
  22927. * the new function.
  22928. * @param {Array} [holders] The `partials` placeholder indexes.
  22929. * @param {Array} [partialsRight] The arguments to append to those provided
  22930. * to the new function.
  22931. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22932. * @param {Array} [argPos] The argument positions of the new function.
  22933. * @param {number} [ary] The arity cap of `func`.
  22934. * @param {number} [arity] The arity of `func`.
  22935. * @returns {Function} Returns the new wrapped function.
  22936. */
  22937. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22938. var isAry = bitmask & WRAP_ARY_FLAG,
  22939. isBind = bitmask & WRAP_BIND_FLAG,
  22940. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22941. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22942. isFlip = bitmask & WRAP_FLIP_FLAG,
  22943. Ctor = isBindKey ? undefined : createCtor(func);
  22944. function wrapper() {
  22945. var length = arguments.length,
  22946. args = Array(length),
  22947. index = length;
  22948. while (index--) {
  22949. args[index] = arguments[index];
  22950. }
  22951. if (isCurried) {
  22952. var placeholder = getHolder(wrapper),
  22953. holdersCount = countHolders(args, placeholder);
  22954. }
  22955. if (partials) {
  22956. args = composeArgs(args, partials, holders, isCurried);
  22957. }
  22958. if (partialsRight) {
  22959. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22960. }
  22961. length -= holdersCount;
  22962. if (isCurried && length < arity) {
  22963. var newHolders = replaceHolders(args, placeholder);
  22964. return createRecurry(
  22965. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22966. args, newHolders, argPos, ary, arity - length
  22967. );
  22968. }
  22969. var thisBinding = isBind ? thisArg : this,
  22970. fn = isBindKey ? thisBinding[func] : func;
  22971. length = args.length;
  22972. if (argPos) {
  22973. args = reorder(args, argPos);
  22974. } else if (isFlip && length > 1) {
  22975. args.reverse();
  22976. }
  22977. if (isAry && ary < length) {
  22978. args.length = ary;
  22979. }
  22980. if (this && this !== root && this instanceof wrapper) {
  22981. fn = Ctor || createCtor(fn);
  22982. }
  22983. return fn.apply(thisBinding, args);
  22984. }
  22985. return wrapper;
  22986. }
  22987. /**
  22988. * Creates a function like `_.invertBy`.
  22989. *
  22990. * @private
  22991. * @param {Function} setter The function to set accumulator values.
  22992. * @param {Function} toIteratee The function to resolve iteratees.
  22993. * @returns {Function} Returns the new inverter function.
  22994. */
  22995. function createInverter(setter, toIteratee) {
  22996. return function(object, iteratee) {
  22997. return baseInverter(object, setter, toIteratee(iteratee), {});
  22998. };
  22999. }
  23000. /**
  23001. * Creates a function that performs a mathematical operation on two values.
  23002. *
  23003. * @private
  23004. * @param {Function} operator The function to perform the operation.
  23005. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23006. * @returns {Function} Returns the new mathematical operation function.
  23007. */
  23008. function createMathOperation(operator, defaultValue) {
  23009. return function(value, other) {
  23010. var result;
  23011. if (value === undefined && other === undefined) {
  23012. return defaultValue;
  23013. }
  23014. if (value !== undefined) {
  23015. result = value;
  23016. }
  23017. if (other !== undefined) {
  23018. if (result === undefined) {
  23019. return other;
  23020. }
  23021. if (typeof value == 'string' || typeof other == 'string') {
  23022. value = baseToString(value);
  23023. other = baseToString(other);
  23024. } else {
  23025. value = baseToNumber(value);
  23026. other = baseToNumber(other);
  23027. }
  23028. result = operator(value, other);
  23029. }
  23030. return result;
  23031. };
  23032. }
  23033. /**
  23034. * Creates a function like `_.over`.
  23035. *
  23036. * @private
  23037. * @param {Function} arrayFunc The function to iterate over iteratees.
  23038. * @returns {Function} Returns the new over function.
  23039. */
  23040. function createOver(arrayFunc) {
  23041. return flatRest(function(iteratees) {
  23042. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23043. return baseRest(function(args) {
  23044. var thisArg = this;
  23045. return arrayFunc(iteratees, function(iteratee) {
  23046. return apply(iteratee, thisArg, args);
  23047. });
  23048. });
  23049. });
  23050. }
  23051. /**
  23052. * Creates the padding for `string` based on `length`. The `chars` string
  23053. * is truncated if the number of characters exceeds `length`.
  23054. *
  23055. * @private
  23056. * @param {number} length The padding length.
  23057. * @param {string} [chars=' '] The string used as padding.
  23058. * @returns {string} Returns the padding for `string`.
  23059. */
  23060. function createPadding(length, chars) {
  23061. chars = chars === undefined ? ' ' : baseToString(chars);
  23062. var charsLength = chars.length;
  23063. if (charsLength < 2) {
  23064. return charsLength ? baseRepeat(chars, length) : chars;
  23065. }
  23066. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23067. return hasUnicode(chars)
  23068. ? castSlice(stringToArray(result), 0, length).join('')
  23069. : result.slice(0, length);
  23070. }
  23071. /**
  23072. * Creates a function that wraps `func` to invoke it with the `this` binding
  23073. * of `thisArg` and `partials` prepended to the arguments it receives.
  23074. *
  23075. * @private
  23076. * @param {Function} func The function to wrap.
  23077. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23078. * @param {*} thisArg The `this` binding of `func`.
  23079. * @param {Array} partials The arguments to prepend to those provided to
  23080. * the new function.
  23081. * @returns {Function} Returns the new wrapped function.
  23082. */
  23083. function createPartial(func, bitmask, thisArg, partials) {
  23084. var isBind = bitmask & WRAP_BIND_FLAG,
  23085. Ctor = createCtor(func);
  23086. function wrapper() {
  23087. var argsIndex = -1,
  23088. argsLength = arguments.length,
  23089. leftIndex = -1,
  23090. leftLength = partials.length,
  23091. args = Array(leftLength + argsLength),
  23092. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23093. while (++leftIndex < leftLength) {
  23094. args[leftIndex] = partials[leftIndex];
  23095. }
  23096. while (argsLength--) {
  23097. args[leftIndex++] = arguments[++argsIndex];
  23098. }
  23099. return apply(fn, isBind ? thisArg : this, args);
  23100. }
  23101. return wrapper;
  23102. }
  23103. /**
  23104. * Creates a `_.range` or `_.rangeRight` function.
  23105. *
  23106. * @private
  23107. * @param {boolean} [fromRight] Specify iterating from right to left.
  23108. * @returns {Function} Returns the new range function.
  23109. */
  23110. function createRange(fromRight) {
  23111. return function(start, end, step) {
  23112. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23113. end = step = undefined;
  23114. }
  23115. // Ensure the sign of `-0` is preserved.
  23116. start = toFinite(start);
  23117. if (end === undefined) {
  23118. end = start;
  23119. start = 0;
  23120. } else {
  23121. end = toFinite(end);
  23122. }
  23123. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23124. return baseRange(start, end, step, fromRight);
  23125. };
  23126. }
  23127. /**
  23128. * Creates a function that performs a relational operation on two values.
  23129. *
  23130. * @private
  23131. * @param {Function} operator The function to perform the operation.
  23132. * @returns {Function} Returns the new relational operation function.
  23133. */
  23134. function createRelationalOperation(operator) {
  23135. return function(value, other) {
  23136. if (!(typeof value == 'string' && typeof other == 'string')) {
  23137. value = toNumber(value);
  23138. other = toNumber(other);
  23139. }
  23140. return operator(value, other);
  23141. };
  23142. }
  23143. /**
  23144. * Creates a function that wraps `func` to continue currying.
  23145. *
  23146. * @private
  23147. * @param {Function} func The function to wrap.
  23148. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23149. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23150. * @param {*} placeholder The placeholder value.
  23151. * @param {*} [thisArg] The `this` binding of `func`.
  23152. * @param {Array} [partials] The arguments to prepend to those provided to
  23153. * the new function.
  23154. * @param {Array} [holders] The `partials` placeholder indexes.
  23155. * @param {Array} [argPos] The argument positions of the new function.
  23156. * @param {number} [ary] The arity cap of `func`.
  23157. * @param {number} [arity] The arity of `func`.
  23158. * @returns {Function} Returns the new wrapped function.
  23159. */
  23160. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23161. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23162. newHolders = isCurry ? holders : undefined,
  23163. newHoldersRight = isCurry ? undefined : holders,
  23164. newPartials = isCurry ? partials : undefined,
  23165. newPartialsRight = isCurry ? undefined : partials;
  23166. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23167. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23168. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23169. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23170. }
  23171. var newData = [
  23172. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23173. newHoldersRight, argPos, ary, arity
  23174. ];
  23175. var result = wrapFunc.apply(undefined, newData);
  23176. if (isLaziable(func)) {
  23177. setData(result, newData);
  23178. }
  23179. result.placeholder = placeholder;
  23180. return setWrapToString(result, func, bitmask);
  23181. }
  23182. /**
  23183. * Creates a function like `_.round`.
  23184. *
  23185. * @private
  23186. * @param {string} methodName The name of the `Math` method to use when rounding.
  23187. * @returns {Function} Returns the new round function.
  23188. */
  23189. function createRound(methodName) {
  23190. var func = Math[methodName];
  23191. return function(number, precision) {
  23192. number = toNumber(number);
  23193. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23194. if (precision && nativeIsFinite(number)) {
  23195. // Shift with exponential notation to avoid floating-point issues.
  23196. // See [MDN](https://mdn.io/round#Examples) for more details.
  23197. var pair = (toString(number) + 'e').split('e'),
  23198. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23199. pair = (toString(value) + 'e').split('e');
  23200. return +(pair[0] + 'e' + (+pair[1] - precision));
  23201. }
  23202. return func(number);
  23203. };
  23204. }
  23205. /**
  23206. * Creates a set object of `values`.
  23207. *
  23208. * @private
  23209. * @param {Array} values The values to add to the set.
  23210. * @returns {Object} Returns the new set.
  23211. */
  23212. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23213. return new Set(values);
  23214. };
  23215. /**
  23216. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23217. *
  23218. * @private
  23219. * @param {Function} keysFunc The function to get the keys of a given object.
  23220. * @returns {Function} Returns the new pairs function.
  23221. */
  23222. function createToPairs(keysFunc) {
  23223. return function(object) {
  23224. var tag = getTag(object);
  23225. if (tag == mapTag) {
  23226. return mapToArray(object);
  23227. }
  23228. if (tag == setTag) {
  23229. return setToPairs(object);
  23230. }
  23231. return baseToPairs(object, keysFunc(object));
  23232. };
  23233. }
  23234. /**
  23235. * Creates a function that either curries or invokes `func` with optional
  23236. * `this` binding and partially applied arguments.
  23237. *
  23238. * @private
  23239. * @param {Function|string} func The function or method name to wrap.
  23240. * @param {number} bitmask The bitmask flags.
  23241. * 1 - `_.bind`
  23242. * 2 - `_.bindKey`
  23243. * 4 - `_.curry` or `_.curryRight` of a bound function
  23244. * 8 - `_.curry`
  23245. * 16 - `_.curryRight`
  23246. * 32 - `_.partial`
  23247. * 64 - `_.partialRight`
  23248. * 128 - `_.rearg`
  23249. * 256 - `_.ary`
  23250. * 512 - `_.flip`
  23251. * @param {*} [thisArg] The `this` binding of `func`.
  23252. * @param {Array} [partials] The arguments to be partially applied.
  23253. * @param {Array} [holders] The `partials` placeholder indexes.
  23254. * @param {Array} [argPos] The argument positions of the new function.
  23255. * @param {number} [ary] The arity cap of `func`.
  23256. * @param {number} [arity] The arity of `func`.
  23257. * @returns {Function} Returns the new wrapped function.
  23258. */
  23259. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23260. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23261. if (!isBindKey && typeof func != 'function') {
  23262. throw new TypeError(FUNC_ERROR_TEXT);
  23263. }
  23264. var length = partials ? partials.length : 0;
  23265. if (!length) {
  23266. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23267. partials = holders = undefined;
  23268. }
  23269. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23270. arity = arity === undefined ? arity : toInteger(arity);
  23271. length -= holders ? holders.length : 0;
  23272. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23273. var partialsRight = partials,
  23274. holdersRight = holders;
  23275. partials = holders = undefined;
  23276. }
  23277. var data = isBindKey ? undefined : getData(func);
  23278. var newData = [
  23279. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23280. argPos, ary, arity
  23281. ];
  23282. if (data) {
  23283. mergeData(newData, data);
  23284. }
  23285. func = newData[0];
  23286. bitmask = newData[1];
  23287. thisArg = newData[2];
  23288. partials = newData[3];
  23289. holders = newData[4];
  23290. arity = newData[9] = newData[9] === undefined
  23291. ? (isBindKey ? 0 : func.length)
  23292. : nativeMax(newData[9] - length, 0);
  23293. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23294. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23295. }
  23296. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23297. var result = createBind(func, bitmask, thisArg);
  23298. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23299. result = createCurry(func, bitmask, arity);
  23300. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23301. result = createPartial(func, bitmask, thisArg, partials);
  23302. } else {
  23303. result = createHybrid.apply(undefined, newData);
  23304. }
  23305. var setter = data ? baseSetData : setData;
  23306. return setWrapToString(setter(result, newData), func, bitmask);
  23307. }
  23308. /**
  23309. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23310. * of source objects to the destination object for all destination properties
  23311. * that resolve to `undefined`.
  23312. *
  23313. * @private
  23314. * @param {*} objValue The destination value.
  23315. * @param {*} srcValue The source value.
  23316. * @param {string} key The key of the property to assign.
  23317. * @param {Object} object The parent object of `objValue`.
  23318. * @returns {*} Returns the value to assign.
  23319. */
  23320. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23321. if (objValue === undefined ||
  23322. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23323. return srcValue;
  23324. }
  23325. return objValue;
  23326. }
  23327. /**
  23328. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23329. * objects into destination objects that are passed thru.
  23330. *
  23331. * @private
  23332. * @param {*} objValue The destination value.
  23333. * @param {*} srcValue The source value.
  23334. * @param {string} key The key of the property to merge.
  23335. * @param {Object} object The parent object of `objValue`.
  23336. * @param {Object} source The parent object of `srcValue`.
  23337. * @param {Object} [stack] Tracks traversed source values and their merged
  23338. * counterparts.
  23339. * @returns {*} Returns the value to assign.
  23340. */
  23341. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23342. if (isObject(objValue) && isObject(srcValue)) {
  23343. // Recursively merge objects and arrays (susceptible to call stack limits).
  23344. stack.set(srcValue, objValue);
  23345. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23346. stack['delete'](srcValue);
  23347. }
  23348. return objValue;
  23349. }
  23350. /**
  23351. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23352. * objects.
  23353. *
  23354. * @private
  23355. * @param {*} value The value to inspect.
  23356. * @param {string} key The key of the property to inspect.
  23357. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23358. */
  23359. function customOmitClone(value) {
  23360. return isPlainObject(value) ? undefined : value;
  23361. }
  23362. /**
  23363. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23364. * partial deep comparisons.
  23365. *
  23366. * @private
  23367. * @param {Array} array The array to compare.
  23368. * @param {Array} other The other array to compare.
  23369. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23370. * @param {Function} customizer The function to customize comparisons.
  23371. * @param {Function} equalFunc The function to determine equivalents of values.
  23372. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23373. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23374. */
  23375. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23376. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23377. arrLength = array.length,
  23378. othLength = other.length;
  23379. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23380. return false;
  23381. }
  23382. // Assume cyclic values are equal.
  23383. var stacked = stack.get(array);
  23384. if (stacked && stack.get(other)) {
  23385. return stacked == other;
  23386. }
  23387. var index = -1,
  23388. result = true,
  23389. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23390. stack.set(array, other);
  23391. stack.set(other, array);
  23392. // Ignore non-index properties.
  23393. while (++index < arrLength) {
  23394. var arrValue = array[index],
  23395. othValue = other[index];
  23396. if (customizer) {
  23397. var compared = isPartial
  23398. ? customizer(othValue, arrValue, index, other, array, stack)
  23399. : customizer(arrValue, othValue, index, array, other, stack);
  23400. }
  23401. if (compared !== undefined) {
  23402. if (compared) {
  23403. continue;
  23404. }
  23405. result = false;
  23406. break;
  23407. }
  23408. // Recursively compare arrays (susceptible to call stack limits).
  23409. if (seen) {
  23410. if (!arraySome(other, function(othValue, othIndex) {
  23411. if (!cacheHas(seen, othIndex) &&
  23412. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23413. return seen.push(othIndex);
  23414. }
  23415. })) {
  23416. result = false;
  23417. break;
  23418. }
  23419. } else if (!(
  23420. arrValue === othValue ||
  23421. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23422. )) {
  23423. result = false;
  23424. break;
  23425. }
  23426. }
  23427. stack['delete'](array);
  23428. stack['delete'](other);
  23429. return result;
  23430. }
  23431. /**
  23432. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23433. * the same `toStringTag`.
  23434. *
  23435. * **Note:** This function only supports comparing values with tags of
  23436. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23437. *
  23438. * @private
  23439. * @param {Object} object The object to compare.
  23440. * @param {Object} other The other object to compare.
  23441. * @param {string} tag The `toStringTag` of the objects to compare.
  23442. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23443. * @param {Function} customizer The function to customize comparisons.
  23444. * @param {Function} equalFunc The function to determine equivalents of values.
  23445. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23446. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23447. */
  23448. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23449. switch (tag) {
  23450. case dataViewTag:
  23451. if ((object.byteLength != other.byteLength) ||
  23452. (object.byteOffset != other.byteOffset)) {
  23453. return false;
  23454. }
  23455. object = object.buffer;
  23456. other = other.buffer;
  23457. case arrayBufferTag:
  23458. if ((object.byteLength != other.byteLength) ||
  23459. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23460. return false;
  23461. }
  23462. return true;
  23463. case boolTag:
  23464. case dateTag:
  23465. case numberTag:
  23466. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23467. // Invalid dates are coerced to `NaN`.
  23468. return eq(+object, +other);
  23469. case errorTag:
  23470. return object.name == other.name && object.message == other.message;
  23471. case regexpTag:
  23472. case stringTag:
  23473. // Coerce regexes to strings and treat strings, primitives and objects,
  23474. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23475. // for more details.
  23476. return object == (other + '');
  23477. case mapTag:
  23478. var convert = mapToArray;
  23479. case setTag:
  23480. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23481. convert || (convert = setToArray);
  23482. if (object.size != other.size && !isPartial) {
  23483. return false;
  23484. }
  23485. // Assume cyclic values are equal.
  23486. var stacked = stack.get(object);
  23487. if (stacked) {
  23488. return stacked == other;
  23489. }
  23490. bitmask |= COMPARE_UNORDERED_FLAG;
  23491. // Recursively compare objects (susceptible to call stack limits).
  23492. stack.set(object, other);
  23493. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23494. stack['delete'](object);
  23495. return result;
  23496. case symbolTag:
  23497. if (symbolValueOf) {
  23498. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23499. }
  23500. }
  23501. return false;
  23502. }
  23503. /**
  23504. * A specialized version of `baseIsEqualDeep` for objects with support for
  23505. * partial deep comparisons.
  23506. *
  23507. * @private
  23508. * @param {Object} object The object to compare.
  23509. * @param {Object} other The other object to compare.
  23510. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23511. * @param {Function} customizer The function to customize comparisons.
  23512. * @param {Function} equalFunc The function to determine equivalents of values.
  23513. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23514. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23515. */
  23516. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23517. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23518. objProps = getAllKeys(object),
  23519. objLength = objProps.length,
  23520. othProps = getAllKeys(other),
  23521. othLength = othProps.length;
  23522. if (objLength != othLength && !isPartial) {
  23523. return false;
  23524. }
  23525. var index = objLength;
  23526. while (index--) {
  23527. var key = objProps[index];
  23528. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23529. return false;
  23530. }
  23531. }
  23532. // Assume cyclic values are equal.
  23533. var stacked = stack.get(object);
  23534. if (stacked && stack.get(other)) {
  23535. return stacked == other;
  23536. }
  23537. var result = true;
  23538. stack.set(object, other);
  23539. stack.set(other, object);
  23540. var skipCtor = isPartial;
  23541. while (++index < objLength) {
  23542. key = objProps[index];
  23543. var objValue = object[key],
  23544. othValue = other[key];
  23545. if (customizer) {
  23546. var compared = isPartial
  23547. ? customizer(othValue, objValue, key, other, object, stack)
  23548. : customizer(objValue, othValue, key, object, other, stack);
  23549. }
  23550. // Recursively compare objects (susceptible to call stack limits).
  23551. if (!(compared === undefined
  23552. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23553. : compared
  23554. )) {
  23555. result = false;
  23556. break;
  23557. }
  23558. skipCtor || (skipCtor = key == 'constructor');
  23559. }
  23560. if (result && !skipCtor) {
  23561. var objCtor = object.constructor,
  23562. othCtor = other.constructor;
  23563. // Non `Object` object instances with different constructors are not equal.
  23564. if (objCtor != othCtor &&
  23565. ('constructor' in object && 'constructor' in other) &&
  23566. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23567. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23568. result = false;
  23569. }
  23570. }
  23571. stack['delete'](object);
  23572. stack['delete'](other);
  23573. return result;
  23574. }
  23575. /**
  23576. * A specialized version of `baseRest` which flattens the rest array.
  23577. *
  23578. * @private
  23579. * @param {Function} func The function to apply a rest parameter to.
  23580. * @returns {Function} Returns the new function.
  23581. */
  23582. function flatRest(func) {
  23583. return setToString(overRest(func, undefined, flatten), func + '');
  23584. }
  23585. /**
  23586. * Creates an array of own enumerable property names and symbols of `object`.
  23587. *
  23588. * @private
  23589. * @param {Object} object The object to query.
  23590. * @returns {Array} Returns the array of property names and symbols.
  23591. */
  23592. function getAllKeys(object) {
  23593. return baseGetAllKeys(object, keys, getSymbols);
  23594. }
  23595. /**
  23596. * Creates an array of own and inherited enumerable property names and
  23597. * symbols of `object`.
  23598. *
  23599. * @private
  23600. * @param {Object} object The object to query.
  23601. * @returns {Array} Returns the array of property names and symbols.
  23602. */
  23603. function getAllKeysIn(object) {
  23604. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23605. }
  23606. /**
  23607. * Gets metadata for `func`.
  23608. *
  23609. * @private
  23610. * @param {Function} func The function to query.
  23611. * @returns {*} Returns the metadata for `func`.
  23612. */
  23613. var getData = !metaMap ? noop : function(func) {
  23614. return metaMap.get(func);
  23615. };
  23616. /**
  23617. * Gets the name of `func`.
  23618. *
  23619. * @private
  23620. * @param {Function} func The function to query.
  23621. * @returns {string} Returns the function name.
  23622. */
  23623. function getFuncName(func) {
  23624. var result = (func.name + ''),
  23625. array = realNames[result],
  23626. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23627. while (length--) {
  23628. var data = array[length],
  23629. otherFunc = data.func;
  23630. if (otherFunc == null || otherFunc == func) {
  23631. return data.name;
  23632. }
  23633. }
  23634. return result;
  23635. }
  23636. /**
  23637. * Gets the argument placeholder value for `func`.
  23638. *
  23639. * @private
  23640. * @param {Function} func The function to inspect.
  23641. * @returns {*} Returns the placeholder value.
  23642. */
  23643. function getHolder(func) {
  23644. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23645. return object.placeholder;
  23646. }
  23647. /**
  23648. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23649. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23650. * If arguments are provided, the chosen function is invoked with them and
  23651. * its result is returned.
  23652. *
  23653. * @private
  23654. * @param {*} [value] The value to convert to an iteratee.
  23655. * @param {number} [arity] The arity of the created iteratee.
  23656. * @returns {Function} Returns the chosen function or its result.
  23657. */
  23658. function getIteratee() {
  23659. var result = lodash.iteratee || iteratee;
  23660. result = result === iteratee ? baseIteratee : result;
  23661. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23662. }
  23663. /**
  23664. * Gets the data for `map`.
  23665. *
  23666. * @private
  23667. * @param {Object} map The map to query.
  23668. * @param {string} key The reference key.
  23669. * @returns {*} Returns the map data.
  23670. */
  23671. function getMapData(map, key) {
  23672. var data = map.__data__;
  23673. return isKeyable(key)
  23674. ? data[typeof key == 'string' ? 'string' : 'hash']
  23675. : data.map;
  23676. }
  23677. /**
  23678. * Gets the property names, values, and compare flags of `object`.
  23679. *
  23680. * @private
  23681. * @param {Object} object The object to query.
  23682. * @returns {Array} Returns the match data of `object`.
  23683. */
  23684. function getMatchData(object) {
  23685. var result = keys(object),
  23686. length = result.length;
  23687. while (length--) {
  23688. var key = result[length],
  23689. value = object[key];
  23690. result[length] = [key, value, isStrictComparable(value)];
  23691. }
  23692. return result;
  23693. }
  23694. /**
  23695. * Gets the native function at `key` of `object`.
  23696. *
  23697. * @private
  23698. * @param {Object} object The object to query.
  23699. * @param {string} key The key of the method to get.
  23700. * @returns {*} Returns the function if it's native, else `undefined`.
  23701. */
  23702. function getNative(object, key) {
  23703. var value = getValue(object, key);
  23704. return baseIsNative(value) ? value : undefined;
  23705. }
  23706. /**
  23707. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23708. *
  23709. * @private
  23710. * @param {*} value The value to query.
  23711. * @returns {string} Returns the raw `toStringTag`.
  23712. */
  23713. function getRawTag(value) {
  23714. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23715. tag = value[symToStringTag];
  23716. try {
  23717. value[symToStringTag] = undefined;
  23718. var unmasked = true;
  23719. } catch (e) {}
  23720. var result = nativeObjectToString.call(value);
  23721. if (unmasked) {
  23722. if (isOwn) {
  23723. value[symToStringTag] = tag;
  23724. } else {
  23725. delete value[symToStringTag];
  23726. }
  23727. }
  23728. return result;
  23729. }
  23730. /**
  23731. * Creates an array of the own enumerable symbols of `object`.
  23732. *
  23733. * @private
  23734. * @param {Object} object The object to query.
  23735. * @returns {Array} Returns the array of symbols.
  23736. */
  23737. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23738. if (object == null) {
  23739. return [];
  23740. }
  23741. object = Object(object);
  23742. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23743. return propertyIsEnumerable.call(object, symbol);
  23744. });
  23745. };
  23746. /**
  23747. * Creates an array of the own and inherited enumerable symbols of `object`.
  23748. *
  23749. * @private
  23750. * @param {Object} object The object to query.
  23751. * @returns {Array} Returns the array of symbols.
  23752. */
  23753. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23754. var result = [];
  23755. while (object) {
  23756. arrayPush(result, getSymbols(object));
  23757. object = getPrototype(object);
  23758. }
  23759. return result;
  23760. };
  23761. /**
  23762. * Gets the `toStringTag` of `value`.
  23763. *
  23764. * @private
  23765. * @param {*} value The value to query.
  23766. * @returns {string} Returns the `toStringTag`.
  23767. */
  23768. var getTag = baseGetTag;
  23769. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23770. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23771. (Map && getTag(new Map) != mapTag) ||
  23772. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23773. (Set && getTag(new Set) != setTag) ||
  23774. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23775. getTag = function(value) {
  23776. var result = baseGetTag(value),
  23777. Ctor = result == objectTag ? value.constructor : undefined,
  23778. ctorString = Ctor ? toSource(Ctor) : '';
  23779. if (ctorString) {
  23780. switch (ctorString) {
  23781. case dataViewCtorString: return dataViewTag;
  23782. case mapCtorString: return mapTag;
  23783. case promiseCtorString: return promiseTag;
  23784. case setCtorString: return setTag;
  23785. case weakMapCtorString: return weakMapTag;
  23786. }
  23787. }
  23788. return result;
  23789. };
  23790. }
  23791. /**
  23792. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23793. *
  23794. * @private
  23795. * @param {number} start The start of the view.
  23796. * @param {number} end The end of the view.
  23797. * @param {Array} transforms The transformations to apply to the view.
  23798. * @returns {Object} Returns an object containing the `start` and `end`
  23799. * positions of the view.
  23800. */
  23801. function getView(start, end, transforms) {
  23802. var index = -1,
  23803. length = transforms.length;
  23804. while (++index < length) {
  23805. var data = transforms[index],
  23806. size = data.size;
  23807. switch (data.type) {
  23808. case 'drop': start += size; break;
  23809. case 'dropRight': end -= size; break;
  23810. case 'take': end = nativeMin(end, start + size); break;
  23811. case 'takeRight': start = nativeMax(start, end - size); break;
  23812. }
  23813. }
  23814. return { 'start': start, 'end': end };
  23815. }
  23816. /**
  23817. * Extracts wrapper details from the `source` body comment.
  23818. *
  23819. * @private
  23820. * @param {string} source The source to inspect.
  23821. * @returns {Array} Returns the wrapper details.
  23822. */
  23823. function getWrapDetails(source) {
  23824. var match = source.match(reWrapDetails);
  23825. return match ? match[1].split(reSplitDetails) : [];
  23826. }
  23827. /**
  23828. * Checks if `path` exists on `object`.
  23829. *
  23830. * @private
  23831. * @param {Object} object The object to query.
  23832. * @param {Array|string} path The path to check.
  23833. * @param {Function} hasFunc The function to check properties.
  23834. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23835. */
  23836. function hasPath(object, path, hasFunc) {
  23837. path = castPath(path, object);
  23838. var index = -1,
  23839. length = path.length,
  23840. result = false;
  23841. while (++index < length) {
  23842. var key = toKey(path[index]);
  23843. if (!(result = object != null && hasFunc(object, key))) {
  23844. break;
  23845. }
  23846. object = object[key];
  23847. }
  23848. if (result || ++index != length) {
  23849. return result;
  23850. }
  23851. length = object == null ? 0 : object.length;
  23852. return !!length && isLength(length) && isIndex(key, length) &&
  23853. (isArray(object) || isArguments(object));
  23854. }
  23855. /**
  23856. * Initializes an array clone.
  23857. *
  23858. * @private
  23859. * @param {Array} array The array to clone.
  23860. * @returns {Array} Returns the initialized clone.
  23861. */
  23862. function initCloneArray(array) {
  23863. var length = array.length,
  23864. result = new array.constructor(length);
  23865. // Add properties assigned by `RegExp#exec`.
  23866. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23867. result.index = array.index;
  23868. result.input = array.input;
  23869. }
  23870. return result;
  23871. }
  23872. /**
  23873. * Initializes an object clone.
  23874. *
  23875. * @private
  23876. * @param {Object} object The object to clone.
  23877. * @returns {Object} Returns the initialized clone.
  23878. */
  23879. function initCloneObject(object) {
  23880. return (typeof object.constructor == 'function' && !isPrototype(object))
  23881. ? baseCreate(getPrototype(object))
  23882. : {};
  23883. }
  23884. /**
  23885. * Initializes an object clone based on its `toStringTag`.
  23886. *
  23887. * **Note:** This function only supports cloning values with tags of
  23888. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23889. *
  23890. * @private
  23891. * @param {Object} object The object to clone.
  23892. * @param {string} tag The `toStringTag` of the object to clone.
  23893. * @param {boolean} [isDeep] Specify a deep clone.
  23894. * @returns {Object} Returns the initialized clone.
  23895. */
  23896. function initCloneByTag(object, tag, isDeep) {
  23897. var Ctor = object.constructor;
  23898. switch (tag) {
  23899. case arrayBufferTag:
  23900. return cloneArrayBuffer(object);
  23901. case boolTag:
  23902. case dateTag:
  23903. return new Ctor(+object);
  23904. case dataViewTag:
  23905. return cloneDataView(object, isDeep);
  23906. case float32Tag: case float64Tag:
  23907. case int8Tag: case int16Tag: case int32Tag:
  23908. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23909. return cloneTypedArray(object, isDeep);
  23910. case mapTag:
  23911. return new Ctor;
  23912. case numberTag:
  23913. case stringTag:
  23914. return new Ctor(object);
  23915. case regexpTag:
  23916. return cloneRegExp(object);
  23917. case setTag:
  23918. return new Ctor;
  23919. case symbolTag:
  23920. return cloneSymbol(object);
  23921. }
  23922. }
  23923. /**
  23924. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23925. *
  23926. * @private
  23927. * @param {string} source The source to modify.
  23928. * @returns {Array} details The details to insert.
  23929. * @returns {string} Returns the modified source.
  23930. */
  23931. function insertWrapDetails(source, details) {
  23932. var length = details.length;
  23933. if (!length) {
  23934. return source;
  23935. }
  23936. var lastIndex = length - 1;
  23937. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23938. details = details.join(length > 2 ? ', ' : ' ');
  23939. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23940. }
  23941. /**
  23942. * Checks if `value` is a flattenable `arguments` object or array.
  23943. *
  23944. * @private
  23945. * @param {*} value The value to check.
  23946. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23947. */
  23948. function isFlattenable(value) {
  23949. return isArray(value) || isArguments(value) ||
  23950. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23951. }
  23952. /**
  23953. * Checks if `value` is a valid array-like index.
  23954. *
  23955. * @private
  23956. * @param {*} value The value to check.
  23957. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23958. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23959. */
  23960. function isIndex(value, length) {
  23961. var type = typeof value;
  23962. length = length == null ? MAX_SAFE_INTEGER : length;
  23963. return !!length &&
  23964. (type == 'number' ||
  23965. (type != 'symbol' && reIsUint.test(value))) &&
  23966. (value > -1 && value % 1 == 0 && value < length);
  23967. }
  23968. /**
  23969. * Checks if the given arguments are from an iteratee call.
  23970. *
  23971. * @private
  23972. * @param {*} value The potential iteratee value argument.
  23973. * @param {*} index The potential iteratee index or key argument.
  23974. * @param {*} object The potential iteratee object argument.
  23975. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23976. * else `false`.
  23977. */
  23978. function isIterateeCall(value, index, object) {
  23979. if (!isObject(object)) {
  23980. return false;
  23981. }
  23982. var type = typeof index;
  23983. if (type == 'number'
  23984. ? (isArrayLike(object) && isIndex(index, object.length))
  23985. : (type == 'string' && index in object)
  23986. ) {
  23987. return eq(object[index], value);
  23988. }
  23989. return false;
  23990. }
  23991. /**
  23992. * Checks if `value` is a property name and not a property path.
  23993. *
  23994. * @private
  23995. * @param {*} value The value to check.
  23996. * @param {Object} [object] The object to query keys on.
  23997. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23998. */
  23999. function isKey(value, object) {
  24000. if (isArray(value)) {
  24001. return false;
  24002. }
  24003. var type = typeof value;
  24004. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24005. value == null || isSymbol(value)) {
  24006. return true;
  24007. }
  24008. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24009. (object != null && value in Object(object));
  24010. }
  24011. /**
  24012. * Checks if `value` is suitable for use as unique object key.
  24013. *
  24014. * @private
  24015. * @param {*} value The value to check.
  24016. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24017. */
  24018. function isKeyable(value) {
  24019. var type = typeof value;
  24020. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24021. ? (value !== '__proto__')
  24022. : (value === null);
  24023. }
  24024. /**
  24025. * Checks if `func` has a lazy counterpart.
  24026. *
  24027. * @private
  24028. * @param {Function} func The function to check.
  24029. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24030. * else `false`.
  24031. */
  24032. function isLaziable(func) {
  24033. var funcName = getFuncName(func),
  24034. other = lodash[funcName];
  24035. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24036. return false;
  24037. }
  24038. if (func === other) {
  24039. return true;
  24040. }
  24041. var data = getData(other);
  24042. return !!data && func === data[0];
  24043. }
  24044. /**
  24045. * Checks if `func` has its source masked.
  24046. *
  24047. * @private
  24048. * @param {Function} func The function to check.
  24049. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24050. */
  24051. function isMasked(func) {
  24052. return !!maskSrcKey && (maskSrcKey in func);
  24053. }
  24054. /**
  24055. * Checks if `func` is capable of being masked.
  24056. *
  24057. * @private
  24058. * @param {*} value The value to check.
  24059. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24060. */
  24061. var isMaskable = coreJsData ? isFunction : stubFalse;
  24062. /**
  24063. * Checks if `value` is likely a prototype object.
  24064. *
  24065. * @private
  24066. * @param {*} value The value to check.
  24067. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24068. */
  24069. function isPrototype(value) {
  24070. var Ctor = value && value.constructor,
  24071. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24072. return value === proto;
  24073. }
  24074. /**
  24075. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24076. *
  24077. * @private
  24078. * @param {*} value The value to check.
  24079. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24080. * equality comparisons, else `false`.
  24081. */
  24082. function isStrictComparable(value) {
  24083. return value === value && !isObject(value);
  24084. }
  24085. /**
  24086. * A specialized version of `matchesProperty` for source values suitable
  24087. * for strict equality comparisons, i.e. `===`.
  24088. *
  24089. * @private
  24090. * @param {string} key The key of the property to get.
  24091. * @param {*} srcValue The value to match.
  24092. * @returns {Function} Returns the new spec function.
  24093. */
  24094. function matchesStrictComparable(key, srcValue) {
  24095. return function(object) {
  24096. if (object == null) {
  24097. return false;
  24098. }
  24099. return object[key] === srcValue &&
  24100. (srcValue !== undefined || (key in Object(object)));
  24101. };
  24102. }
  24103. /**
  24104. * A specialized version of `_.memoize` which clears the memoized function's
  24105. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24106. *
  24107. * @private
  24108. * @param {Function} func The function to have its output memoized.
  24109. * @returns {Function} Returns the new memoized function.
  24110. */
  24111. function memoizeCapped(func) {
  24112. var result = memoize(func, function(key) {
  24113. if (cache.size === MAX_MEMOIZE_SIZE) {
  24114. cache.clear();
  24115. }
  24116. return key;
  24117. });
  24118. var cache = result.cache;
  24119. return result;
  24120. }
  24121. /**
  24122. * Merges the function metadata of `source` into `data`.
  24123. *
  24124. * Merging metadata reduces the number of wrappers used to invoke a function.
  24125. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24126. * may be applied regardless of execution order. Methods like `_.ary` and
  24127. * `_.rearg` modify function arguments, making the order in which they are
  24128. * executed important, preventing the merging of metadata. However, we make
  24129. * an exception for a safe combined case where curried functions have `_.ary`
  24130. * and or `_.rearg` applied.
  24131. *
  24132. * @private
  24133. * @param {Array} data The destination metadata.
  24134. * @param {Array} source The source metadata.
  24135. * @returns {Array} Returns `data`.
  24136. */
  24137. function mergeData(data, source) {
  24138. var bitmask = data[1],
  24139. srcBitmask = source[1],
  24140. newBitmask = bitmask | srcBitmask,
  24141. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24142. var isCombo =
  24143. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24144. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24145. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24146. // Exit early if metadata can't be merged.
  24147. if (!(isCommon || isCombo)) {
  24148. return data;
  24149. }
  24150. // Use source `thisArg` if available.
  24151. if (srcBitmask & WRAP_BIND_FLAG) {
  24152. data[2] = source[2];
  24153. // Set when currying a bound function.
  24154. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24155. }
  24156. // Compose partial arguments.
  24157. var value = source[3];
  24158. if (value) {
  24159. var partials = data[3];
  24160. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24161. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24162. }
  24163. // Compose partial right arguments.
  24164. value = source[5];
  24165. if (value) {
  24166. partials = data[5];
  24167. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24168. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24169. }
  24170. // Use source `argPos` if available.
  24171. value = source[7];
  24172. if (value) {
  24173. data[7] = value;
  24174. }
  24175. // Use source `ary` if it's smaller.
  24176. if (srcBitmask & WRAP_ARY_FLAG) {
  24177. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24178. }
  24179. // Use source `arity` if one is not provided.
  24180. if (data[9] == null) {
  24181. data[9] = source[9];
  24182. }
  24183. // Use source `func` and merge bitmasks.
  24184. data[0] = source[0];
  24185. data[1] = newBitmask;
  24186. return data;
  24187. }
  24188. /**
  24189. * This function is like
  24190. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24191. * except that it includes inherited enumerable properties.
  24192. *
  24193. * @private
  24194. * @param {Object} object The object to query.
  24195. * @returns {Array} Returns the array of property names.
  24196. */
  24197. function nativeKeysIn(object) {
  24198. var result = [];
  24199. if (object != null) {
  24200. for (var key in Object(object)) {
  24201. result.push(key);
  24202. }
  24203. }
  24204. return result;
  24205. }
  24206. /**
  24207. * Converts `value` to a string using `Object.prototype.toString`.
  24208. *
  24209. * @private
  24210. * @param {*} value The value to convert.
  24211. * @returns {string} Returns the converted string.
  24212. */
  24213. function objectToString(value) {
  24214. return nativeObjectToString.call(value);
  24215. }
  24216. /**
  24217. * A specialized version of `baseRest` which transforms the rest array.
  24218. *
  24219. * @private
  24220. * @param {Function} func The function to apply a rest parameter to.
  24221. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24222. * @param {Function} transform The rest array transform.
  24223. * @returns {Function} Returns the new function.
  24224. */
  24225. function overRest(func, start, transform) {
  24226. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24227. return function() {
  24228. var args = arguments,
  24229. index = -1,
  24230. length = nativeMax(args.length - start, 0),
  24231. array = Array(length);
  24232. while (++index < length) {
  24233. array[index] = args[start + index];
  24234. }
  24235. index = -1;
  24236. var otherArgs = Array(start + 1);
  24237. while (++index < start) {
  24238. otherArgs[index] = args[index];
  24239. }
  24240. otherArgs[start] = transform(array);
  24241. return apply(func, this, otherArgs);
  24242. };
  24243. }
  24244. /**
  24245. * Gets the parent value at `path` of `object`.
  24246. *
  24247. * @private
  24248. * @param {Object} object The object to query.
  24249. * @param {Array} path The path to get the parent value of.
  24250. * @returns {*} Returns the parent value.
  24251. */
  24252. function parent(object, path) {
  24253. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24254. }
  24255. /**
  24256. * Reorder `array` according to the specified indexes where the element at
  24257. * the first index is assigned as the first element, the element at
  24258. * the second index is assigned as the second element, and so on.
  24259. *
  24260. * @private
  24261. * @param {Array} array The array to reorder.
  24262. * @param {Array} indexes The arranged array indexes.
  24263. * @returns {Array} Returns `array`.
  24264. */
  24265. function reorder(array, indexes) {
  24266. var arrLength = array.length,
  24267. length = nativeMin(indexes.length, arrLength),
  24268. oldArray = copyArray(array);
  24269. while (length--) {
  24270. var index = indexes[length];
  24271. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24272. }
  24273. return array;
  24274. }
  24275. /**
  24276. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24277. *
  24278. * @private
  24279. * @param {Object} object The object to query.
  24280. * @param {string} key The key of the property to get.
  24281. * @returns {*} Returns the property value.
  24282. */
  24283. function safeGet(object, key) {
  24284. if (key === 'constructor' && typeof object[key] === 'function') {
  24285. return;
  24286. }
  24287. if (key == '__proto__') {
  24288. return;
  24289. }
  24290. return object[key];
  24291. }
  24292. /**
  24293. * Sets metadata for `func`.
  24294. *
  24295. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24296. * period of time, it will trip its breaker and transition to an identity
  24297. * function to avoid garbage collection pauses in V8. See
  24298. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24299. * for more details.
  24300. *
  24301. * @private
  24302. * @param {Function} func The function to associate metadata with.
  24303. * @param {*} data The metadata.
  24304. * @returns {Function} Returns `func`.
  24305. */
  24306. var setData = shortOut(baseSetData);
  24307. /**
  24308. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24309. *
  24310. * @private
  24311. * @param {Function} func The function to delay.
  24312. * @param {number} wait The number of milliseconds to delay invocation.
  24313. * @returns {number|Object} Returns the timer id or timeout object.
  24314. */
  24315. var setTimeout = ctxSetTimeout || function(func, wait) {
  24316. return root.setTimeout(func, wait);
  24317. };
  24318. /**
  24319. * Sets the `toString` method of `func` to return `string`.
  24320. *
  24321. * @private
  24322. * @param {Function} func The function to modify.
  24323. * @param {Function} string The `toString` result.
  24324. * @returns {Function} Returns `func`.
  24325. */
  24326. var setToString = shortOut(baseSetToString);
  24327. /**
  24328. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24329. * with wrapper details in a comment at the top of the source body.
  24330. *
  24331. * @private
  24332. * @param {Function} wrapper The function to modify.
  24333. * @param {Function} reference The reference function.
  24334. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24335. * @returns {Function} Returns `wrapper`.
  24336. */
  24337. function setWrapToString(wrapper, reference, bitmask) {
  24338. var source = (reference + '');
  24339. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24340. }
  24341. /**
  24342. * Creates a function that'll short out and invoke `identity` instead
  24343. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24344. * milliseconds.
  24345. *
  24346. * @private
  24347. * @param {Function} func The function to restrict.
  24348. * @returns {Function} Returns the new shortable function.
  24349. */
  24350. function shortOut(func) {
  24351. var count = 0,
  24352. lastCalled = 0;
  24353. return function() {
  24354. var stamp = nativeNow(),
  24355. remaining = HOT_SPAN - (stamp - lastCalled);
  24356. lastCalled = stamp;
  24357. if (remaining > 0) {
  24358. if (++count >= HOT_COUNT) {
  24359. return arguments[0];
  24360. }
  24361. } else {
  24362. count = 0;
  24363. }
  24364. return func.apply(undefined, arguments);
  24365. };
  24366. }
  24367. /**
  24368. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24369. *
  24370. * @private
  24371. * @param {Array} array The array to shuffle.
  24372. * @param {number} [size=array.length] The size of `array`.
  24373. * @returns {Array} Returns `array`.
  24374. */
  24375. function shuffleSelf(array, size) {
  24376. var index = -1,
  24377. length = array.length,
  24378. lastIndex = length - 1;
  24379. size = size === undefined ? length : size;
  24380. while (++index < size) {
  24381. var rand = baseRandom(index, lastIndex),
  24382. value = array[rand];
  24383. array[rand] = array[index];
  24384. array[index] = value;
  24385. }
  24386. array.length = size;
  24387. return array;
  24388. }
  24389. /**
  24390. * Converts `string` to a property path array.
  24391. *
  24392. * @private
  24393. * @param {string} string The string to convert.
  24394. * @returns {Array} Returns the property path array.
  24395. */
  24396. var stringToPath = memoizeCapped(function(string) {
  24397. var result = [];
  24398. if (string.charCodeAt(0) === 46 /* . */) {
  24399. result.push('');
  24400. }
  24401. string.replace(rePropName, function(match, number, quote, subString) {
  24402. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24403. });
  24404. return result;
  24405. });
  24406. /**
  24407. * Converts `value` to a string key if it's not a string or symbol.
  24408. *
  24409. * @private
  24410. * @param {*} value The value to inspect.
  24411. * @returns {string|symbol} Returns the key.
  24412. */
  24413. function toKey(value) {
  24414. if (typeof value == 'string' || isSymbol(value)) {
  24415. return value;
  24416. }
  24417. var result = (value + '');
  24418. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24419. }
  24420. /**
  24421. * Converts `func` to its source code.
  24422. *
  24423. * @private
  24424. * @param {Function} func The function to convert.
  24425. * @returns {string} Returns the source code.
  24426. */
  24427. function toSource(func) {
  24428. if (func != null) {
  24429. try {
  24430. return funcToString.call(func);
  24431. } catch (e) {}
  24432. try {
  24433. return (func + '');
  24434. } catch (e) {}
  24435. }
  24436. return '';
  24437. }
  24438. /**
  24439. * Updates wrapper `details` based on `bitmask` flags.
  24440. *
  24441. * @private
  24442. * @returns {Array} details The details to modify.
  24443. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24444. * @returns {Array} Returns `details`.
  24445. */
  24446. function updateWrapDetails(details, bitmask) {
  24447. arrayEach(wrapFlags, function(pair) {
  24448. var value = '_.' + pair[0];
  24449. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24450. details.push(value);
  24451. }
  24452. });
  24453. return details.sort();
  24454. }
  24455. /**
  24456. * Creates a clone of `wrapper`.
  24457. *
  24458. * @private
  24459. * @param {Object} wrapper The wrapper to clone.
  24460. * @returns {Object} Returns the cloned wrapper.
  24461. */
  24462. function wrapperClone(wrapper) {
  24463. if (wrapper instanceof LazyWrapper) {
  24464. return wrapper.clone();
  24465. }
  24466. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24467. result.__actions__ = copyArray(wrapper.__actions__);
  24468. result.__index__ = wrapper.__index__;
  24469. result.__values__ = wrapper.__values__;
  24470. return result;
  24471. }
  24472. /*------------------------------------------------------------------------*/
  24473. /**
  24474. * Creates an array of elements split into groups the length of `size`.
  24475. * If `array` can't be split evenly, the final chunk will be the remaining
  24476. * elements.
  24477. *
  24478. * @static
  24479. * @memberOf _
  24480. * @since 3.0.0
  24481. * @category Array
  24482. * @param {Array} array The array to process.
  24483. * @param {number} [size=1] The length of each chunk
  24484. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24485. * @returns {Array} Returns the new array of chunks.
  24486. * @example
  24487. *
  24488. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24489. * // => [['a', 'b'], ['c', 'd']]
  24490. *
  24491. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24492. * // => [['a', 'b', 'c'], ['d']]
  24493. */
  24494. function chunk(array, size, guard) {
  24495. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24496. size = 1;
  24497. } else {
  24498. size = nativeMax(toInteger(size), 0);
  24499. }
  24500. var length = array == null ? 0 : array.length;
  24501. if (!length || size < 1) {
  24502. return [];
  24503. }
  24504. var index = 0,
  24505. resIndex = 0,
  24506. result = Array(nativeCeil(length / size));
  24507. while (index < length) {
  24508. result[resIndex++] = baseSlice(array, index, (index += size));
  24509. }
  24510. return result;
  24511. }
  24512. /**
  24513. * Creates an array with all falsey values removed. The values `false`, `null`,
  24514. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24515. *
  24516. * @static
  24517. * @memberOf _
  24518. * @since 0.1.0
  24519. * @category Array
  24520. * @param {Array} array The array to compact.
  24521. * @returns {Array} Returns the new array of filtered values.
  24522. * @example
  24523. *
  24524. * _.compact([0, 1, false, 2, '', 3]);
  24525. * // => [1, 2, 3]
  24526. */
  24527. function compact(array) {
  24528. var index = -1,
  24529. length = array == null ? 0 : array.length,
  24530. resIndex = 0,
  24531. result = [];
  24532. while (++index < length) {
  24533. var value = array[index];
  24534. if (value) {
  24535. result[resIndex++] = value;
  24536. }
  24537. }
  24538. return result;
  24539. }
  24540. /**
  24541. * Creates a new array concatenating `array` with any additional arrays
  24542. * and/or values.
  24543. *
  24544. * @static
  24545. * @memberOf _
  24546. * @since 4.0.0
  24547. * @category Array
  24548. * @param {Array} array The array to concatenate.
  24549. * @param {...*} [values] The values to concatenate.
  24550. * @returns {Array} Returns the new concatenated array.
  24551. * @example
  24552. *
  24553. * var array = [1];
  24554. * var other = _.concat(array, 2, [3], [[4]]);
  24555. *
  24556. * console.log(other);
  24557. * // => [1, 2, 3, [4]]
  24558. *
  24559. * console.log(array);
  24560. * // => [1]
  24561. */
  24562. function concat() {
  24563. var length = arguments.length;
  24564. if (!length) {
  24565. return [];
  24566. }
  24567. var args = Array(length - 1),
  24568. array = arguments[0],
  24569. index = length;
  24570. while (index--) {
  24571. args[index - 1] = arguments[index];
  24572. }
  24573. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24574. }
  24575. /**
  24576. * Creates an array of `array` values not included in the other given arrays
  24577. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24578. * for equality comparisons. The order and references of result values are
  24579. * determined by the first array.
  24580. *
  24581. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24582. *
  24583. * @static
  24584. * @memberOf _
  24585. * @since 0.1.0
  24586. * @category Array
  24587. * @param {Array} array The array to inspect.
  24588. * @param {...Array} [values] The values to exclude.
  24589. * @returns {Array} Returns the new array of filtered values.
  24590. * @see _.without, _.xor
  24591. * @example
  24592. *
  24593. * _.difference([2, 1], [2, 3]);
  24594. * // => [1]
  24595. */
  24596. var difference = baseRest(function(array, values) {
  24597. return isArrayLikeObject(array)
  24598. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24599. : [];
  24600. });
  24601. /**
  24602. * This method is like `_.difference` except that it accepts `iteratee` which
  24603. * is invoked for each element of `array` and `values` to generate the criterion
  24604. * by which they're compared. The order and references of result values are
  24605. * determined by the first array. The iteratee is invoked with one argument:
  24606. * (value).
  24607. *
  24608. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24609. *
  24610. * @static
  24611. * @memberOf _
  24612. * @since 4.0.0
  24613. * @category Array
  24614. * @param {Array} array The array to inspect.
  24615. * @param {...Array} [values] The values to exclude.
  24616. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24617. * @returns {Array} Returns the new array of filtered values.
  24618. * @example
  24619. *
  24620. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24621. * // => [1.2]
  24622. *
  24623. * // The `_.property` iteratee shorthand.
  24624. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24625. * // => [{ 'x': 2 }]
  24626. */
  24627. var differenceBy = baseRest(function(array, values) {
  24628. var iteratee = last(values);
  24629. if (isArrayLikeObject(iteratee)) {
  24630. iteratee = undefined;
  24631. }
  24632. return isArrayLikeObject(array)
  24633. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24634. : [];
  24635. });
  24636. /**
  24637. * This method is like `_.difference` except that it accepts `comparator`
  24638. * which is invoked to compare elements of `array` to `values`. The order and
  24639. * references of result values are determined by the first array. The comparator
  24640. * is invoked with two arguments: (arrVal, othVal).
  24641. *
  24642. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24643. *
  24644. * @static
  24645. * @memberOf _
  24646. * @since 4.0.0
  24647. * @category Array
  24648. * @param {Array} array The array to inspect.
  24649. * @param {...Array} [values] The values to exclude.
  24650. * @param {Function} [comparator] The comparator invoked per element.
  24651. * @returns {Array} Returns the new array of filtered values.
  24652. * @example
  24653. *
  24654. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24655. *
  24656. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24657. * // => [{ 'x': 2, 'y': 1 }]
  24658. */
  24659. var differenceWith = baseRest(function(array, values) {
  24660. var comparator = last(values);
  24661. if (isArrayLikeObject(comparator)) {
  24662. comparator = undefined;
  24663. }
  24664. return isArrayLikeObject(array)
  24665. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24666. : [];
  24667. });
  24668. /**
  24669. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24670. *
  24671. * @static
  24672. * @memberOf _
  24673. * @since 0.5.0
  24674. * @category Array
  24675. * @param {Array} array The array to query.
  24676. * @param {number} [n=1] The number of elements to drop.
  24677. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24678. * @returns {Array} Returns the slice of `array`.
  24679. * @example
  24680. *
  24681. * _.drop([1, 2, 3]);
  24682. * // => [2, 3]
  24683. *
  24684. * _.drop([1, 2, 3], 2);
  24685. * // => [3]
  24686. *
  24687. * _.drop([1, 2, 3], 5);
  24688. * // => []
  24689. *
  24690. * _.drop([1, 2, 3], 0);
  24691. * // => [1, 2, 3]
  24692. */
  24693. function drop(array, n, guard) {
  24694. var length = array == null ? 0 : array.length;
  24695. if (!length) {
  24696. return [];
  24697. }
  24698. n = (guard || n === undefined) ? 1 : toInteger(n);
  24699. return baseSlice(array, n < 0 ? 0 : n, length);
  24700. }
  24701. /**
  24702. * Creates a slice of `array` with `n` elements dropped from the end.
  24703. *
  24704. * @static
  24705. * @memberOf _
  24706. * @since 3.0.0
  24707. * @category Array
  24708. * @param {Array} array The array to query.
  24709. * @param {number} [n=1] The number of elements to drop.
  24710. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24711. * @returns {Array} Returns the slice of `array`.
  24712. * @example
  24713. *
  24714. * _.dropRight([1, 2, 3]);
  24715. * // => [1, 2]
  24716. *
  24717. * _.dropRight([1, 2, 3], 2);
  24718. * // => [1]
  24719. *
  24720. * _.dropRight([1, 2, 3], 5);
  24721. * // => []
  24722. *
  24723. * _.dropRight([1, 2, 3], 0);
  24724. * // => [1, 2, 3]
  24725. */
  24726. function dropRight(array, n, guard) {
  24727. var length = array == null ? 0 : array.length;
  24728. if (!length) {
  24729. return [];
  24730. }
  24731. n = (guard || n === undefined) ? 1 : toInteger(n);
  24732. n = length - n;
  24733. return baseSlice(array, 0, n < 0 ? 0 : n);
  24734. }
  24735. /**
  24736. * Creates a slice of `array` excluding elements dropped from the end.
  24737. * Elements are dropped until `predicate` returns falsey. The predicate is
  24738. * invoked with three arguments: (value, index, array).
  24739. *
  24740. * @static
  24741. * @memberOf _
  24742. * @since 3.0.0
  24743. * @category Array
  24744. * @param {Array} array The array to query.
  24745. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24746. * @returns {Array} Returns the slice of `array`.
  24747. * @example
  24748. *
  24749. * var users = [
  24750. * { 'user': 'barney', 'active': true },
  24751. * { 'user': 'fred', 'active': false },
  24752. * { 'user': 'pebbles', 'active': false }
  24753. * ];
  24754. *
  24755. * _.dropRightWhile(users, function(o) { return !o.active; });
  24756. * // => objects for ['barney']
  24757. *
  24758. * // The `_.matches` iteratee shorthand.
  24759. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24760. * // => objects for ['barney', 'fred']
  24761. *
  24762. * // The `_.matchesProperty` iteratee shorthand.
  24763. * _.dropRightWhile(users, ['active', false]);
  24764. * // => objects for ['barney']
  24765. *
  24766. * // The `_.property` iteratee shorthand.
  24767. * _.dropRightWhile(users, 'active');
  24768. * // => objects for ['barney', 'fred', 'pebbles']
  24769. */
  24770. function dropRightWhile(array, predicate) {
  24771. return (array && array.length)
  24772. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24773. : [];
  24774. }
  24775. /**
  24776. * Creates a slice of `array` excluding elements dropped from the beginning.
  24777. * Elements are dropped until `predicate` returns falsey. The predicate is
  24778. * invoked with three arguments: (value, index, array).
  24779. *
  24780. * @static
  24781. * @memberOf _
  24782. * @since 3.0.0
  24783. * @category Array
  24784. * @param {Array} array The array to query.
  24785. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24786. * @returns {Array} Returns the slice of `array`.
  24787. * @example
  24788. *
  24789. * var users = [
  24790. * { 'user': 'barney', 'active': false },
  24791. * { 'user': 'fred', 'active': false },
  24792. * { 'user': 'pebbles', 'active': true }
  24793. * ];
  24794. *
  24795. * _.dropWhile(users, function(o) { return !o.active; });
  24796. * // => objects for ['pebbles']
  24797. *
  24798. * // The `_.matches` iteratee shorthand.
  24799. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24800. * // => objects for ['fred', 'pebbles']
  24801. *
  24802. * // The `_.matchesProperty` iteratee shorthand.
  24803. * _.dropWhile(users, ['active', false]);
  24804. * // => objects for ['pebbles']
  24805. *
  24806. * // The `_.property` iteratee shorthand.
  24807. * _.dropWhile(users, 'active');
  24808. * // => objects for ['barney', 'fred', 'pebbles']
  24809. */
  24810. function dropWhile(array, predicate) {
  24811. return (array && array.length)
  24812. ? baseWhile(array, getIteratee(predicate, 3), true)
  24813. : [];
  24814. }
  24815. /**
  24816. * Fills elements of `array` with `value` from `start` up to, but not
  24817. * including, `end`.
  24818. *
  24819. * **Note:** This method mutates `array`.
  24820. *
  24821. * @static
  24822. * @memberOf _
  24823. * @since 3.2.0
  24824. * @category Array
  24825. * @param {Array} array The array to fill.
  24826. * @param {*} value The value to fill `array` with.
  24827. * @param {number} [start=0] The start position.
  24828. * @param {number} [end=array.length] The end position.
  24829. * @returns {Array} Returns `array`.
  24830. * @example
  24831. *
  24832. * var array = [1, 2, 3];
  24833. *
  24834. * _.fill(array, 'a');
  24835. * console.log(array);
  24836. * // => ['a', 'a', 'a']
  24837. *
  24838. * _.fill(Array(3), 2);
  24839. * // => [2, 2, 2]
  24840. *
  24841. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24842. * // => [4, '*', '*', 10]
  24843. */
  24844. function fill(array, value, start, end) {
  24845. var length = array == null ? 0 : array.length;
  24846. if (!length) {
  24847. return [];
  24848. }
  24849. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24850. start = 0;
  24851. end = length;
  24852. }
  24853. return baseFill(array, value, start, end);
  24854. }
  24855. /**
  24856. * This method is like `_.find` except that it returns the index of the first
  24857. * element `predicate` returns truthy for instead of the element itself.
  24858. *
  24859. * @static
  24860. * @memberOf _
  24861. * @since 1.1.0
  24862. * @category Array
  24863. * @param {Array} array The array to inspect.
  24864. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24865. * @param {number} [fromIndex=0] The index to search from.
  24866. * @returns {number} Returns the index of the found element, else `-1`.
  24867. * @example
  24868. *
  24869. * var users = [
  24870. * { 'user': 'barney', 'active': false },
  24871. * { 'user': 'fred', 'active': false },
  24872. * { 'user': 'pebbles', 'active': true }
  24873. * ];
  24874. *
  24875. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24876. * // => 0
  24877. *
  24878. * // The `_.matches` iteratee shorthand.
  24879. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24880. * // => 1
  24881. *
  24882. * // The `_.matchesProperty` iteratee shorthand.
  24883. * _.findIndex(users, ['active', false]);
  24884. * // => 0
  24885. *
  24886. * // The `_.property` iteratee shorthand.
  24887. * _.findIndex(users, 'active');
  24888. * // => 2
  24889. */
  24890. function findIndex(array, predicate, fromIndex) {
  24891. var length = array == null ? 0 : array.length;
  24892. if (!length) {
  24893. return -1;
  24894. }
  24895. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24896. if (index < 0) {
  24897. index = nativeMax(length + index, 0);
  24898. }
  24899. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24900. }
  24901. /**
  24902. * This method is like `_.findIndex` except that it iterates over elements
  24903. * of `collection` from right to left.
  24904. *
  24905. * @static
  24906. * @memberOf _
  24907. * @since 2.0.0
  24908. * @category Array
  24909. * @param {Array} array The array to inspect.
  24910. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24911. * @param {number} [fromIndex=array.length-1] The index to search from.
  24912. * @returns {number} Returns the index of the found element, else `-1`.
  24913. * @example
  24914. *
  24915. * var users = [
  24916. * { 'user': 'barney', 'active': true },
  24917. * { 'user': 'fred', 'active': false },
  24918. * { 'user': 'pebbles', 'active': false }
  24919. * ];
  24920. *
  24921. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24922. * // => 2
  24923. *
  24924. * // The `_.matches` iteratee shorthand.
  24925. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24926. * // => 0
  24927. *
  24928. * // The `_.matchesProperty` iteratee shorthand.
  24929. * _.findLastIndex(users, ['active', false]);
  24930. * // => 2
  24931. *
  24932. * // The `_.property` iteratee shorthand.
  24933. * _.findLastIndex(users, 'active');
  24934. * // => 0
  24935. */
  24936. function findLastIndex(array, predicate, fromIndex) {
  24937. var length = array == null ? 0 : array.length;
  24938. if (!length) {
  24939. return -1;
  24940. }
  24941. var index = length - 1;
  24942. if (fromIndex !== undefined) {
  24943. index = toInteger(fromIndex);
  24944. index = fromIndex < 0
  24945. ? nativeMax(length + index, 0)
  24946. : nativeMin(index, length - 1);
  24947. }
  24948. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24949. }
  24950. /**
  24951. * Flattens `array` a single level deep.
  24952. *
  24953. * @static
  24954. * @memberOf _
  24955. * @since 0.1.0
  24956. * @category Array
  24957. * @param {Array} array The array to flatten.
  24958. * @returns {Array} Returns the new flattened array.
  24959. * @example
  24960. *
  24961. * _.flatten([1, [2, [3, [4]], 5]]);
  24962. * // => [1, 2, [3, [4]], 5]
  24963. */
  24964. function flatten(array) {
  24965. var length = array == null ? 0 : array.length;
  24966. return length ? baseFlatten(array, 1) : [];
  24967. }
  24968. /**
  24969. * Recursively flattens `array`.
  24970. *
  24971. * @static
  24972. * @memberOf _
  24973. * @since 3.0.0
  24974. * @category Array
  24975. * @param {Array} array The array to flatten.
  24976. * @returns {Array} Returns the new flattened array.
  24977. * @example
  24978. *
  24979. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24980. * // => [1, 2, 3, 4, 5]
  24981. */
  24982. function flattenDeep(array) {
  24983. var length = array == null ? 0 : array.length;
  24984. return length ? baseFlatten(array, INFINITY) : [];
  24985. }
  24986. /**
  24987. * Recursively flatten `array` up to `depth` times.
  24988. *
  24989. * @static
  24990. * @memberOf _
  24991. * @since 4.4.0
  24992. * @category Array
  24993. * @param {Array} array The array to flatten.
  24994. * @param {number} [depth=1] The maximum recursion depth.
  24995. * @returns {Array} Returns the new flattened array.
  24996. * @example
  24997. *
  24998. * var array = [1, [2, [3, [4]], 5]];
  24999. *
  25000. * _.flattenDepth(array, 1);
  25001. * // => [1, 2, [3, [4]], 5]
  25002. *
  25003. * _.flattenDepth(array, 2);
  25004. * // => [1, 2, 3, [4], 5]
  25005. */
  25006. function flattenDepth(array, depth) {
  25007. var length = array == null ? 0 : array.length;
  25008. if (!length) {
  25009. return [];
  25010. }
  25011. depth = depth === undefined ? 1 : toInteger(depth);
  25012. return baseFlatten(array, depth);
  25013. }
  25014. /**
  25015. * The inverse of `_.toPairs`; this method returns an object composed
  25016. * from key-value `pairs`.
  25017. *
  25018. * @static
  25019. * @memberOf _
  25020. * @since 4.0.0
  25021. * @category Array
  25022. * @param {Array} pairs The key-value pairs.
  25023. * @returns {Object} Returns the new object.
  25024. * @example
  25025. *
  25026. * _.fromPairs([['a', 1], ['b', 2]]);
  25027. * // => { 'a': 1, 'b': 2 }
  25028. */
  25029. function fromPairs(pairs) {
  25030. var index = -1,
  25031. length = pairs == null ? 0 : pairs.length,
  25032. result = {};
  25033. while (++index < length) {
  25034. var pair = pairs[index];
  25035. result[pair[0]] = pair[1];
  25036. }
  25037. return result;
  25038. }
  25039. /**
  25040. * Gets the first element of `array`.
  25041. *
  25042. * @static
  25043. * @memberOf _
  25044. * @since 0.1.0
  25045. * @alias first
  25046. * @category Array
  25047. * @param {Array} array The array to query.
  25048. * @returns {*} Returns the first element of `array`.
  25049. * @example
  25050. *
  25051. * _.head([1, 2, 3]);
  25052. * // => 1
  25053. *
  25054. * _.head([]);
  25055. * // => undefined
  25056. */
  25057. function head(array) {
  25058. return (array && array.length) ? array[0] : undefined;
  25059. }
  25060. /**
  25061. * Gets the index at which the first occurrence of `value` is found in `array`
  25062. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25063. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25064. * offset from the end of `array`.
  25065. *
  25066. * @static
  25067. * @memberOf _
  25068. * @since 0.1.0
  25069. * @category Array
  25070. * @param {Array} array The array to inspect.
  25071. * @param {*} value The value to search for.
  25072. * @param {number} [fromIndex=0] The index to search from.
  25073. * @returns {number} Returns the index of the matched value, else `-1`.
  25074. * @example
  25075. *
  25076. * _.indexOf([1, 2, 1, 2], 2);
  25077. * // => 1
  25078. *
  25079. * // Search from the `fromIndex`.
  25080. * _.indexOf([1, 2, 1, 2], 2, 2);
  25081. * // => 3
  25082. */
  25083. function indexOf(array, value, fromIndex) {
  25084. var length = array == null ? 0 : array.length;
  25085. if (!length) {
  25086. return -1;
  25087. }
  25088. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25089. if (index < 0) {
  25090. index = nativeMax(length + index, 0);
  25091. }
  25092. return baseIndexOf(array, value, index);
  25093. }
  25094. /**
  25095. * Gets all but the last element of `array`.
  25096. *
  25097. * @static
  25098. * @memberOf _
  25099. * @since 0.1.0
  25100. * @category Array
  25101. * @param {Array} array The array to query.
  25102. * @returns {Array} Returns the slice of `array`.
  25103. * @example
  25104. *
  25105. * _.initial([1, 2, 3]);
  25106. * // => [1, 2]
  25107. */
  25108. function initial(array) {
  25109. var length = array == null ? 0 : array.length;
  25110. return length ? baseSlice(array, 0, -1) : [];
  25111. }
  25112. /**
  25113. * Creates an array of unique values that are included in all given arrays
  25114. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25115. * for equality comparisons. The order and references of result values are
  25116. * determined by the first array.
  25117. *
  25118. * @static
  25119. * @memberOf _
  25120. * @since 0.1.0
  25121. * @category Array
  25122. * @param {...Array} [arrays] The arrays to inspect.
  25123. * @returns {Array} Returns the new array of intersecting values.
  25124. * @example
  25125. *
  25126. * _.intersection([2, 1], [2, 3]);
  25127. * // => [2]
  25128. */
  25129. var intersection = baseRest(function(arrays) {
  25130. var mapped = arrayMap(arrays, castArrayLikeObject);
  25131. return (mapped.length && mapped[0] === arrays[0])
  25132. ? baseIntersection(mapped)
  25133. : [];
  25134. });
  25135. /**
  25136. * This method is like `_.intersection` except that it accepts `iteratee`
  25137. * which is invoked for each element of each `arrays` to generate the criterion
  25138. * by which they're compared. The order and references of result values are
  25139. * determined by the first array. The iteratee is invoked with one argument:
  25140. * (value).
  25141. *
  25142. * @static
  25143. * @memberOf _
  25144. * @since 4.0.0
  25145. * @category Array
  25146. * @param {...Array} [arrays] The arrays to inspect.
  25147. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25148. * @returns {Array} Returns the new array of intersecting values.
  25149. * @example
  25150. *
  25151. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25152. * // => [2.1]
  25153. *
  25154. * // The `_.property` iteratee shorthand.
  25155. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25156. * // => [{ 'x': 1 }]
  25157. */
  25158. var intersectionBy = baseRest(function(arrays) {
  25159. var iteratee = last(arrays),
  25160. mapped = arrayMap(arrays, castArrayLikeObject);
  25161. if (iteratee === last(mapped)) {
  25162. iteratee = undefined;
  25163. } else {
  25164. mapped.pop();
  25165. }
  25166. return (mapped.length && mapped[0] === arrays[0])
  25167. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25168. : [];
  25169. });
  25170. /**
  25171. * This method is like `_.intersection` except that it accepts `comparator`
  25172. * which is invoked to compare elements of `arrays`. The order and references
  25173. * of result values are determined by the first array. The comparator is
  25174. * invoked with two arguments: (arrVal, othVal).
  25175. *
  25176. * @static
  25177. * @memberOf _
  25178. * @since 4.0.0
  25179. * @category Array
  25180. * @param {...Array} [arrays] The arrays to inspect.
  25181. * @param {Function} [comparator] The comparator invoked per element.
  25182. * @returns {Array} Returns the new array of intersecting values.
  25183. * @example
  25184. *
  25185. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25186. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25187. *
  25188. * _.intersectionWith(objects, others, _.isEqual);
  25189. * // => [{ 'x': 1, 'y': 2 }]
  25190. */
  25191. var intersectionWith = baseRest(function(arrays) {
  25192. var comparator = last(arrays),
  25193. mapped = arrayMap(arrays, castArrayLikeObject);
  25194. comparator = typeof comparator == 'function' ? comparator : undefined;
  25195. if (comparator) {
  25196. mapped.pop();
  25197. }
  25198. return (mapped.length && mapped[0] === arrays[0])
  25199. ? baseIntersection(mapped, undefined, comparator)
  25200. : [];
  25201. });
  25202. /**
  25203. * Converts all elements in `array` into a string separated by `separator`.
  25204. *
  25205. * @static
  25206. * @memberOf _
  25207. * @since 4.0.0
  25208. * @category Array
  25209. * @param {Array} array The array to convert.
  25210. * @param {string} [separator=','] The element separator.
  25211. * @returns {string} Returns the joined string.
  25212. * @example
  25213. *
  25214. * _.join(['a', 'b', 'c'], '~');
  25215. * // => 'a~b~c'
  25216. */
  25217. function join(array, separator) {
  25218. return array == null ? '' : nativeJoin.call(array, separator);
  25219. }
  25220. /**
  25221. * Gets the last element of `array`.
  25222. *
  25223. * @static
  25224. * @memberOf _
  25225. * @since 0.1.0
  25226. * @category Array
  25227. * @param {Array} array The array to query.
  25228. * @returns {*} Returns the last element of `array`.
  25229. * @example
  25230. *
  25231. * _.last([1, 2, 3]);
  25232. * // => 3
  25233. */
  25234. function last(array) {
  25235. var length = array == null ? 0 : array.length;
  25236. return length ? array[length - 1] : undefined;
  25237. }
  25238. /**
  25239. * This method is like `_.indexOf` except that it iterates over elements of
  25240. * `array` from right to left.
  25241. *
  25242. * @static
  25243. * @memberOf _
  25244. * @since 0.1.0
  25245. * @category Array
  25246. * @param {Array} array The array to inspect.
  25247. * @param {*} value The value to search for.
  25248. * @param {number} [fromIndex=array.length-1] The index to search from.
  25249. * @returns {number} Returns the index of the matched value, else `-1`.
  25250. * @example
  25251. *
  25252. * _.lastIndexOf([1, 2, 1, 2], 2);
  25253. * // => 3
  25254. *
  25255. * // Search from the `fromIndex`.
  25256. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25257. * // => 1
  25258. */
  25259. function lastIndexOf(array, value, fromIndex) {
  25260. var length = array == null ? 0 : array.length;
  25261. if (!length) {
  25262. return -1;
  25263. }
  25264. var index = length;
  25265. if (fromIndex !== undefined) {
  25266. index = toInteger(fromIndex);
  25267. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25268. }
  25269. return value === value
  25270. ? strictLastIndexOf(array, value, index)
  25271. : baseFindIndex(array, baseIsNaN, index, true);
  25272. }
  25273. /**
  25274. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25275. * element from the end is returned.
  25276. *
  25277. * @static
  25278. * @memberOf _
  25279. * @since 4.11.0
  25280. * @category Array
  25281. * @param {Array} array The array to query.
  25282. * @param {number} [n=0] The index of the element to return.
  25283. * @returns {*} Returns the nth element of `array`.
  25284. * @example
  25285. *
  25286. * var array = ['a', 'b', 'c', 'd'];
  25287. *
  25288. * _.nth(array, 1);
  25289. * // => 'b'
  25290. *
  25291. * _.nth(array, -2);
  25292. * // => 'c';
  25293. */
  25294. function nth(array, n) {
  25295. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25296. }
  25297. /**
  25298. * Removes all given values from `array` using
  25299. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25300. * for equality comparisons.
  25301. *
  25302. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25303. * to remove elements from an array by predicate.
  25304. *
  25305. * @static
  25306. * @memberOf _
  25307. * @since 2.0.0
  25308. * @category Array
  25309. * @param {Array} array The array to modify.
  25310. * @param {...*} [values] The values to remove.
  25311. * @returns {Array} Returns `array`.
  25312. * @example
  25313. *
  25314. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25315. *
  25316. * _.pull(array, 'a', 'c');
  25317. * console.log(array);
  25318. * // => ['b', 'b']
  25319. */
  25320. var pull = baseRest(pullAll);
  25321. /**
  25322. * This method is like `_.pull` except that it accepts an array of values to remove.
  25323. *
  25324. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25325. *
  25326. * @static
  25327. * @memberOf _
  25328. * @since 4.0.0
  25329. * @category Array
  25330. * @param {Array} array The array to modify.
  25331. * @param {Array} values The values to remove.
  25332. * @returns {Array} Returns `array`.
  25333. * @example
  25334. *
  25335. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25336. *
  25337. * _.pullAll(array, ['a', 'c']);
  25338. * console.log(array);
  25339. * // => ['b', 'b']
  25340. */
  25341. function pullAll(array, values) {
  25342. return (array && array.length && values && values.length)
  25343. ? basePullAll(array, values)
  25344. : array;
  25345. }
  25346. /**
  25347. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25348. * invoked for each element of `array` and `values` to generate the criterion
  25349. * by which they're compared. The iteratee is invoked with one argument: (value).
  25350. *
  25351. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25352. *
  25353. * @static
  25354. * @memberOf _
  25355. * @since 4.0.0
  25356. * @category Array
  25357. * @param {Array} array The array to modify.
  25358. * @param {Array} values The values to remove.
  25359. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25360. * @returns {Array} Returns `array`.
  25361. * @example
  25362. *
  25363. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25364. *
  25365. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25366. * console.log(array);
  25367. * // => [{ 'x': 2 }]
  25368. */
  25369. function pullAllBy(array, values, iteratee) {
  25370. return (array && array.length && values && values.length)
  25371. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25372. : array;
  25373. }
  25374. /**
  25375. * This method is like `_.pullAll` except that it accepts `comparator` which
  25376. * is invoked to compare elements of `array` to `values`. The comparator is
  25377. * invoked with two arguments: (arrVal, othVal).
  25378. *
  25379. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25380. *
  25381. * @static
  25382. * @memberOf _
  25383. * @since 4.6.0
  25384. * @category Array
  25385. * @param {Array} array The array to modify.
  25386. * @param {Array} values The values to remove.
  25387. * @param {Function} [comparator] The comparator invoked per element.
  25388. * @returns {Array} Returns `array`.
  25389. * @example
  25390. *
  25391. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25392. *
  25393. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25394. * console.log(array);
  25395. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25396. */
  25397. function pullAllWith(array, values, comparator) {
  25398. return (array && array.length && values && values.length)
  25399. ? basePullAll(array, values, undefined, comparator)
  25400. : array;
  25401. }
  25402. /**
  25403. * Removes elements from `array` corresponding to `indexes` and returns an
  25404. * array of removed elements.
  25405. *
  25406. * **Note:** Unlike `_.at`, this method mutates `array`.
  25407. *
  25408. * @static
  25409. * @memberOf _
  25410. * @since 3.0.0
  25411. * @category Array
  25412. * @param {Array} array The array to modify.
  25413. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25414. * @returns {Array} Returns the new array of removed elements.
  25415. * @example
  25416. *
  25417. * var array = ['a', 'b', 'c', 'd'];
  25418. * var pulled = _.pullAt(array, [1, 3]);
  25419. *
  25420. * console.log(array);
  25421. * // => ['a', 'c']
  25422. *
  25423. * console.log(pulled);
  25424. * // => ['b', 'd']
  25425. */
  25426. var pullAt = flatRest(function(array, indexes) {
  25427. var length = array == null ? 0 : array.length,
  25428. result = baseAt(array, indexes);
  25429. basePullAt(array, arrayMap(indexes, function(index) {
  25430. return isIndex(index, length) ? +index : index;
  25431. }).sort(compareAscending));
  25432. return result;
  25433. });
  25434. /**
  25435. * Removes all elements from `array` that `predicate` returns truthy for
  25436. * and returns an array of the removed elements. The predicate is invoked
  25437. * with three arguments: (value, index, array).
  25438. *
  25439. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25440. * to pull elements from an array by value.
  25441. *
  25442. * @static
  25443. * @memberOf _
  25444. * @since 2.0.0
  25445. * @category Array
  25446. * @param {Array} array The array to modify.
  25447. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25448. * @returns {Array} Returns the new array of removed elements.
  25449. * @example
  25450. *
  25451. * var array = [1, 2, 3, 4];
  25452. * var evens = _.remove(array, function(n) {
  25453. * return n % 2 == 0;
  25454. * });
  25455. *
  25456. * console.log(array);
  25457. * // => [1, 3]
  25458. *
  25459. * console.log(evens);
  25460. * // => [2, 4]
  25461. */
  25462. function remove(array, predicate) {
  25463. var result = [];
  25464. if (!(array && array.length)) {
  25465. return result;
  25466. }
  25467. var index = -1,
  25468. indexes = [],
  25469. length = array.length;
  25470. predicate = getIteratee(predicate, 3);
  25471. while (++index < length) {
  25472. var value = array[index];
  25473. if (predicate(value, index, array)) {
  25474. result.push(value);
  25475. indexes.push(index);
  25476. }
  25477. }
  25478. basePullAt(array, indexes);
  25479. return result;
  25480. }
  25481. /**
  25482. * Reverses `array` so that the first element becomes the last, the second
  25483. * element becomes the second to last, and so on.
  25484. *
  25485. * **Note:** This method mutates `array` and is based on
  25486. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25487. *
  25488. * @static
  25489. * @memberOf _
  25490. * @since 4.0.0
  25491. * @category Array
  25492. * @param {Array} array The array to modify.
  25493. * @returns {Array} Returns `array`.
  25494. * @example
  25495. *
  25496. * var array = [1, 2, 3];
  25497. *
  25498. * _.reverse(array);
  25499. * // => [3, 2, 1]
  25500. *
  25501. * console.log(array);
  25502. * // => [3, 2, 1]
  25503. */
  25504. function reverse(array) {
  25505. return array == null ? array : nativeReverse.call(array);
  25506. }
  25507. /**
  25508. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25509. *
  25510. * **Note:** This method is used instead of
  25511. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25512. * returned.
  25513. *
  25514. * @static
  25515. * @memberOf _
  25516. * @since 3.0.0
  25517. * @category Array
  25518. * @param {Array} array The array to slice.
  25519. * @param {number} [start=0] The start position.
  25520. * @param {number} [end=array.length] The end position.
  25521. * @returns {Array} Returns the slice of `array`.
  25522. */
  25523. function slice(array, start, end) {
  25524. var length = array == null ? 0 : array.length;
  25525. if (!length) {
  25526. return [];
  25527. }
  25528. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25529. start = 0;
  25530. end = length;
  25531. }
  25532. else {
  25533. start = start == null ? 0 : toInteger(start);
  25534. end = end === undefined ? length : toInteger(end);
  25535. }
  25536. return baseSlice(array, start, end);
  25537. }
  25538. /**
  25539. * Uses a binary search to determine the lowest index at which `value`
  25540. * should be inserted into `array` in order to maintain its sort order.
  25541. *
  25542. * @static
  25543. * @memberOf _
  25544. * @since 0.1.0
  25545. * @category Array
  25546. * @param {Array} array The sorted array to inspect.
  25547. * @param {*} value The value to evaluate.
  25548. * @returns {number} Returns the index at which `value` should be inserted
  25549. * into `array`.
  25550. * @example
  25551. *
  25552. * _.sortedIndex([30, 50], 40);
  25553. * // => 1
  25554. */
  25555. function sortedIndex(array, value) {
  25556. return baseSortedIndex(array, value);
  25557. }
  25558. /**
  25559. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25560. * which is invoked for `value` and each element of `array` to compute their
  25561. * sort ranking. The iteratee is invoked with one argument: (value).
  25562. *
  25563. * @static
  25564. * @memberOf _
  25565. * @since 4.0.0
  25566. * @category Array
  25567. * @param {Array} array The sorted array to inspect.
  25568. * @param {*} value The value to evaluate.
  25569. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25570. * @returns {number} Returns the index at which `value` should be inserted
  25571. * into `array`.
  25572. * @example
  25573. *
  25574. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25575. *
  25576. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25577. * // => 0
  25578. *
  25579. * // The `_.property` iteratee shorthand.
  25580. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25581. * // => 0
  25582. */
  25583. function sortedIndexBy(array, value, iteratee) {
  25584. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25585. }
  25586. /**
  25587. * This method is like `_.indexOf` except that it performs a binary
  25588. * search on a sorted `array`.
  25589. *
  25590. * @static
  25591. * @memberOf _
  25592. * @since 4.0.0
  25593. * @category Array
  25594. * @param {Array} array The array to inspect.
  25595. * @param {*} value The value to search for.
  25596. * @returns {number} Returns the index of the matched value, else `-1`.
  25597. * @example
  25598. *
  25599. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25600. * // => 1
  25601. */
  25602. function sortedIndexOf(array, value) {
  25603. var length = array == null ? 0 : array.length;
  25604. if (length) {
  25605. var index = baseSortedIndex(array, value);
  25606. if (index < length && eq(array[index], value)) {
  25607. return index;
  25608. }
  25609. }
  25610. return -1;
  25611. }
  25612. /**
  25613. * This method is like `_.sortedIndex` except that it returns the highest
  25614. * index at which `value` should be inserted into `array` in order to
  25615. * maintain its sort order.
  25616. *
  25617. * @static
  25618. * @memberOf _
  25619. * @since 3.0.0
  25620. * @category Array
  25621. * @param {Array} array The sorted array to inspect.
  25622. * @param {*} value The value to evaluate.
  25623. * @returns {number} Returns the index at which `value` should be inserted
  25624. * into `array`.
  25625. * @example
  25626. *
  25627. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25628. * // => 4
  25629. */
  25630. function sortedLastIndex(array, value) {
  25631. return baseSortedIndex(array, value, true);
  25632. }
  25633. /**
  25634. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25635. * which is invoked for `value` and each element of `array` to compute their
  25636. * sort ranking. The iteratee is invoked with one argument: (value).
  25637. *
  25638. * @static
  25639. * @memberOf _
  25640. * @since 4.0.0
  25641. * @category Array
  25642. * @param {Array} array The sorted array to inspect.
  25643. * @param {*} value The value to evaluate.
  25644. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25645. * @returns {number} Returns the index at which `value` should be inserted
  25646. * into `array`.
  25647. * @example
  25648. *
  25649. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25650. *
  25651. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25652. * // => 1
  25653. *
  25654. * // The `_.property` iteratee shorthand.
  25655. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25656. * // => 1
  25657. */
  25658. function sortedLastIndexBy(array, value, iteratee) {
  25659. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25660. }
  25661. /**
  25662. * This method is like `_.lastIndexOf` except that it performs a binary
  25663. * search on a sorted `array`.
  25664. *
  25665. * @static
  25666. * @memberOf _
  25667. * @since 4.0.0
  25668. * @category Array
  25669. * @param {Array} array The array to inspect.
  25670. * @param {*} value The value to search for.
  25671. * @returns {number} Returns the index of the matched value, else `-1`.
  25672. * @example
  25673. *
  25674. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25675. * // => 3
  25676. */
  25677. function sortedLastIndexOf(array, value) {
  25678. var length = array == null ? 0 : array.length;
  25679. if (length) {
  25680. var index = baseSortedIndex(array, value, true) - 1;
  25681. if (eq(array[index], value)) {
  25682. return index;
  25683. }
  25684. }
  25685. return -1;
  25686. }
  25687. /**
  25688. * This method is like `_.uniq` except that it's designed and optimized
  25689. * for sorted arrays.
  25690. *
  25691. * @static
  25692. * @memberOf _
  25693. * @since 4.0.0
  25694. * @category Array
  25695. * @param {Array} array The array to inspect.
  25696. * @returns {Array} Returns the new duplicate free array.
  25697. * @example
  25698. *
  25699. * _.sortedUniq([1, 1, 2]);
  25700. * // => [1, 2]
  25701. */
  25702. function sortedUniq(array) {
  25703. return (array && array.length)
  25704. ? baseSortedUniq(array)
  25705. : [];
  25706. }
  25707. /**
  25708. * This method is like `_.uniqBy` except that it's designed and optimized
  25709. * for sorted arrays.
  25710. *
  25711. * @static
  25712. * @memberOf _
  25713. * @since 4.0.0
  25714. * @category Array
  25715. * @param {Array} array The array to inspect.
  25716. * @param {Function} [iteratee] The iteratee invoked per element.
  25717. * @returns {Array} Returns the new duplicate free array.
  25718. * @example
  25719. *
  25720. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25721. * // => [1.1, 2.3]
  25722. */
  25723. function sortedUniqBy(array, iteratee) {
  25724. return (array && array.length)
  25725. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25726. : [];
  25727. }
  25728. /**
  25729. * Gets all but the first element of `array`.
  25730. *
  25731. * @static
  25732. * @memberOf _
  25733. * @since 4.0.0
  25734. * @category Array
  25735. * @param {Array} array The array to query.
  25736. * @returns {Array} Returns the slice of `array`.
  25737. * @example
  25738. *
  25739. * _.tail([1, 2, 3]);
  25740. * // => [2, 3]
  25741. */
  25742. function tail(array) {
  25743. var length = array == null ? 0 : array.length;
  25744. return length ? baseSlice(array, 1, length) : [];
  25745. }
  25746. /**
  25747. * Creates a slice of `array` with `n` elements taken from the beginning.
  25748. *
  25749. * @static
  25750. * @memberOf _
  25751. * @since 0.1.0
  25752. * @category Array
  25753. * @param {Array} array The array to query.
  25754. * @param {number} [n=1] The number of elements to take.
  25755. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25756. * @returns {Array} Returns the slice of `array`.
  25757. * @example
  25758. *
  25759. * _.take([1, 2, 3]);
  25760. * // => [1]
  25761. *
  25762. * _.take([1, 2, 3], 2);
  25763. * // => [1, 2]
  25764. *
  25765. * _.take([1, 2, 3], 5);
  25766. * // => [1, 2, 3]
  25767. *
  25768. * _.take([1, 2, 3], 0);
  25769. * // => []
  25770. */
  25771. function take(array, n, guard) {
  25772. if (!(array && array.length)) {
  25773. return [];
  25774. }
  25775. n = (guard || n === undefined) ? 1 : toInteger(n);
  25776. return baseSlice(array, 0, n < 0 ? 0 : n);
  25777. }
  25778. /**
  25779. * Creates a slice of `array` with `n` elements taken from the end.
  25780. *
  25781. * @static
  25782. * @memberOf _
  25783. * @since 3.0.0
  25784. * @category Array
  25785. * @param {Array} array The array to query.
  25786. * @param {number} [n=1] The number of elements to take.
  25787. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25788. * @returns {Array} Returns the slice of `array`.
  25789. * @example
  25790. *
  25791. * _.takeRight([1, 2, 3]);
  25792. * // => [3]
  25793. *
  25794. * _.takeRight([1, 2, 3], 2);
  25795. * // => [2, 3]
  25796. *
  25797. * _.takeRight([1, 2, 3], 5);
  25798. * // => [1, 2, 3]
  25799. *
  25800. * _.takeRight([1, 2, 3], 0);
  25801. * // => []
  25802. */
  25803. function takeRight(array, n, guard) {
  25804. var length = array == null ? 0 : array.length;
  25805. if (!length) {
  25806. return [];
  25807. }
  25808. n = (guard || n === undefined) ? 1 : toInteger(n);
  25809. n = length - n;
  25810. return baseSlice(array, n < 0 ? 0 : n, length);
  25811. }
  25812. /**
  25813. * Creates a slice of `array` with elements taken from the end. Elements are
  25814. * taken until `predicate` returns falsey. The predicate is invoked with
  25815. * three arguments: (value, index, array).
  25816. *
  25817. * @static
  25818. * @memberOf _
  25819. * @since 3.0.0
  25820. * @category Array
  25821. * @param {Array} array The array to query.
  25822. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25823. * @returns {Array} Returns the slice of `array`.
  25824. * @example
  25825. *
  25826. * var users = [
  25827. * { 'user': 'barney', 'active': true },
  25828. * { 'user': 'fred', 'active': false },
  25829. * { 'user': 'pebbles', 'active': false }
  25830. * ];
  25831. *
  25832. * _.takeRightWhile(users, function(o) { return !o.active; });
  25833. * // => objects for ['fred', 'pebbles']
  25834. *
  25835. * // The `_.matches` iteratee shorthand.
  25836. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25837. * // => objects for ['pebbles']
  25838. *
  25839. * // The `_.matchesProperty` iteratee shorthand.
  25840. * _.takeRightWhile(users, ['active', false]);
  25841. * // => objects for ['fred', 'pebbles']
  25842. *
  25843. * // The `_.property` iteratee shorthand.
  25844. * _.takeRightWhile(users, 'active');
  25845. * // => []
  25846. */
  25847. function takeRightWhile(array, predicate) {
  25848. return (array && array.length)
  25849. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25850. : [];
  25851. }
  25852. /**
  25853. * Creates a slice of `array` with elements taken from the beginning. Elements
  25854. * are taken until `predicate` returns falsey. The predicate is invoked with
  25855. * three arguments: (value, index, array).
  25856. *
  25857. * @static
  25858. * @memberOf _
  25859. * @since 3.0.0
  25860. * @category Array
  25861. * @param {Array} array The array to query.
  25862. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25863. * @returns {Array} Returns the slice of `array`.
  25864. * @example
  25865. *
  25866. * var users = [
  25867. * { 'user': 'barney', 'active': false },
  25868. * { 'user': 'fred', 'active': false },
  25869. * { 'user': 'pebbles', 'active': true }
  25870. * ];
  25871. *
  25872. * _.takeWhile(users, function(o) { return !o.active; });
  25873. * // => objects for ['barney', 'fred']
  25874. *
  25875. * // The `_.matches` iteratee shorthand.
  25876. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25877. * // => objects for ['barney']
  25878. *
  25879. * // The `_.matchesProperty` iteratee shorthand.
  25880. * _.takeWhile(users, ['active', false]);
  25881. * // => objects for ['barney', 'fred']
  25882. *
  25883. * // The `_.property` iteratee shorthand.
  25884. * _.takeWhile(users, 'active');
  25885. * // => []
  25886. */
  25887. function takeWhile(array, predicate) {
  25888. return (array && array.length)
  25889. ? baseWhile(array, getIteratee(predicate, 3))
  25890. : [];
  25891. }
  25892. /**
  25893. * Creates an array of unique values, in order, from all given arrays using
  25894. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25895. * for equality comparisons.
  25896. *
  25897. * @static
  25898. * @memberOf _
  25899. * @since 0.1.0
  25900. * @category Array
  25901. * @param {...Array} [arrays] The arrays to inspect.
  25902. * @returns {Array} Returns the new array of combined values.
  25903. * @example
  25904. *
  25905. * _.union([2], [1, 2]);
  25906. * // => [2, 1]
  25907. */
  25908. var union = baseRest(function(arrays) {
  25909. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25910. });
  25911. /**
  25912. * This method is like `_.union` except that it accepts `iteratee` which is
  25913. * invoked for each element of each `arrays` to generate the criterion by
  25914. * which uniqueness is computed. Result values are chosen from the first
  25915. * array in which the value occurs. The iteratee is invoked with one argument:
  25916. * (value).
  25917. *
  25918. * @static
  25919. * @memberOf _
  25920. * @since 4.0.0
  25921. * @category Array
  25922. * @param {...Array} [arrays] The arrays to inspect.
  25923. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25924. * @returns {Array} Returns the new array of combined values.
  25925. * @example
  25926. *
  25927. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25928. * // => [2.1, 1.2]
  25929. *
  25930. * // The `_.property` iteratee shorthand.
  25931. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25932. * // => [{ 'x': 1 }, { 'x': 2 }]
  25933. */
  25934. var unionBy = baseRest(function(arrays) {
  25935. var iteratee = last(arrays);
  25936. if (isArrayLikeObject(iteratee)) {
  25937. iteratee = undefined;
  25938. }
  25939. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25940. });
  25941. /**
  25942. * This method is like `_.union` except that it accepts `comparator` which
  25943. * is invoked to compare elements of `arrays`. Result values are chosen from
  25944. * the first array in which the value occurs. The comparator is invoked
  25945. * with two arguments: (arrVal, othVal).
  25946. *
  25947. * @static
  25948. * @memberOf _
  25949. * @since 4.0.0
  25950. * @category Array
  25951. * @param {...Array} [arrays] The arrays to inspect.
  25952. * @param {Function} [comparator] The comparator invoked per element.
  25953. * @returns {Array} Returns the new array of combined values.
  25954. * @example
  25955. *
  25956. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25957. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25958. *
  25959. * _.unionWith(objects, others, _.isEqual);
  25960. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25961. */
  25962. var unionWith = baseRest(function(arrays) {
  25963. var comparator = last(arrays);
  25964. comparator = typeof comparator == 'function' ? comparator : undefined;
  25965. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25966. });
  25967. /**
  25968. * Creates a duplicate-free version of an array, using
  25969. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25970. * for equality comparisons, in which only the first occurrence of each element
  25971. * is kept. The order of result values is determined by the order they occur
  25972. * in the array.
  25973. *
  25974. * @static
  25975. * @memberOf _
  25976. * @since 0.1.0
  25977. * @category Array
  25978. * @param {Array} array The array to inspect.
  25979. * @returns {Array} Returns the new duplicate free array.
  25980. * @example
  25981. *
  25982. * _.uniq([2, 1, 2]);
  25983. * // => [2, 1]
  25984. */
  25985. function uniq(array) {
  25986. return (array && array.length) ? baseUniq(array) : [];
  25987. }
  25988. /**
  25989. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25990. * invoked for each element in `array` to generate the criterion by which
  25991. * uniqueness is computed. The order of result values is determined by the
  25992. * order they occur in the array. The iteratee is invoked with one argument:
  25993. * (value).
  25994. *
  25995. * @static
  25996. * @memberOf _
  25997. * @since 4.0.0
  25998. * @category Array
  25999. * @param {Array} array The array to inspect.
  26000. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26001. * @returns {Array} Returns the new duplicate free array.
  26002. * @example
  26003. *
  26004. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26005. * // => [2.1, 1.2]
  26006. *
  26007. * // The `_.property` iteratee shorthand.
  26008. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26009. * // => [{ 'x': 1 }, { 'x': 2 }]
  26010. */
  26011. function uniqBy(array, iteratee) {
  26012. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26013. }
  26014. /**
  26015. * This method is like `_.uniq` except that it accepts `comparator` which
  26016. * is invoked to compare elements of `array`. The order of result values is
  26017. * determined by the order they occur in the array.The comparator is invoked
  26018. * with two arguments: (arrVal, othVal).
  26019. *
  26020. * @static
  26021. * @memberOf _
  26022. * @since 4.0.0
  26023. * @category Array
  26024. * @param {Array} array The array to inspect.
  26025. * @param {Function} [comparator] The comparator invoked per element.
  26026. * @returns {Array} Returns the new duplicate free array.
  26027. * @example
  26028. *
  26029. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26030. *
  26031. * _.uniqWith(objects, _.isEqual);
  26032. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26033. */
  26034. function uniqWith(array, comparator) {
  26035. comparator = typeof comparator == 'function' ? comparator : undefined;
  26036. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26037. }
  26038. /**
  26039. * This method is like `_.zip` except that it accepts an array of grouped
  26040. * elements and creates an array regrouping the elements to their pre-zip
  26041. * configuration.
  26042. *
  26043. * @static
  26044. * @memberOf _
  26045. * @since 1.2.0
  26046. * @category Array
  26047. * @param {Array} array The array of grouped elements to process.
  26048. * @returns {Array} Returns the new array of regrouped elements.
  26049. * @example
  26050. *
  26051. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26052. * // => [['a', 1, true], ['b', 2, false]]
  26053. *
  26054. * _.unzip(zipped);
  26055. * // => [['a', 'b'], [1, 2], [true, false]]
  26056. */
  26057. function unzip(array) {
  26058. if (!(array && array.length)) {
  26059. return [];
  26060. }
  26061. var length = 0;
  26062. array = arrayFilter(array, function(group) {
  26063. if (isArrayLikeObject(group)) {
  26064. length = nativeMax(group.length, length);
  26065. return true;
  26066. }
  26067. });
  26068. return baseTimes(length, function(index) {
  26069. return arrayMap(array, baseProperty(index));
  26070. });
  26071. }
  26072. /**
  26073. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26074. * how regrouped values should be combined. The iteratee is invoked with the
  26075. * elements of each group: (...group).
  26076. *
  26077. * @static
  26078. * @memberOf _
  26079. * @since 3.8.0
  26080. * @category Array
  26081. * @param {Array} array The array of grouped elements to process.
  26082. * @param {Function} [iteratee=_.identity] The function to combine
  26083. * regrouped values.
  26084. * @returns {Array} Returns the new array of regrouped elements.
  26085. * @example
  26086. *
  26087. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26088. * // => [[1, 10, 100], [2, 20, 200]]
  26089. *
  26090. * _.unzipWith(zipped, _.add);
  26091. * // => [3, 30, 300]
  26092. */
  26093. function unzipWith(array, iteratee) {
  26094. if (!(array && array.length)) {
  26095. return [];
  26096. }
  26097. var result = unzip(array);
  26098. if (iteratee == null) {
  26099. return result;
  26100. }
  26101. return arrayMap(result, function(group) {
  26102. return apply(iteratee, undefined, group);
  26103. });
  26104. }
  26105. /**
  26106. * Creates an array excluding all given values using
  26107. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26108. * for equality comparisons.
  26109. *
  26110. * **Note:** Unlike `_.pull`, this method returns a new array.
  26111. *
  26112. * @static
  26113. * @memberOf _
  26114. * @since 0.1.0
  26115. * @category Array
  26116. * @param {Array} array The array to inspect.
  26117. * @param {...*} [values] The values to exclude.
  26118. * @returns {Array} Returns the new array of filtered values.
  26119. * @see _.difference, _.xor
  26120. * @example
  26121. *
  26122. * _.without([2, 1, 2, 3], 1, 2);
  26123. * // => [3]
  26124. */
  26125. var without = baseRest(function(array, values) {
  26126. return isArrayLikeObject(array)
  26127. ? baseDifference(array, values)
  26128. : [];
  26129. });
  26130. /**
  26131. * Creates an array of unique values that is the
  26132. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26133. * of the given arrays. The order of result values is determined by the order
  26134. * they occur in the arrays.
  26135. *
  26136. * @static
  26137. * @memberOf _
  26138. * @since 2.4.0
  26139. * @category Array
  26140. * @param {...Array} [arrays] The arrays to inspect.
  26141. * @returns {Array} Returns the new array of filtered values.
  26142. * @see _.difference, _.without
  26143. * @example
  26144. *
  26145. * _.xor([2, 1], [2, 3]);
  26146. * // => [1, 3]
  26147. */
  26148. var xor = baseRest(function(arrays) {
  26149. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26150. });
  26151. /**
  26152. * This method is like `_.xor` except that it accepts `iteratee` which is
  26153. * invoked for each element of each `arrays` to generate the criterion by
  26154. * which by which they're compared. The order of result values is determined
  26155. * by the order they occur in the arrays. The iteratee is invoked with one
  26156. * argument: (value).
  26157. *
  26158. * @static
  26159. * @memberOf _
  26160. * @since 4.0.0
  26161. * @category Array
  26162. * @param {...Array} [arrays] The arrays to inspect.
  26163. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26164. * @returns {Array} Returns the new array of filtered values.
  26165. * @example
  26166. *
  26167. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26168. * // => [1.2, 3.4]
  26169. *
  26170. * // The `_.property` iteratee shorthand.
  26171. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26172. * // => [{ 'x': 2 }]
  26173. */
  26174. var xorBy = baseRest(function(arrays) {
  26175. var iteratee = last(arrays);
  26176. if (isArrayLikeObject(iteratee)) {
  26177. iteratee = undefined;
  26178. }
  26179. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26180. });
  26181. /**
  26182. * This method is like `_.xor` except that it accepts `comparator` which is
  26183. * invoked to compare elements of `arrays`. The order of result values is
  26184. * determined by the order they occur in the arrays. The comparator is invoked
  26185. * with two arguments: (arrVal, othVal).
  26186. *
  26187. * @static
  26188. * @memberOf _
  26189. * @since 4.0.0
  26190. * @category Array
  26191. * @param {...Array} [arrays] The arrays to inspect.
  26192. * @param {Function} [comparator] The comparator invoked per element.
  26193. * @returns {Array} Returns the new array of filtered values.
  26194. * @example
  26195. *
  26196. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26197. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26198. *
  26199. * _.xorWith(objects, others, _.isEqual);
  26200. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26201. */
  26202. var xorWith = baseRest(function(arrays) {
  26203. var comparator = last(arrays);
  26204. comparator = typeof comparator == 'function' ? comparator : undefined;
  26205. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26206. });
  26207. /**
  26208. * Creates an array of grouped elements, the first of which contains the
  26209. * first elements of the given arrays, the second of which contains the
  26210. * second elements of the given arrays, and so on.
  26211. *
  26212. * @static
  26213. * @memberOf _
  26214. * @since 0.1.0
  26215. * @category Array
  26216. * @param {...Array} [arrays] The arrays to process.
  26217. * @returns {Array} Returns the new array of grouped elements.
  26218. * @example
  26219. *
  26220. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26221. * // => [['a', 1, true], ['b', 2, false]]
  26222. */
  26223. var zip = baseRest(unzip);
  26224. /**
  26225. * This method is like `_.fromPairs` except that it accepts two arrays,
  26226. * one of property identifiers and one of corresponding values.
  26227. *
  26228. * @static
  26229. * @memberOf _
  26230. * @since 0.4.0
  26231. * @category Array
  26232. * @param {Array} [props=[]] The property identifiers.
  26233. * @param {Array} [values=[]] The property values.
  26234. * @returns {Object} Returns the new object.
  26235. * @example
  26236. *
  26237. * _.zipObject(['a', 'b'], [1, 2]);
  26238. * // => { 'a': 1, 'b': 2 }
  26239. */
  26240. function zipObject(props, values) {
  26241. return baseZipObject(props || [], values || [], assignValue);
  26242. }
  26243. /**
  26244. * This method is like `_.zipObject` except that it supports property paths.
  26245. *
  26246. * @static
  26247. * @memberOf _
  26248. * @since 4.1.0
  26249. * @category Array
  26250. * @param {Array} [props=[]] The property identifiers.
  26251. * @param {Array} [values=[]] The property values.
  26252. * @returns {Object} Returns the new object.
  26253. * @example
  26254. *
  26255. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26256. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26257. */
  26258. function zipObjectDeep(props, values) {
  26259. return baseZipObject(props || [], values || [], baseSet);
  26260. }
  26261. /**
  26262. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26263. * how grouped values should be combined. The iteratee is invoked with the
  26264. * elements of each group: (...group).
  26265. *
  26266. * @static
  26267. * @memberOf _
  26268. * @since 3.8.0
  26269. * @category Array
  26270. * @param {...Array} [arrays] The arrays to process.
  26271. * @param {Function} [iteratee=_.identity] The function to combine
  26272. * grouped values.
  26273. * @returns {Array} Returns the new array of grouped elements.
  26274. * @example
  26275. *
  26276. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26277. * return a + b + c;
  26278. * });
  26279. * // => [111, 222]
  26280. */
  26281. var zipWith = baseRest(function(arrays) {
  26282. var length = arrays.length,
  26283. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26284. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26285. return unzipWith(arrays, iteratee);
  26286. });
  26287. /*------------------------------------------------------------------------*/
  26288. /**
  26289. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26290. * chain sequences enabled. The result of such sequences must be unwrapped
  26291. * with `_#value`.
  26292. *
  26293. * @static
  26294. * @memberOf _
  26295. * @since 1.3.0
  26296. * @category Seq
  26297. * @param {*} value The value to wrap.
  26298. * @returns {Object} Returns the new `lodash` wrapper instance.
  26299. * @example
  26300. *
  26301. * var users = [
  26302. * { 'user': 'barney', 'age': 36 },
  26303. * { 'user': 'fred', 'age': 40 },
  26304. * { 'user': 'pebbles', 'age': 1 }
  26305. * ];
  26306. *
  26307. * var youngest = _
  26308. * .chain(users)
  26309. * .sortBy('age')
  26310. * .map(function(o) {
  26311. * return o.user + ' is ' + o.age;
  26312. * })
  26313. * .head()
  26314. * .value();
  26315. * // => 'pebbles is 1'
  26316. */
  26317. function chain(value) {
  26318. var result = lodash(value);
  26319. result.__chain__ = true;
  26320. return result;
  26321. }
  26322. /**
  26323. * This method invokes `interceptor` and returns `value`. The interceptor
  26324. * is invoked with one argument; (value). The purpose of this method is to
  26325. * "tap into" a method chain sequence in order to modify intermediate results.
  26326. *
  26327. * @static
  26328. * @memberOf _
  26329. * @since 0.1.0
  26330. * @category Seq
  26331. * @param {*} value The value to provide to `interceptor`.
  26332. * @param {Function} interceptor The function to invoke.
  26333. * @returns {*} Returns `value`.
  26334. * @example
  26335. *
  26336. * _([1, 2, 3])
  26337. * .tap(function(array) {
  26338. * // Mutate input array.
  26339. * array.pop();
  26340. * })
  26341. * .reverse()
  26342. * .value();
  26343. * // => [2, 1]
  26344. */
  26345. function tap(value, interceptor) {
  26346. interceptor(value);
  26347. return value;
  26348. }
  26349. /**
  26350. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26351. * The purpose of this method is to "pass thru" values replacing intermediate
  26352. * results in a method chain sequence.
  26353. *
  26354. * @static
  26355. * @memberOf _
  26356. * @since 3.0.0
  26357. * @category Seq
  26358. * @param {*} value The value to provide to `interceptor`.
  26359. * @param {Function} interceptor The function to invoke.
  26360. * @returns {*} Returns the result of `interceptor`.
  26361. * @example
  26362. *
  26363. * _(' abc ')
  26364. * .chain()
  26365. * .trim()
  26366. * .thru(function(value) {
  26367. * return [value];
  26368. * })
  26369. * .value();
  26370. * // => ['abc']
  26371. */
  26372. function thru(value, interceptor) {
  26373. return interceptor(value);
  26374. }
  26375. /**
  26376. * This method is the wrapper version of `_.at`.
  26377. *
  26378. * @name at
  26379. * @memberOf _
  26380. * @since 1.0.0
  26381. * @category Seq
  26382. * @param {...(string|string[])} [paths] The property paths to pick.
  26383. * @returns {Object} Returns the new `lodash` wrapper instance.
  26384. * @example
  26385. *
  26386. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26387. *
  26388. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26389. * // => [3, 4]
  26390. */
  26391. var wrapperAt = flatRest(function(paths) {
  26392. var length = paths.length,
  26393. start = length ? paths[0] : 0,
  26394. value = this.__wrapped__,
  26395. interceptor = function(object) { return baseAt(object, paths); };
  26396. if (length > 1 || this.__actions__.length ||
  26397. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26398. return this.thru(interceptor);
  26399. }
  26400. value = value.slice(start, +start + (length ? 1 : 0));
  26401. value.__actions__.push({
  26402. 'func': thru,
  26403. 'args': [interceptor],
  26404. 'thisArg': undefined
  26405. });
  26406. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26407. if (length && !array.length) {
  26408. array.push(undefined);
  26409. }
  26410. return array;
  26411. });
  26412. });
  26413. /**
  26414. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26415. *
  26416. * @name chain
  26417. * @memberOf _
  26418. * @since 0.1.0
  26419. * @category Seq
  26420. * @returns {Object} Returns the new `lodash` wrapper instance.
  26421. * @example
  26422. *
  26423. * var users = [
  26424. * { 'user': 'barney', 'age': 36 },
  26425. * { 'user': 'fred', 'age': 40 }
  26426. * ];
  26427. *
  26428. * // A sequence without explicit chaining.
  26429. * _(users).head();
  26430. * // => { 'user': 'barney', 'age': 36 }
  26431. *
  26432. * // A sequence with explicit chaining.
  26433. * _(users)
  26434. * .chain()
  26435. * .head()
  26436. * .pick('user')
  26437. * .value();
  26438. * // => { 'user': 'barney' }
  26439. */
  26440. function wrapperChain() {
  26441. return chain(this);
  26442. }
  26443. /**
  26444. * Executes the chain sequence and returns the wrapped result.
  26445. *
  26446. * @name commit
  26447. * @memberOf _
  26448. * @since 3.2.0
  26449. * @category Seq
  26450. * @returns {Object} Returns the new `lodash` wrapper instance.
  26451. * @example
  26452. *
  26453. * var array = [1, 2];
  26454. * var wrapped = _(array).push(3);
  26455. *
  26456. * console.log(array);
  26457. * // => [1, 2]
  26458. *
  26459. * wrapped = wrapped.commit();
  26460. * console.log(array);
  26461. * // => [1, 2, 3]
  26462. *
  26463. * wrapped.last();
  26464. * // => 3
  26465. *
  26466. * console.log(array);
  26467. * // => [1, 2, 3]
  26468. */
  26469. function wrapperCommit() {
  26470. return new LodashWrapper(this.value(), this.__chain__);
  26471. }
  26472. /**
  26473. * Gets the next value on a wrapped object following the
  26474. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26475. *
  26476. * @name next
  26477. * @memberOf _
  26478. * @since 4.0.0
  26479. * @category Seq
  26480. * @returns {Object} Returns the next iterator value.
  26481. * @example
  26482. *
  26483. * var wrapped = _([1, 2]);
  26484. *
  26485. * wrapped.next();
  26486. * // => { 'done': false, 'value': 1 }
  26487. *
  26488. * wrapped.next();
  26489. * // => { 'done': false, 'value': 2 }
  26490. *
  26491. * wrapped.next();
  26492. * // => { 'done': true, 'value': undefined }
  26493. */
  26494. function wrapperNext() {
  26495. if (this.__values__ === undefined) {
  26496. this.__values__ = toArray(this.value());
  26497. }
  26498. var done = this.__index__ >= this.__values__.length,
  26499. value = done ? undefined : this.__values__[this.__index__++];
  26500. return { 'done': done, 'value': value };
  26501. }
  26502. /**
  26503. * Enables the wrapper to be iterable.
  26504. *
  26505. * @name Symbol.iterator
  26506. * @memberOf _
  26507. * @since 4.0.0
  26508. * @category Seq
  26509. * @returns {Object} Returns the wrapper object.
  26510. * @example
  26511. *
  26512. * var wrapped = _([1, 2]);
  26513. *
  26514. * wrapped[Symbol.iterator]() === wrapped;
  26515. * // => true
  26516. *
  26517. * Array.from(wrapped);
  26518. * // => [1, 2]
  26519. */
  26520. function wrapperToIterator() {
  26521. return this;
  26522. }
  26523. /**
  26524. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26525. *
  26526. * @name plant
  26527. * @memberOf _
  26528. * @since 3.2.0
  26529. * @category Seq
  26530. * @param {*} value The value to plant.
  26531. * @returns {Object} Returns the new `lodash` wrapper instance.
  26532. * @example
  26533. *
  26534. * function square(n) {
  26535. * return n * n;
  26536. * }
  26537. *
  26538. * var wrapped = _([1, 2]).map(square);
  26539. * var other = wrapped.plant([3, 4]);
  26540. *
  26541. * other.value();
  26542. * // => [9, 16]
  26543. *
  26544. * wrapped.value();
  26545. * // => [1, 4]
  26546. */
  26547. function wrapperPlant(value) {
  26548. var result,
  26549. parent = this;
  26550. while (parent instanceof baseLodash) {
  26551. var clone = wrapperClone(parent);
  26552. clone.__index__ = 0;
  26553. clone.__values__ = undefined;
  26554. if (result) {
  26555. previous.__wrapped__ = clone;
  26556. } else {
  26557. result = clone;
  26558. }
  26559. var previous = clone;
  26560. parent = parent.__wrapped__;
  26561. }
  26562. previous.__wrapped__ = value;
  26563. return result;
  26564. }
  26565. /**
  26566. * This method is the wrapper version of `_.reverse`.
  26567. *
  26568. * **Note:** This method mutates the wrapped array.
  26569. *
  26570. * @name reverse
  26571. * @memberOf _
  26572. * @since 0.1.0
  26573. * @category Seq
  26574. * @returns {Object} Returns the new `lodash` wrapper instance.
  26575. * @example
  26576. *
  26577. * var array = [1, 2, 3];
  26578. *
  26579. * _(array).reverse().value()
  26580. * // => [3, 2, 1]
  26581. *
  26582. * console.log(array);
  26583. * // => [3, 2, 1]
  26584. */
  26585. function wrapperReverse() {
  26586. var value = this.__wrapped__;
  26587. if (value instanceof LazyWrapper) {
  26588. var wrapped = value;
  26589. if (this.__actions__.length) {
  26590. wrapped = new LazyWrapper(this);
  26591. }
  26592. wrapped = wrapped.reverse();
  26593. wrapped.__actions__.push({
  26594. 'func': thru,
  26595. 'args': [reverse],
  26596. 'thisArg': undefined
  26597. });
  26598. return new LodashWrapper(wrapped, this.__chain__);
  26599. }
  26600. return this.thru(reverse);
  26601. }
  26602. /**
  26603. * Executes the chain sequence to resolve the unwrapped value.
  26604. *
  26605. * @name value
  26606. * @memberOf _
  26607. * @since 0.1.0
  26608. * @alias toJSON, valueOf
  26609. * @category Seq
  26610. * @returns {*} Returns the resolved unwrapped value.
  26611. * @example
  26612. *
  26613. * _([1, 2, 3]).value();
  26614. * // => [1, 2, 3]
  26615. */
  26616. function wrapperValue() {
  26617. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26618. }
  26619. /*------------------------------------------------------------------------*/
  26620. /**
  26621. * Creates an object composed of keys generated from the results of running
  26622. * each element of `collection` thru `iteratee`. The corresponding value of
  26623. * each key is the number of times the key was returned by `iteratee`. The
  26624. * iteratee is invoked with one argument: (value).
  26625. *
  26626. * @static
  26627. * @memberOf _
  26628. * @since 0.5.0
  26629. * @category Collection
  26630. * @param {Array|Object} collection The collection to iterate over.
  26631. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26632. * @returns {Object} Returns the composed aggregate object.
  26633. * @example
  26634. *
  26635. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26636. * // => { '4': 1, '6': 2 }
  26637. *
  26638. * // The `_.property` iteratee shorthand.
  26639. * _.countBy(['one', 'two', 'three'], 'length');
  26640. * // => { '3': 2, '5': 1 }
  26641. */
  26642. var countBy = createAggregator(function(result, value, key) {
  26643. if (hasOwnProperty.call(result, key)) {
  26644. ++result[key];
  26645. } else {
  26646. baseAssignValue(result, key, 1);
  26647. }
  26648. });
  26649. /**
  26650. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26651. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26652. * invoked with three arguments: (value, index|key, collection).
  26653. *
  26654. * **Note:** This method returns `true` for
  26655. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26656. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26657. * elements of empty collections.
  26658. *
  26659. * @static
  26660. * @memberOf _
  26661. * @since 0.1.0
  26662. * @category Collection
  26663. * @param {Array|Object} collection The collection to iterate over.
  26664. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26665. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26666. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26667. * else `false`.
  26668. * @example
  26669. *
  26670. * _.every([true, 1, null, 'yes'], Boolean);
  26671. * // => false
  26672. *
  26673. * var users = [
  26674. * { 'user': 'barney', 'age': 36, 'active': false },
  26675. * { 'user': 'fred', 'age': 40, 'active': false }
  26676. * ];
  26677. *
  26678. * // The `_.matches` iteratee shorthand.
  26679. * _.every(users, { 'user': 'barney', 'active': false });
  26680. * // => false
  26681. *
  26682. * // The `_.matchesProperty` iteratee shorthand.
  26683. * _.every(users, ['active', false]);
  26684. * // => true
  26685. *
  26686. * // The `_.property` iteratee shorthand.
  26687. * _.every(users, 'active');
  26688. * // => false
  26689. */
  26690. function every(collection, predicate, guard) {
  26691. var func = isArray(collection) ? arrayEvery : baseEvery;
  26692. if (guard && isIterateeCall(collection, predicate, guard)) {
  26693. predicate = undefined;
  26694. }
  26695. return func(collection, getIteratee(predicate, 3));
  26696. }
  26697. /**
  26698. * Iterates over elements of `collection`, returning an array of all elements
  26699. * `predicate` returns truthy for. The predicate is invoked with three
  26700. * arguments: (value, index|key, collection).
  26701. *
  26702. * **Note:** Unlike `_.remove`, this method returns a new array.
  26703. *
  26704. * @static
  26705. * @memberOf _
  26706. * @since 0.1.0
  26707. * @category Collection
  26708. * @param {Array|Object} collection The collection to iterate over.
  26709. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26710. * @returns {Array} Returns the new filtered array.
  26711. * @see _.reject
  26712. * @example
  26713. *
  26714. * var users = [
  26715. * { 'user': 'barney', 'age': 36, 'active': true },
  26716. * { 'user': 'fred', 'age': 40, 'active': false }
  26717. * ];
  26718. *
  26719. * _.filter(users, function(o) { return !o.active; });
  26720. * // => objects for ['fred']
  26721. *
  26722. * // The `_.matches` iteratee shorthand.
  26723. * _.filter(users, { 'age': 36, 'active': true });
  26724. * // => objects for ['barney']
  26725. *
  26726. * // The `_.matchesProperty` iteratee shorthand.
  26727. * _.filter(users, ['active', false]);
  26728. * // => objects for ['fred']
  26729. *
  26730. * // The `_.property` iteratee shorthand.
  26731. * _.filter(users, 'active');
  26732. * // => objects for ['barney']
  26733. */
  26734. function filter(collection, predicate) {
  26735. var func = isArray(collection) ? arrayFilter : baseFilter;
  26736. return func(collection, getIteratee(predicate, 3));
  26737. }
  26738. /**
  26739. * Iterates over elements of `collection`, returning the first element
  26740. * `predicate` returns truthy for. The predicate is invoked with three
  26741. * arguments: (value, index|key, collection).
  26742. *
  26743. * @static
  26744. * @memberOf _
  26745. * @since 0.1.0
  26746. * @category Collection
  26747. * @param {Array|Object} collection The collection to inspect.
  26748. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26749. * @param {number} [fromIndex=0] The index to search from.
  26750. * @returns {*} Returns the matched element, else `undefined`.
  26751. * @example
  26752. *
  26753. * var users = [
  26754. * { 'user': 'barney', 'age': 36, 'active': true },
  26755. * { 'user': 'fred', 'age': 40, 'active': false },
  26756. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26757. * ];
  26758. *
  26759. * _.find(users, function(o) { return o.age < 40; });
  26760. * // => object for 'barney'
  26761. *
  26762. * // The `_.matches` iteratee shorthand.
  26763. * _.find(users, { 'age': 1, 'active': true });
  26764. * // => object for 'pebbles'
  26765. *
  26766. * // The `_.matchesProperty` iteratee shorthand.
  26767. * _.find(users, ['active', false]);
  26768. * // => object for 'fred'
  26769. *
  26770. * // The `_.property` iteratee shorthand.
  26771. * _.find(users, 'active');
  26772. * // => object for 'barney'
  26773. */
  26774. var find = createFind(findIndex);
  26775. /**
  26776. * This method is like `_.find` except that it iterates over elements of
  26777. * `collection` from right to left.
  26778. *
  26779. * @static
  26780. * @memberOf _
  26781. * @since 2.0.0
  26782. * @category Collection
  26783. * @param {Array|Object} collection The collection to inspect.
  26784. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26785. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26786. * @returns {*} Returns the matched element, else `undefined`.
  26787. * @example
  26788. *
  26789. * _.findLast([1, 2, 3, 4], function(n) {
  26790. * return n % 2 == 1;
  26791. * });
  26792. * // => 3
  26793. */
  26794. var findLast = createFind(findLastIndex);
  26795. /**
  26796. * Creates a flattened array of values by running each element in `collection`
  26797. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26798. * with three arguments: (value, index|key, collection).
  26799. *
  26800. * @static
  26801. * @memberOf _
  26802. * @since 4.0.0
  26803. * @category Collection
  26804. * @param {Array|Object} collection The collection to iterate over.
  26805. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26806. * @returns {Array} Returns the new flattened array.
  26807. * @example
  26808. *
  26809. * function duplicate(n) {
  26810. * return [n, n];
  26811. * }
  26812. *
  26813. * _.flatMap([1, 2], duplicate);
  26814. * // => [1, 1, 2, 2]
  26815. */
  26816. function flatMap(collection, iteratee) {
  26817. return baseFlatten(map(collection, iteratee), 1);
  26818. }
  26819. /**
  26820. * This method is like `_.flatMap` except that it recursively flattens the
  26821. * mapped results.
  26822. *
  26823. * @static
  26824. * @memberOf _
  26825. * @since 4.7.0
  26826. * @category Collection
  26827. * @param {Array|Object} collection The collection to iterate over.
  26828. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26829. * @returns {Array} Returns the new flattened array.
  26830. * @example
  26831. *
  26832. * function duplicate(n) {
  26833. * return [[[n, n]]];
  26834. * }
  26835. *
  26836. * _.flatMapDeep([1, 2], duplicate);
  26837. * // => [1, 1, 2, 2]
  26838. */
  26839. function flatMapDeep(collection, iteratee) {
  26840. return baseFlatten(map(collection, iteratee), INFINITY);
  26841. }
  26842. /**
  26843. * This method is like `_.flatMap` except that it recursively flattens the
  26844. * mapped results up to `depth` times.
  26845. *
  26846. * @static
  26847. * @memberOf _
  26848. * @since 4.7.0
  26849. * @category Collection
  26850. * @param {Array|Object} collection The collection to iterate over.
  26851. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26852. * @param {number} [depth=1] The maximum recursion depth.
  26853. * @returns {Array} Returns the new flattened array.
  26854. * @example
  26855. *
  26856. * function duplicate(n) {
  26857. * return [[[n, n]]];
  26858. * }
  26859. *
  26860. * _.flatMapDepth([1, 2], duplicate, 2);
  26861. * // => [[1, 1], [2, 2]]
  26862. */
  26863. function flatMapDepth(collection, iteratee, depth) {
  26864. depth = depth === undefined ? 1 : toInteger(depth);
  26865. return baseFlatten(map(collection, iteratee), depth);
  26866. }
  26867. /**
  26868. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26869. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26870. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26871. *
  26872. * **Note:** As with other "Collections" methods, objects with a "length"
  26873. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26874. * or `_.forOwn` for object iteration.
  26875. *
  26876. * @static
  26877. * @memberOf _
  26878. * @since 0.1.0
  26879. * @alias each
  26880. * @category Collection
  26881. * @param {Array|Object} collection The collection to iterate over.
  26882. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26883. * @returns {Array|Object} Returns `collection`.
  26884. * @see _.forEachRight
  26885. * @example
  26886. *
  26887. * _.forEach([1, 2], function(value) {
  26888. * console.log(value);
  26889. * });
  26890. * // => Logs `1` then `2`.
  26891. *
  26892. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26893. * console.log(key);
  26894. * });
  26895. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26896. */
  26897. function forEach(collection, iteratee) {
  26898. var func = isArray(collection) ? arrayEach : baseEach;
  26899. return func(collection, getIteratee(iteratee, 3));
  26900. }
  26901. /**
  26902. * This method is like `_.forEach` except that it iterates over elements of
  26903. * `collection` from right to left.
  26904. *
  26905. * @static
  26906. * @memberOf _
  26907. * @since 2.0.0
  26908. * @alias eachRight
  26909. * @category Collection
  26910. * @param {Array|Object} collection The collection to iterate over.
  26911. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26912. * @returns {Array|Object} Returns `collection`.
  26913. * @see _.forEach
  26914. * @example
  26915. *
  26916. * _.forEachRight([1, 2], function(value) {
  26917. * console.log(value);
  26918. * });
  26919. * // => Logs `2` then `1`.
  26920. */
  26921. function forEachRight(collection, iteratee) {
  26922. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26923. return func(collection, getIteratee(iteratee, 3));
  26924. }
  26925. /**
  26926. * Creates an object composed of keys generated from the results of running
  26927. * each element of `collection` thru `iteratee`. The order of grouped values
  26928. * is determined by the order they occur in `collection`. The corresponding
  26929. * value of each key is an array of elements responsible for generating the
  26930. * key. The iteratee is invoked with one argument: (value).
  26931. *
  26932. * @static
  26933. * @memberOf _
  26934. * @since 0.1.0
  26935. * @category Collection
  26936. * @param {Array|Object} collection The collection to iterate over.
  26937. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26938. * @returns {Object} Returns the composed aggregate object.
  26939. * @example
  26940. *
  26941. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26942. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26943. *
  26944. * // The `_.property` iteratee shorthand.
  26945. * _.groupBy(['one', 'two', 'three'], 'length');
  26946. * // => { '3': ['one', 'two'], '5': ['three'] }
  26947. */
  26948. var groupBy = createAggregator(function(result, value, key) {
  26949. if (hasOwnProperty.call(result, key)) {
  26950. result[key].push(value);
  26951. } else {
  26952. baseAssignValue(result, key, [value]);
  26953. }
  26954. });
  26955. /**
  26956. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26957. * checked for a substring of `value`, otherwise
  26958. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26959. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26960. * the offset from the end of `collection`.
  26961. *
  26962. * @static
  26963. * @memberOf _
  26964. * @since 0.1.0
  26965. * @category Collection
  26966. * @param {Array|Object|string} collection The collection to inspect.
  26967. * @param {*} value The value to search for.
  26968. * @param {number} [fromIndex=0] The index to search from.
  26969. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26970. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26971. * @example
  26972. *
  26973. * _.includes([1, 2, 3], 1);
  26974. * // => true
  26975. *
  26976. * _.includes([1, 2, 3], 1, 2);
  26977. * // => false
  26978. *
  26979. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26980. * // => true
  26981. *
  26982. * _.includes('abcd', 'bc');
  26983. * // => true
  26984. */
  26985. function includes(collection, value, fromIndex, guard) {
  26986. collection = isArrayLike(collection) ? collection : values(collection);
  26987. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26988. var length = collection.length;
  26989. if (fromIndex < 0) {
  26990. fromIndex = nativeMax(length + fromIndex, 0);
  26991. }
  26992. return isString(collection)
  26993. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26994. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26995. }
  26996. /**
  26997. * Invokes the method at `path` of each element in `collection`, returning
  26998. * an array of the results of each invoked method. Any additional arguments
  26999. * are provided to each invoked method. If `path` is a function, it's invoked
  27000. * for, and `this` bound to, each element in `collection`.
  27001. *
  27002. * @static
  27003. * @memberOf _
  27004. * @since 4.0.0
  27005. * @category Collection
  27006. * @param {Array|Object} collection The collection to iterate over.
  27007. * @param {Array|Function|string} path The path of the method to invoke or
  27008. * the function invoked per iteration.
  27009. * @param {...*} [args] The arguments to invoke each method with.
  27010. * @returns {Array} Returns the array of results.
  27011. * @example
  27012. *
  27013. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27014. * // => [[1, 5, 7], [1, 2, 3]]
  27015. *
  27016. * _.invokeMap([123, 456], String.prototype.split, '');
  27017. * // => [['1', '2', '3'], ['4', '5', '6']]
  27018. */
  27019. var invokeMap = baseRest(function(collection, path, args) {
  27020. var index = -1,
  27021. isFunc = typeof path == 'function',
  27022. result = isArrayLike(collection) ? Array(collection.length) : [];
  27023. baseEach(collection, function(value) {
  27024. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27025. });
  27026. return result;
  27027. });
  27028. /**
  27029. * Creates an object composed of keys generated from the results of running
  27030. * each element of `collection` thru `iteratee`. The corresponding value of
  27031. * each key is the last element responsible for generating the key. The
  27032. * iteratee is invoked with one argument: (value).
  27033. *
  27034. * @static
  27035. * @memberOf _
  27036. * @since 4.0.0
  27037. * @category Collection
  27038. * @param {Array|Object} collection The collection to iterate over.
  27039. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27040. * @returns {Object} Returns the composed aggregate object.
  27041. * @example
  27042. *
  27043. * var array = [
  27044. * { 'dir': 'left', 'code': 97 },
  27045. * { 'dir': 'right', 'code': 100 }
  27046. * ];
  27047. *
  27048. * _.keyBy(array, function(o) {
  27049. * return String.fromCharCode(o.code);
  27050. * });
  27051. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27052. *
  27053. * _.keyBy(array, 'dir');
  27054. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27055. */
  27056. var keyBy = createAggregator(function(result, value, key) {
  27057. baseAssignValue(result, key, value);
  27058. });
  27059. /**
  27060. * Creates an array of values by running each element in `collection` thru
  27061. * `iteratee`. The iteratee is invoked with three arguments:
  27062. * (value, index|key, collection).
  27063. *
  27064. * Many lodash methods are guarded to work as iteratees for methods like
  27065. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27066. *
  27067. * The guarded methods are:
  27068. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27069. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27070. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27071. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27072. *
  27073. * @static
  27074. * @memberOf _
  27075. * @since 0.1.0
  27076. * @category Collection
  27077. * @param {Array|Object} collection The collection to iterate over.
  27078. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27079. * @returns {Array} Returns the new mapped array.
  27080. * @example
  27081. *
  27082. * function square(n) {
  27083. * return n * n;
  27084. * }
  27085. *
  27086. * _.map([4, 8], square);
  27087. * // => [16, 64]
  27088. *
  27089. * _.map({ 'a': 4, 'b': 8 }, square);
  27090. * // => [16, 64] (iteration order is not guaranteed)
  27091. *
  27092. * var users = [
  27093. * { 'user': 'barney' },
  27094. * { 'user': 'fred' }
  27095. * ];
  27096. *
  27097. * // The `_.property` iteratee shorthand.
  27098. * _.map(users, 'user');
  27099. * // => ['barney', 'fred']
  27100. */
  27101. function map(collection, iteratee) {
  27102. var func = isArray(collection) ? arrayMap : baseMap;
  27103. return func(collection, getIteratee(iteratee, 3));
  27104. }
  27105. /**
  27106. * This method is like `_.sortBy` except that it allows specifying the sort
  27107. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27108. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27109. * descending or "asc" for ascending sort order of corresponding values.
  27110. *
  27111. * @static
  27112. * @memberOf _
  27113. * @since 4.0.0
  27114. * @category Collection
  27115. * @param {Array|Object} collection The collection to iterate over.
  27116. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27117. * The iteratees to sort by.
  27118. * @param {string[]} [orders] The sort orders of `iteratees`.
  27119. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27120. * @returns {Array} Returns the new sorted array.
  27121. * @example
  27122. *
  27123. * var users = [
  27124. * { 'user': 'fred', 'age': 48 },
  27125. * { 'user': 'barney', 'age': 34 },
  27126. * { 'user': 'fred', 'age': 40 },
  27127. * { 'user': 'barney', 'age': 36 }
  27128. * ];
  27129. *
  27130. * // Sort by `user` in ascending order and by `age` in descending order.
  27131. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27132. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27133. */
  27134. function orderBy(collection, iteratees, orders, guard) {
  27135. if (collection == null) {
  27136. return [];
  27137. }
  27138. if (!isArray(iteratees)) {
  27139. iteratees = iteratees == null ? [] : [iteratees];
  27140. }
  27141. orders = guard ? undefined : orders;
  27142. if (!isArray(orders)) {
  27143. orders = orders == null ? [] : [orders];
  27144. }
  27145. return baseOrderBy(collection, iteratees, orders);
  27146. }
  27147. /**
  27148. * Creates an array of elements split into two groups, the first of which
  27149. * contains elements `predicate` returns truthy for, the second of which
  27150. * contains elements `predicate` returns falsey for. The predicate is
  27151. * invoked with one argument: (value).
  27152. *
  27153. * @static
  27154. * @memberOf _
  27155. * @since 3.0.0
  27156. * @category Collection
  27157. * @param {Array|Object} collection The collection to iterate over.
  27158. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27159. * @returns {Array} Returns the array of grouped elements.
  27160. * @example
  27161. *
  27162. * var users = [
  27163. * { 'user': 'barney', 'age': 36, 'active': false },
  27164. * { 'user': 'fred', 'age': 40, 'active': true },
  27165. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27166. * ];
  27167. *
  27168. * _.partition(users, function(o) { return o.active; });
  27169. * // => objects for [['fred'], ['barney', 'pebbles']]
  27170. *
  27171. * // The `_.matches` iteratee shorthand.
  27172. * _.partition(users, { 'age': 1, 'active': false });
  27173. * // => objects for [['pebbles'], ['barney', 'fred']]
  27174. *
  27175. * // The `_.matchesProperty` iteratee shorthand.
  27176. * _.partition(users, ['active', false]);
  27177. * // => objects for [['barney', 'pebbles'], ['fred']]
  27178. *
  27179. * // The `_.property` iteratee shorthand.
  27180. * _.partition(users, 'active');
  27181. * // => objects for [['fred'], ['barney', 'pebbles']]
  27182. */
  27183. var partition = createAggregator(function(result, value, key) {
  27184. result[key ? 0 : 1].push(value);
  27185. }, function() { return [[], []]; });
  27186. /**
  27187. * Reduces `collection` to a value which is the accumulated result of running
  27188. * each element in `collection` thru `iteratee`, where each successive
  27189. * invocation is supplied the return value of the previous. If `accumulator`
  27190. * is not given, the first element of `collection` is used as the initial
  27191. * value. The iteratee is invoked with four arguments:
  27192. * (accumulator, value, index|key, collection).
  27193. *
  27194. * Many lodash methods are guarded to work as iteratees for methods like
  27195. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27196. *
  27197. * The guarded methods are:
  27198. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27199. * and `sortBy`
  27200. *
  27201. * @static
  27202. * @memberOf _
  27203. * @since 0.1.0
  27204. * @category Collection
  27205. * @param {Array|Object} collection The collection to iterate over.
  27206. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27207. * @param {*} [accumulator] The initial value.
  27208. * @returns {*} Returns the accumulated value.
  27209. * @see _.reduceRight
  27210. * @example
  27211. *
  27212. * _.reduce([1, 2], function(sum, n) {
  27213. * return sum + n;
  27214. * }, 0);
  27215. * // => 3
  27216. *
  27217. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27218. * (result[value] || (result[value] = [])).push(key);
  27219. * return result;
  27220. * }, {});
  27221. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27222. */
  27223. function reduce(collection, iteratee, accumulator) {
  27224. var func = isArray(collection) ? arrayReduce : baseReduce,
  27225. initAccum = arguments.length < 3;
  27226. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27227. }
  27228. /**
  27229. * This method is like `_.reduce` except that it iterates over elements of
  27230. * `collection` from right to left.
  27231. *
  27232. * @static
  27233. * @memberOf _
  27234. * @since 0.1.0
  27235. * @category Collection
  27236. * @param {Array|Object} collection The collection to iterate over.
  27237. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27238. * @param {*} [accumulator] The initial value.
  27239. * @returns {*} Returns the accumulated value.
  27240. * @see _.reduce
  27241. * @example
  27242. *
  27243. * var array = [[0, 1], [2, 3], [4, 5]];
  27244. *
  27245. * _.reduceRight(array, function(flattened, other) {
  27246. * return flattened.concat(other);
  27247. * }, []);
  27248. * // => [4, 5, 2, 3, 0, 1]
  27249. */
  27250. function reduceRight(collection, iteratee, accumulator) {
  27251. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27252. initAccum = arguments.length < 3;
  27253. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27254. }
  27255. /**
  27256. * The opposite of `_.filter`; this method returns the elements of `collection`
  27257. * that `predicate` does **not** return truthy for.
  27258. *
  27259. * @static
  27260. * @memberOf _
  27261. * @since 0.1.0
  27262. * @category Collection
  27263. * @param {Array|Object} collection The collection to iterate over.
  27264. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27265. * @returns {Array} Returns the new filtered array.
  27266. * @see _.filter
  27267. * @example
  27268. *
  27269. * var users = [
  27270. * { 'user': 'barney', 'age': 36, 'active': false },
  27271. * { 'user': 'fred', 'age': 40, 'active': true }
  27272. * ];
  27273. *
  27274. * _.reject(users, function(o) { return !o.active; });
  27275. * // => objects for ['fred']
  27276. *
  27277. * // The `_.matches` iteratee shorthand.
  27278. * _.reject(users, { 'age': 40, 'active': true });
  27279. * // => objects for ['barney']
  27280. *
  27281. * // The `_.matchesProperty` iteratee shorthand.
  27282. * _.reject(users, ['active', false]);
  27283. * // => objects for ['fred']
  27284. *
  27285. * // The `_.property` iteratee shorthand.
  27286. * _.reject(users, 'active');
  27287. * // => objects for ['barney']
  27288. */
  27289. function reject(collection, predicate) {
  27290. var func = isArray(collection) ? arrayFilter : baseFilter;
  27291. return func(collection, negate(getIteratee(predicate, 3)));
  27292. }
  27293. /**
  27294. * Gets a random element from `collection`.
  27295. *
  27296. * @static
  27297. * @memberOf _
  27298. * @since 2.0.0
  27299. * @category Collection
  27300. * @param {Array|Object} collection The collection to sample.
  27301. * @returns {*} Returns the random element.
  27302. * @example
  27303. *
  27304. * _.sample([1, 2, 3, 4]);
  27305. * // => 2
  27306. */
  27307. function sample(collection) {
  27308. var func = isArray(collection) ? arraySample : baseSample;
  27309. return func(collection);
  27310. }
  27311. /**
  27312. * Gets `n` random elements at unique keys from `collection` up to the
  27313. * size of `collection`.
  27314. *
  27315. * @static
  27316. * @memberOf _
  27317. * @since 4.0.0
  27318. * @category Collection
  27319. * @param {Array|Object} collection The collection to sample.
  27320. * @param {number} [n=1] The number of elements to sample.
  27321. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27322. * @returns {Array} Returns the random elements.
  27323. * @example
  27324. *
  27325. * _.sampleSize([1, 2, 3], 2);
  27326. * // => [3, 1]
  27327. *
  27328. * _.sampleSize([1, 2, 3], 4);
  27329. * // => [2, 3, 1]
  27330. */
  27331. function sampleSize(collection, n, guard) {
  27332. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27333. n = 1;
  27334. } else {
  27335. n = toInteger(n);
  27336. }
  27337. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27338. return func(collection, n);
  27339. }
  27340. /**
  27341. * Creates an array of shuffled values, using a version of the
  27342. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27343. *
  27344. * @static
  27345. * @memberOf _
  27346. * @since 0.1.0
  27347. * @category Collection
  27348. * @param {Array|Object} collection The collection to shuffle.
  27349. * @returns {Array} Returns the new shuffled array.
  27350. * @example
  27351. *
  27352. * _.shuffle([1, 2, 3, 4]);
  27353. * // => [4, 1, 3, 2]
  27354. */
  27355. function shuffle(collection) {
  27356. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27357. return func(collection);
  27358. }
  27359. /**
  27360. * Gets the size of `collection` by returning its length for array-like
  27361. * values or the number of own enumerable string keyed properties for objects.
  27362. *
  27363. * @static
  27364. * @memberOf _
  27365. * @since 0.1.0
  27366. * @category Collection
  27367. * @param {Array|Object|string} collection The collection to inspect.
  27368. * @returns {number} Returns the collection size.
  27369. * @example
  27370. *
  27371. * _.size([1, 2, 3]);
  27372. * // => 3
  27373. *
  27374. * _.size({ 'a': 1, 'b': 2 });
  27375. * // => 2
  27376. *
  27377. * _.size('pebbles');
  27378. * // => 7
  27379. */
  27380. function size(collection) {
  27381. if (collection == null) {
  27382. return 0;
  27383. }
  27384. if (isArrayLike(collection)) {
  27385. return isString(collection) ? stringSize(collection) : collection.length;
  27386. }
  27387. var tag = getTag(collection);
  27388. if (tag == mapTag || tag == setTag) {
  27389. return collection.size;
  27390. }
  27391. return baseKeys(collection).length;
  27392. }
  27393. /**
  27394. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27395. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27396. * invoked with three arguments: (value, index|key, collection).
  27397. *
  27398. * @static
  27399. * @memberOf _
  27400. * @since 0.1.0
  27401. * @category Collection
  27402. * @param {Array|Object} collection The collection to iterate over.
  27403. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27404. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27405. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27406. * else `false`.
  27407. * @example
  27408. *
  27409. * _.some([null, 0, 'yes', false], Boolean);
  27410. * // => true
  27411. *
  27412. * var users = [
  27413. * { 'user': 'barney', 'active': true },
  27414. * { 'user': 'fred', 'active': false }
  27415. * ];
  27416. *
  27417. * // The `_.matches` iteratee shorthand.
  27418. * _.some(users, { 'user': 'barney', 'active': false });
  27419. * // => false
  27420. *
  27421. * // The `_.matchesProperty` iteratee shorthand.
  27422. * _.some(users, ['active', false]);
  27423. * // => true
  27424. *
  27425. * // The `_.property` iteratee shorthand.
  27426. * _.some(users, 'active');
  27427. * // => true
  27428. */
  27429. function some(collection, predicate, guard) {
  27430. var func = isArray(collection) ? arraySome : baseSome;
  27431. if (guard && isIterateeCall(collection, predicate, guard)) {
  27432. predicate = undefined;
  27433. }
  27434. return func(collection, getIteratee(predicate, 3));
  27435. }
  27436. /**
  27437. * Creates an array of elements, sorted in ascending order by the results of
  27438. * running each element in a collection thru each iteratee. This method
  27439. * performs a stable sort, that is, it preserves the original sort order of
  27440. * equal elements. The iteratees are invoked with one argument: (value).
  27441. *
  27442. * @static
  27443. * @memberOf _
  27444. * @since 0.1.0
  27445. * @category Collection
  27446. * @param {Array|Object} collection The collection to iterate over.
  27447. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27448. * The iteratees to sort by.
  27449. * @returns {Array} Returns the new sorted array.
  27450. * @example
  27451. *
  27452. * var users = [
  27453. * { 'user': 'fred', 'age': 48 },
  27454. * { 'user': 'barney', 'age': 36 },
  27455. * { 'user': 'fred', 'age': 40 },
  27456. * { 'user': 'barney', 'age': 34 }
  27457. * ];
  27458. *
  27459. * _.sortBy(users, [function(o) { return o.user; }]);
  27460. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27461. *
  27462. * _.sortBy(users, ['user', 'age']);
  27463. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27464. */
  27465. var sortBy = baseRest(function(collection, iteratees) {
  27466. if (collection == null) {
  27467. return [];
  27468. }
  27469. var length = iteratees.length;
  27470. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27471. iteratees = [];
  27472. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27473. iteratees = [iteratees[0]];
  27474. }
  27475. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27476. });
  27477. /*------------------------------------------------------------------------*/
  27478. /**
  27479. * Gets the timestamp of the number of milliseconds that have elapsed since
  27480. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27481. *
  27482. * @static
  27483. * @memberOf _
  27484. * @since 2.4.0
  27485. * @category Date
  27486. * @returns {number} Returns the timestamp.
  27487. * @example
  27488. *
  27489. * _.defer(function(stamp) {
  27490. * console.log(_.now() - stamp);
  27491. * }, _.now());
  27492. * // => Logs the number of milliseconds it took for the deferred invocation.
  27493. */
  27494. var now = ctxNow || function() {
  27495. return root.Date.now();
  27496. };
  27497. /*------------------------------------------------------------------------*/
  27498. /**
  27499. * The opposite of `_.before`; this method creates a function that invokes
  27500. * `func` once it's called `n` or more times.
  27501. *
  27502. * @static
  27503. * @memberOf _
  27504. * @since 0.1.0
  27505. * @category Function
  27506. * @param {number} n The number of calls before `func` is invoked.
  27507. * @param {Function} func The function to restrict.
  27508. * @returns {Function} Returns the new restricted function.
  27509. * @example
  27510. *
  27511. * var saves = ['profile', 'settings'];
  27512. *
  27513. * var done = _.after(saves.length, function() {
  27514. * console.log('done saving!');
  27515. * });
  27516. *
  27517. * _.forEach(saves, function(type) {
  27518. * asyncSave({ 'type': type, 'complete': done });
  27519. * });
  27520. * // => Logs 'done saving!' after the two async saves have completed.
  27521. */
  27522. function after(n, func) {
  27523. if (typeof func != 'function') {
  27524. throw new TypeError(FUNC_ERROR_TEXT);
  27525. }
  27526. n = toInteger(n);
  27527. return function() {
  27528. if (--n < 1) {
  27529. return func.apply(this, arguments);
  27530. }
  27531. };
  27532. }
  27533. /**
  27534. * Creates a function that invokes `func`, with up to `n` arguments,
  27535. * ignoring any additional arguments.
  27536. *
  27537. * @static
  27538. * @memberOf _
  27539. * @since 3.0.0
  27540. * @category Function
  27541. * @param {Function} func The function to cap arguments for.
  27542. * @param {number} [n=func.length] The arity cap.
  27543. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27544. * @returns {Function} Returns the new capped function.
  27545. * @example
  27546. *
  27547. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27548. * // => [6, 8, 10]
  27549. */
  27550. function ary(func, n, guard) {
  27551. n = guard ? undefined : n;
  27552. n = (func && n == null) ? func.length : n;
  27553. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27554. }
  27555. /**
  27556. * Creates a function that invokes `func`, with the `this` binding and arguments
  27557. * of the created function, while it's called less than `n` times. Subsequent
  27558. * calls to the created function return the result of the last `func` invocation.
  27559. *
  27560. * @static
  27561. * @memberOf _
  27562. * @since 3.0.0
  27563. * @category Function
  27564. * @param {number} n The number of calls at which `func` is no longer invoked.
  27565. * @param {Function} func The function to restrict.
  27566. * @returns {Function} Returns the new restricted function.
  27567. * @example
  27568. *
  27569. * jQuery(element).on('click', _.before(5, addContactToList));
  27570. * // => Allows adding up to 4 contacts to the list.
  27571. */
  27572. function before(n, func) {
  27573. var result;
  27574. if (typeof func != 'function') {
  27575. throw new TypeError(FUNC_ERROR_TEXT);
  27576. }
  27577. n = toInteger(n);
  27578. return function() {
  27579. if (--n > 0) {
  27580. result = func.apply(this, arguments);
  27581. }
  27582. if (n <= 1) {
  27583. func = undefined;
  27584. }
  27585. return result;
  27586. };
  27587. }
  27588. /**
  27589. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27590. * and `partials` prepended to the arguments it receives.
  27591. *
  27592. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27593. * may be used as a placeholder for partially applied arguments.
  27594. *
  27595. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27596. * property of bound functions.
  27597. *
  27598. * @static
  27599. * @memberOf _
  27600. * @since 0.1.0
  27601. * @category Function
  27602. * @param {Function} func The function to bind.
  27603. * @param {*} thisArg The `this` binding of `func`.
  27604. * @param {...*} [partials] The arguments to be partially applied.
  27605. * @returns {Function} Returns the new bound function.
  27606. * @example
  27607. *
  27608. * function greet(greeting, punctuation) {
  27609. * return greeting + ' ' + this.user + punctuation;
  27610. * }
  27611. *
  27612. * var object = { 'user': 'fred' };
  27613. *
  27614. * var bound = _.bind(greet, object, 'hi');
  27615. * bound('!');
  27616. * // => 'hi fred!'
  27617. *
  27618. * // Bound with placeholders.
  27619. * var bound = _.bind(greet, object, _, '!');
  27620. * bound('hi');
  27621. * // => 'hi fred!'
  27622. */
  27623. var bind = baseRest(function(func, thisArg, partials) {
  27624. var bitmask = WRAP_BIND_FLAG;
  27625. if (partials.length) {
  27626. var holders = replaceHolders(partials, getHolder(bind));
  27627. bitmask |= WRAP_PARTIAL_FLAG;
  27628. }
  27629. return createWrap(func, bitmask, thisArg, partials, holders);
  27630. });
  27631. /**
  27632. * Creates a function that invokes the method at `object[key]` with `partials`
  27633. * prepended to the arguments it receives.
  27634. *
  27635. * This method differs from `_.bind` by allowing bound functions to reference
  27636. * methods that may be redefined or don't yet exist. See
  27637. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27638. * for more details.
  27639. *
  27640. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27641. * builds, may be used as a placeholder for partially applied arguments.
  27642. *
  27643. * @static
  27644. * @memberOf _
  27645. * @since 0.10.0
  27646. * @category Function
  27647. * @param {Object} object The object to invoke the method on.
  27648. * @param {string} key The key of the method.
  27649. * @param {...*} [partials] The arguments to be partially applied.
  27650. * @returns {Function} Returns the new bound function.
  27651. * @example
  27652. *
  27653. * var object = {
  27654. * 'user': 'fred',
  27655. * 'greet': function(greeting, punctuation) {
  27656. * return greeting + ' ' + this.user + punctuation;
  27657. * }
  27658. * };
  27659. *
  27660. * var bound = _.bindKey(object, 'greet', 'hi');
  27661. * bound('!');
  27662. * // => 'hi fred!'
  27663. *
  27664. * object.greet = function(greeting, punctuation) {
  27665. * return greeting + 'ya ' + this.user + punctuation;
  27666. * };
  27667. *
  27668. * bound('!');
  27669. * // => 'hiya fred!'
  27670. *
  27671. * // Bound with placeholders.
  27672. * var bound = _.bindKey(object, 'greet', _, '!');
  27673. * bound('hi');
  27674. * // => 'hiya fred!'
  27675. */
  27676. var bindKey = baseRest(function(object, key, partials) {
  27677. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27678. if (partials.length) {
  27679. var holders = replaceHolders(partials, getHolder(bindKey));
  27680. bitmask |= WRAP_PARTIAL_FLAG;
  27681. }
  27682. return createWrap(key, bitmask, object, partials, holders);
  27683. });
  27684. /**
  27685. * Creates a function that accepts arguments of `func` and either invokes
  27686. * `func` returning its result, if at least `arity` number of arguments have
  27687. * been provided, or returns a function that accepts the remaining `func`
  27688. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27689. * is not sufficient.
  27690. *
  27691. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27692. * may be used as a placeholder for provided arguments.
  27693. *
  27694. * **Note:** This method doesn't set the "length" property of curried functions.
  27695. *
  27696. * @static
  27697. * @memberOf _
  27698. * @since 2.0.0
  27699. * @category Function
  27700. * @param {Function} func The function to curry.
  27701. * @param {number} [arity=func.length] The arity of `func`.
  27702. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27703. * @returns {Function} Returns the new curried function.
  27704. * @example
  27705. *
  27706. * var abc = function(a, b, c) {
  27707. * return [a, b, c];
  27708. * };
  27709. *
  27710. * var curried = _.curry(abc);
  27711. *
  27712. * curried(1)(2)(3);
  27713. * // => [1, 2, 3]
  27714. *
  27715. * curried(1, 2)(3);
  27716. * // => [1, 2, 3]
  27717. *
  27718. * curried(1, 2, 3);
  27719. * // => [1, 2, 3]
  27720. *
  27721. * // Curried with placeholders.
  27722. * curried(1)(_, 3)(2);
  27723. * // => [1, 2, 3]
  27724. */
  27725. function curry(func, arity, guard) {
  27726. arity = guard ? undefined : arity;
  27727. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27728. result.placeholder = curry.placeholder;
  27729. return result;
  27730. }
  27731. /**
  27732. * This method is like `_.curry` except that arguments are applied to `func`
  27733. * in the manner of `_.partialRight` instead of `_.partial`.
  27734. *
  27735. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27736. * builds, may be used as a placeholder for provided arguments.
  27737. *
  27738. * **Note:** This method doesn't set the "length" property of curried functions.
  27739. *
  27740. * @static
  27741. * @memberOf _
  27742. * @since 3.0.0
  27743. * @category Function
  27744. * @param {Function} func The function to curry.
  27745. * @param {number} [arity=func.length] The arity of `func`.
  27746. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27747. * @returns {Function} Returns the new curried function.
  27748. * @example
  27749. *
  27750. * var abc = function(a, b, c) {
  27751. * return [a, b, c];
  27752. * };
  27753. *
  27754. * var curried = _.curryRight(abc);
  27755. *
  27756. * curried(3)(2)(1);
  27757. * // => [1, 2, 3]
  27758. *
  27759. * curried(2, 3)(1);
  27760. * // => [1, 2, 3]
  27761. *
  27762. * curried(1, 2, 3);
  27763. * // => [1, 2, 3]
  27764. *
  27765. * // Curried with placeholders.
  27766. * curried(3)(1, _)(2);
  27767. * // => [1, 2, 3]
  27768. */
  27769. function curryRight(func, arity, guard) {
  27770. arity = guard ? undefined : arity;
  27771. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27772. result.placeholder = curryRight.placeholder;
  27773. return result;
  27774. }
  27775. /**
  27776. * Creates a debounced function that delays invoking `func` until after `wait`
  27777. * milliseconds have elapsed since the last time the debounced function was
  27778. * invoked. The debounced function comes with a `cancel` method to cancel
  27779. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27780. * Provide `options` to indicate whether `func` should be invoked on the
  27781. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27782. * with the last arguments provided to the debounced function. Subsequent
  27783. * calls to the debounced function return the result of the last `func`
  27784. * invocation.
  27785. *
  27786. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27787. * invoked on the trailing edge of the timeout only if the debounced function
  27788. * is invoked more than once during the `wait` timeout.
  27789. *
  27790. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27791. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27792. *
  27793. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27794. * for details over the differences between `_.debounce` and `_.throttle`.
  27795. *
  27796. * @static
  27797. * @memberOf _
  27798. * @since 0.1.0
  27799. * @category Function
  27800. * @param {Function} func The function to debounce.
  27801. * @param {number} [wait=0] The number of milliseconds to delay.
  27802. * @param {Object} [options={}] The options object.
  27803. * @param {boolean} [options.leading=false]
  27804. * Specify invoking on the leading edge of the timeout.
  27805. * @param {number} [options.maxWait]
  27806. * The maximum time `func` is allowed to be delayed before it's invoked.
  27807. * @param {boolean} [options.trailing=true]
  27808. * Specify invoking on the trailing edge of the timeout.
  27809. * @returns {Function} Returns the new debounced function.
  27810. * @example
  27811. *
  27812. * // Avoid costly calculations while the window size is in flux.
  27813. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27814. *
  27815. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27816. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27817. * 'leading': true,
  27818. * 'trailing': false
  27819. * }));
  27820. *
  27821. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27822. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27823. * var source = new EventSource('/stream');
  27824. * jQuery(source).on('message', debounced);
  27825. *
  27826. * // Cancel the trailing debounced invocation.
  27827. * jQuery(window).on('popstate', debounced.cancel);
  27828. */
  27829. function debounce(func, wait, options) {
  27830. var lastArgs,
  27831. lastThis,
  27832. maxWait,
  27833. result,
  27834. timerId,
  27835. lastCallTime,
  27836. lastInvokeTime = 0,
  27837. leading = false,
  27838. maxing = false,
  27839. trailing = true;
  27840. if (typeof func != 'function') {
  27841. throw new TypeError(FUNC_ERROR_TEXT);
  27842. }
  27843. wait = toNumber(wait) || 0;
  27844. if (isObject(options)) {
  27845. leading = !!options.leading;
  27846. maxing = 'maxWait' in options;
  27847. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27848. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27849. }
  27850. function invokeFunc(time) {
  27851. var args = lastArgs,
  27852. thisArg = lastThis;
  27853. lastArgs = lastThis = undefined;
  27854. lastInvokeTime = time;
  27855. result = func.apply(thisArg, args);
  27856. return result;
  27857. }
  27858. function leadingEdge(time) {
  27859. // Reset any `maxWait` timer.
  27860. lastInvokeTime = time;
  27861. // Start the timer for the trailing edge.
  27862. timerId = setTimeout(timerExpired, wait);
  27863. // Invoke the leading edge.
  27864. return leading ? invokeFunc(time) : result;
  27865. }
  27866. function remainingWait(time) {
  27867. var timeSinceLastCall = time - lastCallTime,
  27868. timeSinceLastInvoke = time - lastInvokeTime,
  27869. timeWaiting = wait - timeSinceLastCall;
  27870. return maxing
  27871. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27872. : timeWaiting;
  27873. }
  27874. function shouldInvoke(time) {
  27875. var timeSinceLastCall = time - lastCallTime,
  27876. timeSinceLastInvoke = time - lastInvokeTime;
  27877. // Either this is the first call, activity has stopped and we're at the
  27878. // trailing edge, the system time has gone backwards and we're treating
  27879. // it as the trailing edge, or we've hit the `maxWait` limit.
  27880. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27881. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27882. }
  27883. function timerExpired() {
  27884. var time = now();
  27885. if (shouldInvoke(time)) {
  27886. return trailingEdge(time);
  27887. }
  27888. // Restart the timer.
  27889. timerId = setTimeout(timerExpired, remainingWait(time));
  27890. }
  27891. function trailingEdge(time) {
  27892. timerId = undefined;
  27893. // Only invoke if we have `lastArgs` which means `func` has been
  27894. // debounced at least once.
  27895. if (trailing && lastArgs) {
  27896. return invokeFunc(time);
  27897. }
  27898. lastArgs = lastThis = undefined;
  27899. return result;
  27900. }
  27901. function cancel() {
  27902. if (timerId !== undefined) {
  27903. clearTimeout(timerId);
  27904. }
  27905. lastInvokeTime = 0;
  27906. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27907. }
  27908. function flush() {
  27909. return timerId === undefined ? result : trailingEdge(now());
  27910. }
  27911. function debounced() {
  27912. var time = now(),
  27913. isInvoking = shouldInvoke(time);
  27914. lastArgs = arguments;
  27915. lastThis = this;
  27916. lastCallTime = time;
  27917. if (isInvoking) {
  27918. if (timerId === undefined) {
  27919. return leadingEdge(lastCallTime);
  27920. }
  27921. if (maxing) {
  27922. // Handle invocations in a tight loop.
  27923. clearTimeout(timerId);
  27924. timerId = setTimeout(timerExpired, wait);
  27925. return invokeFunc(lastCallTime);
  27926. }
  27927. }
  27928. if (timerId === undefined) {
  27929. timerId = setTimeout(timerExpired, wait);
  27930. }
  27931. return result;
  27932. }
  27933. debounced.cancel = cancel;
  27934. debounced.flush = flush;
  27935. return debounced;
  27936. }
  27937. /**
  27938. * Defers invoking the `func` until the current call stack has cleared. Any
  27939. * additional arguments are provided to `func` when it's invoked.
  27940. *
  27941. * @static
  27942. * @memberOf _
  27943. * @since 0.1.0
  27944. * @category Function
  27945. * @param {Function} func The function to defer.
  27946. * @param {...*} [args] The arguments to invoke `func` with.
  27947. * @returns {number} Returns the timer id.
  27948. * @example
  27949. *
  27950. * _.defer(function(text) {
  27951. * console.log(text);
  27952. * }, 'deferred');
  27953. * // => Logs 'deferred' after one millisecond.
  27954. */
  27955. var defer = baseRest(function(func, args) {
  27956. return baseDelay(func, 1, args);
  27957. });
  27958. /**
  27959. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27960. * provided to `func` when it's invoked.
  27961. *
  27962. * @static
  27963. * @memberOf _
  27964. * @since 0.1.0
  27965. * @category Function
  27966. * @param {Function} func The function to delay.
  27967. * @param {number} wait The number of milliseconds to delay invocation.
  27968. * @param {...*} [args] The arguments to invoke `func` with.
  27969. * @returns {number} Returns the timer id.
  27970. * @example
  27971. *
  27972. * _.delay(function(text) {
  27973. * console.log(text);
  27974. * }, 1000, 'later');
  27975. * // => Logs 'later' after one second.
  27976. */
  27977. var delay = baseRest(function(func, wait, args) {
  27978. return baseDelay(func, toNumber(wait) || 0, args);
  27979. });
  27980. /**
  27981. * Creates a function that invokes `func` with arguments reversed.
  27982. *
  27983. * @static
  27984. * @memberOf _
  27985. * @since 4.0.0
  27986. * @category Function
  27987. * @param {Function} func The function to flip arguments for.
  27988. * @returns {Function} Returns the new flipped function.
  27989. * @example
  27990. *
  27991. * var flipped = _.flip(function() {
  27992. * return _.toArray(arguments);
  27993. * });
  27994. *
  27995. * flipped('a', 'b', 'c', 'd');
  27996. * // => ['d', 'c', 'b', 'a']
  27997. */
  27998. function flip(func) {
  27999. return createWrap(func, WRAP_FLIP_FLAG);
  28000. }
  28001. /**
  28002. * Creates a function that memoizes the result of `func`. If `resolver` is
  28003. * provided, it determines the cache key for storing the result based on the
  28004. * arguments provided to the memoized function. By default, the first argument
  28005. * provided to the memoized function is used as the map cache key. The `func`
  28006. * is invoked with the `this` binding of the memoized function.
  28007. *
  28008. * **Note:** The cache is exposed as the `cache` property on the memoized
  28009. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28010. * constructor with one whose instances implement the
  28011. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28012. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28013. *
  28014. * @static
  28015. * @memberOf _
  28016. * @since 0.1.0
  28017. * @category Function
  28018. * @param {Function} func The function to have its output memoized.
  28019. * @param {Function} [resolver] The function to resolve the cache key.
  28020. * @returns {Function} Returns the new memoized function.
  28021. * @example
  28022. *
  28023. * var object = { 'a': 1, 'b': 2 };
  28024. * var other = { 'c': 3, 'd': 4 };
  28025. *
  28026. * var values = _.memoize(_.values);
  28027. * values(object);
  28028. * // => [1, 2]
  28029. *
  28030. * values(other);
  28031. * // => [3, 4]
  28032. *
  28033. * object.a = 2;
  28034. * values(object);
  28035. * // => [1, 2]
  28036. *
  28037. * // Modify the result cache.
  28038. * values.cache.set(object, ['a', 'b']);
  28039. * values(object);
  28040. * // => ['a', 'b']
  28041. *
  28042. * // Replace `_.memoize.Cache`.
  28043. * _.memoize.Cache = WeakMap;
  28044. */
  28045. function memoize(func, resolver) {
  28046. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28047. throw new TypeError(FUNC_ERROR_TEXT);
  28048. }
  28049. var memoized = function() {
  28050. var args = arguments,
  28051. key = resolver ? resolver.apply(this, args) : args[0],
  28052. cache = memoized.cache;
  28053. if (cache.has(key)) {
  28054. return cache.get(key);
  28055. }
  28056. var result = func.apply(this, args);
  28057. memoized.cache = cache.set(key, result) || cache;
  28058. return result;
  28059. };
  28060. memoized.cache = new (memoize.Cache || MapCache);
  28061. return memoized;
  28062. }
  28063. // Expose `MapCache`.
  28064. memoize.Cache = MapCache;
  28065. /**
  28066. * Creates a function that negates the result of the predicate `func`. The
  28067. * `func` predicate is invoked with the `this` binding and arguments of the
  28068. * created function.
  28069. *
  28070. * @static
  28071. * @memberOf _
  28072. * @since 3.0.0
  28073. * @category Function
  28074. * @param {Function} predicate The predicate to negate.
  28075. * @returns {Function} Returns the new negated function.
  28076. * @example
  28077. *
  28078. * function isEven(n) {
  28079. * return n % 2 == 0;
  28080. * }
  28081. *
  28082. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28083. * // => [1, 3, 5]
  28084. */
  28085. function negate(predicate) {
  28086. if (typeof predicate != 'function') {
  28087. throw new TypeError(FUNC_ERROR_TEXT);
  28088. }
  28089. return function() {
  28090. var args = arguments;
  28091. switch (args.length) {
  28092. case 0: return !predicate.call(this);
  28093. case 1: return !predicate.call(this, args[0]);
  28094. case 2: return !predicate.call(this, args[0], args[1]);
  28095. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28096. }
  28097. return !predicate.apply(this, args);
  28098. };
  28099. }
  28100. /**
  28101. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28102. * to the function return the value of the first invocation. The `func` is
  28103. * invoked with the `this` binding and arguments of the created function.
  28104. *
  28105. * @static
  28106. * @memberOf _
  28107. * @since 0.1.0
  28108. * @category Function
  28109. * @param {Function} func The function to restrict.
  28110. * @returns {Function} Returns the new restricted function.
  28111. * @example
  28112. *
  28113. * var initialize = _.once(createApplication);
  28114. * initialize();
  28115. * initialize();
  28116. * // => `createApplication` is invoked once
  28117. */
  28118. function once(func) {
  28119. return before(2, func);
  28120. }
  28121. /**
  28122. * Creates a function that invokes `func` with its arguments transformed.
  28123. *
  28124. * @static
  28125. * @since 4.0.0
  28126. * @memberOf _
  28127. * @category Function
  28128. * @param {Function} func The function to wrap.
  28129. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28130. * The argument transforms.
  28131. * @returns {Function} Returns the new function.
  28132. * @example
  28133. *
  28134. * function doubled(n) {
  28135. * return n * 2;
  28136. * }
  28137. *
  28138. * function square(n) {
  28139. * return n * n;
  28140. * }
  28141. *
  28142. * var func = _.overArgs(function(x, y) {
  28143. * return [x, y];
  28144. * }, [square, doubled]);
  28145. *
  28146. * func(9, 3);
  28147. * // => [81, 6]
  28148. *
  28149. * func(10, 5);
  28150. * // => [100, 10]
  28151. */
  28152. var overArgs = castRest(function(func, transforms) {
  28153. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28154. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28155. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28156. var funcsLength = transforms.length;
  28157. return baseRest(function(args) {
  28158. var index = -1,
  28159. length = nativeMin(args.length, funcsLength);
  28160. while (++index < length) {
  28161. args[index] = transforms[index].call(this, args[index]);
  28162. }
  28163. return apply(func, this, args);
  28164. });
  28165. });
  28166. /**
  28167. * Creates a function that invokes `func` with `partials` prepended to the
  28168. * arguments it receives. This method is like `_.bind` except it does **not**
  28169. * alter the `this` binding.
  28170. *
  28171. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28172. * builds, may be used as a placeholder for partially applied arguments.
  28173. *
  28174. * **Note:** This method doesn't set the "length" property of partially
  28175. * applied functions.
  28176. *
  28177. * @static
  28178. * @memberOf _
  28179. * @since 0.2.0
  28180. * @category Function
  28181. * @param {Function} func The function to partially apply arguments to.
  28182. * @param {...*} [partials] The arguments to be partially applied.
  28183. * @returns {Function} Returns the new partially applied function.
  28184. * @example
  28185. *
  28186. * function greet(greeting, name) {
  28187. * return greeting + ' ' + name;
  28188. * }
  28189. *
  28190. * var sayHelloTo = _.partial(greet, 'hello');
  28191. * sayHelloTo('fred');
  28192. * // => 'hello fred'
  28193. *
  28194. * // Partially applied with placeholders.
  28195. * var greetFred = _.partial(greet, _, 'fred');
  28196. * greetFred('hi');
  28197. * // => 'hi fred'
  28198. */
  28199. var partial = baseRest(function(func, partials) {
  28200. var holders = replaceHolders(partials, getHolder(partial));
  28201. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28202. });
  28203. /**
  28204. * This method is like `_.partial` except that partially applied arguments
  28205. * are appended to the arguments it receives.
  28206. *
  28207. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28208. * builds, may be used as a placeholder for partially applied arguments.
  28209. *
  28210. * **Note:** This method doesn't set the "length" property of partially
  28211. * applied functions.
  28212. *
  28213. * @static
  28214. * @memberOf _
  28215. * @since 1.0.0
  28216. * @category Function
  28217. * @param {Function} func The function to partially apply arguments to.
  28218. * @param {...*} [partials] The arguments to be partially applied.
  28219. * @returns {Function} Returns the new partially applied function.
  28220. * @example
  28221. *
  28222. * function greet(greeting, name) {
  28223. * return greeting + ' ' + name;
  28224. * }
  28225. *
  28226. * var greetFred = _.partialRight(greet, 'fred');
  28227. * greetFred('hi');
  28228. * // => 'hi fred'
  28229. *
  28230. * // Partially applied with placeholders.
  28231. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28232. * sayHelloTo('fred');
  28233. * // => 'hello fred'
  28234. */
  28235. var partialRight = baseRest(function(func, partials) {
  28236. var holders = replaceHolders(partials, getHolder(partialRight));
  28237. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28238. });
  28239. /**
  28240. * Creates a function that invokes `func` with arguments arranged according
  28241. * to the specified `indexes` where the argument value at the first index is
  28242. * provided as the first argument, the argument value at the second index is
  28243. * provided as the second argument, and so on.
  28244. *
  28245. * @static
  28246. * @memberOf _
  28247. * @since 3.0.0
  28248. * @category Function
  28249. * @param {Function} func The function to rearrange arguments for.
  28250. * @param {...(number|number[])} indexes The arranged argument indexes.
  28251. * @returns {Function} Returns the new function.
  28252. * @example
  28253. *
  28254. * var rearged = _.rearg(function(a, b, c) {
  28255. * return [a, b, c];
  28256. * }, [2, 0, 1]);
  28257. *
  28258. * rearged('b', 'c', 'a')
  28259. * // => ['a', 'b', 'c']
  28260. */
  28261. var rearg = flatRest(function(func, indexes) {
  28262. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28263. });
  28264. /**
  28265. * Creates a function that invokes `func` with the `this` binding of the
  28266. * created function and arguments from `start` and beyond provided as
  28267. * an array.
  28268. *
  28269. * **Note:** This method is based on the
  28270. * [rest parameter](https://mdn.io/rest_parameters).
  28271. *
  28272. * @static
  28273. * @memberOf _
  28274. * @since 4.0.0
  28275. * @category Function
  28276. * @param {Function} func The function to apply a rest parameter to.
  28277. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28278. * @returns {Function} Returns the new function.
  28279. * @example
  28280. *
  28281. * var say = _.rest(function(what, names) {
  28282. * return what + ' ' + _.initial(names).join(', ') +
  28283. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28284. * });
  28285. *
  28286. * say('hello', 'fred', 'barney', 'pebbles');
  28287. * // => 'hello fred, barney, & pebbles'
  28288. */
  28289. function rest(func, start) {
  28290. if (typeof func != 'function') {
  28291. throw new TypeError(FUNC_ERROR_TEXT);
  28292. }
  28293. start = start === undefined ? start : toInteger(start);
  28294. return baseRest(func, start);
  28295. }
  28296. /**
  28297. * Creates a function that invokes `func` with the `this` binding of the
  28298. * create function and an array of arguments much like
  28299. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28300. *
  28301. * **Note:** This method is based on the
  28302. * [spread operator](https://mdn.io/spread_operator).
  28303. *
  28304. * @static
  28305. * @memberOf _
  28306. * @since 3.2.0
  28307. * @category Function
  28308. * @param {Function} func The function to spread arguments over.
  28309. * @param {number} [start=0] The start position of the spread.
  28310. * @returns {Function} Returns the new function.
  28311. * @example
  28312. *
  28313. * var say = _.spread(function(who, what) {
  28314. * return who + ' says ' + what;
  28315. * });
  28316. *
  28317. * say(['fred', 'hello']);
  28318. * // => 'fred says hello'
  28319. *
  28320. * var numbers = Promise.all([
  28321. * Promise.resolve(40),
  28322. * Promise.resolve(36)
  28323. * ]);
  28324. *
  28325. * numbers.then(_.spread(function(x, y) {
  28326. * return x + y;
  28327. * }));
  28328. * // => a Promise of 76
  28329. */
  28330. function spread(func, start) {
  28331. if (typeof func != 'function') {
  28332. throw new TypeError(FUNC_ERROR_TEXT);
  28333. }
  28334. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28335. return baseRest(function(args) {
  28336. var array = args[start],
  28337. otherArgs = castSlice(args, 0, start);
  28338. if (array) {
  28339. arrayPush(otherArgs, array);
  28340. }
  28341. return apply(func, this, otherArgs);
  28342. });
  28343. }
  28344. /**
  28345. * Creates a throttled function that only invokes `func` at most once per
  28346. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28347. * method to cancel delayed `func` invocations and a `flush` method to
  28348. * immediately invoke them. Provide `options` to indicate whether `func`
  28349. * should be invoked on the leading and/or trailing edge of the `wait`
  28350. * timeout. The `func` is invoked with the last arguments provided to the
  28351. * throttled function. Subsequent calls to the throttled function return the
  28352. * result of the last `func` invocation.
  28353. *
  28354. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28355. * invoked on the trailing edge of the timeout only if the throttled function
  28356. * is invoked more than once during the `wait` timeout.
  28357. *
  28358. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28359. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28360. *
  28361. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28362. * for details over the differences between `_.throttle` and `_.debounce`.
  28363. *
  28364. * @static
  28365. * @memberOf _
  28366. * @since 0.1.0
  28367. * @category Function
  28368. * @param {Function} func The function to throttle.
  28369. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28370. * @param {Object} [options={}] The options object.
  28371. * @param {boolean} [options.leading=true]
  28372. * Specify invoking on the leading edge of the timeout.
  28373. * @param {boolean} [options.trailing=true]
  28374. * Specify invoking on the trailing edge of the timeout.
  28375. * @returns {Function} Returns the new throttled function.
  28376. * @example
  28377. *
  28378. * // Avoid excessively updating the position while scrolling.
  28379. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28380. *
  28381. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28382. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28383. * jQuery(element).on('click', throttled);
  28384. *
  28385. * // Cancel the trailing throttled invocation.
  28386. * jQuery(window).on('popstate', throttled.cancel);
  28387. */
  28388. function throttle(func, wait, options) {
  28389. var leading = true,
  28390. trailing = true;
  28391. if (typeof func != 'function') {
  28392. throw new TypeError(FUNC_ERROR_TEXT);
  28393. }
  28394. if (isObject(options)) {
  28395. leading = 'leading' in options ? !!options.leading : leading;
  28396. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28397. }
  28398. return debounce(func, wait, {
  28399. 'leading': leading,
  28400. 'maxWait': wait,
  28401. 'trailing': trailing
  28402. });
  28403. }
  28404. /**
  28405. * Creates a function that accepts up to one argument, ignoring any
  28406. * additional arguments.
  28407. *
  28408. * @static
  28409. * @memberOf _
  28410. * @since 4.0.0
  28411. * @category Function
  28412. * @param {Function} func The function to cap arguments for.
  28413. * @returns {Function} Returns the new capped function.
  28414. * @example
  28415. *
  28416. * _.map(['6', '8', '10'], _.unary(parseInt));
  28417. * // => [6, 8, 10]
  28418. */
  28419. function unary(func) {
  28420. return ary(func, 1);
  28421. }
  28422. /**
  28423. * Creates a function that provides `value` to `wrapper` as its first
  28424. * argument. Any additional arguments provided to the function are appended
  28425. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28426. * binding of the created function.
  28427. *
  28428. * @static
  28429. * @memberOf _
  28430. * @since 0.1.0
  28431. * @category Function
  28432. * @param {*} value The value to wrap.
  28433. * @param {Function} [wrapper=identity] The wrapper function.
  28434. * @returns {Function} Returns the new function.
  28435. * @example
  28436. *
  28437. * var p = _.wrap(_.escape, function(func, text) {
  28438. * return '<p>' + func(text) + '</p>';
  28439. * });
  28440. *
  28441. * p('fred, barney, & pebbles');
  28442. * // => '<p>fred, barney, &amp; pebbles</p>'
  28443. */
  28444. function wrap(value, wrapper) {
  28445. return partial(castFunction(wrapper), value);
  28446. }
  28447. /*------------------------------------------------------------------------*/
  28448. /**
  28449. * Casts `value` as an array if it's not one.
  28450. *
  28451. * @static
  28452. * @memberOf _
  28453. * @since 4.4.0
  28454. * @category Lang
  28455. * @param {*} value The value to inspect.
  28456. * @returns {Array} Returns the cast array.
  28457. * @example
  28458. *
  28459. * _.castArray(1);
  28460. * // => [1]
  28461. *
  28462. * _.castArray({ 'a': 1 });
  28463. * // => [{ 'a': 1 }]
  28464. *
  28465. * _.castArray('abc');
  28466. * // => ['abc']
  28467. *
  28468. * _.castArray(null);
  28469. * // => [null]
  28470. *
  28471. * _.castArray(undefined);
  28472. * // => [undefined]
  28473. *
  28474. * _.castArray();
  28475. * // => []
  28476. *
  28477. * var array = [1, 2, 3];
  28478. * console.log(_.castArray(array) === array);
  28479. * // => true
  28480. */
  28481. function castArray() {
  28482. if (!arguments.length) {
  28483. return [];
  28484. }
  28485. var value = arguments[0];
  28486. return isArray(value) ? value : [value];
  28487. }
  28488. /**
  28489. * Creates a shallow clone of `value`.
  28490. *
  28491. * **Note:** This method is loosely based on the
  28492. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28493. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28494. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28495. * arrays. The own enumerable properties of `arguments` objects are cloned
  28496. * as plain objects. An empty object is returned for uncloneable values such
  28497. * as error objects, functions, DOM nodes, and WeakMaps.
  28498. *
  28499. * @static
  28500. * @memberOf _
  28501. * @since 0.1.0
  28502. * @category Lang
  28503. * @param {*} value The value to clone.
  28504. * @returns {*} Returns the cloned value.
  28505. * @see _.cloneDeep
  28506. * @example
  28507. *
  28508. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28509. *
  28510. * var shallow = _.clone(objects);
  28511. * console.log(shallow[0] === objects[0]);
  28512. * // => true
  28513. */
  28514. function clone(value) {
  28515. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28516. }
  28517. /**
  28518. * This method is like `_.clone` except that it accepts `customizer` which
  28519. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28520. * cloning is handled by the method instead. The `customizer` is invoked with
  28521. * up to four arguments; (value [, index|key, object, stack]).
  28522. *
  28523. * @static
  28524. * @memberOf _
  28525. * @since 4.0.0
  28526. * @category Lang
  28527. * @param {*} value The value to clone.
  28528. * @param {Function} [customizer] The function to customize cloning.
  28529. * @returns {*} Returns the cloned value.
  28530. * @see _.cloneDeepWith
  28531. * @example
  28532. *
  28533. * function customizer(value) {
  28534. * if (_.isElement(value)) {
  28535. * return value.cloneNode(false);
  28536. * }
  28537. * }
  28538. *
  28539. * var el = _.cloneWith(document.body, customizer);
  28540. *
  28541. * console.log(el === document.body);
  28542. * // => false
  28543. * console.log(el.nodeName);
  28544. * // => 'BODY'
  28545. * console.log(el.childNodes.length);
  28546. * // => 0
  28547. */
  28548. function cloneWith(value, customizer) {
  28549. customizer = typeof customizer == 'function' ? customizer : undefined;
  28550. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28551. }
  28552. /**
  28553. * This method is like `_.clone` except that it recursively clones `value`.
  28554. *
  28555. * @static
  28556. * @memberOf _
  28557. * @since 1.0.0
  28558. * @category Lang
  28559. * @param {*} value The value to recursively clone.
  28560. * @returns {*} Returns the deep cloned value.
  28561. * @see _.clone
  28562. * @example
  28563. *
  28564. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28565. *
  28566. * var deep = _.cloneDeep(objects);
  28567. * console.log(deep[0] === objects[0]);
  28568. * // => false
  28569. */
  28570. function cloneDeep(value) {
  28571. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28572. }
  28573. /**
  28574. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28575. *
  28576. * @static
  28577. * @memberOf _
  28578. * @since 4.0.0
  28579. * @category Lang
  28580. * @param {*} value The value to recursively clone.
  28581. * @param {Function} [customizer] The function to customize cloning.
  28582. * @returns {*} Returns the deep cloned value.
  28583. * @see _.cloneWith
  28584. * @example
  28585. *
  28586. * function customizer(value) {
  28587. * if (_.isElement(value)) {
  28588. * return value.cloneNode(true);
  28589. * }
  28590. * }
  28591. *
  28592. * var el = _.cloneDeepWith(document.body, customizer);
  28593. *
  28594. * console.log(el === document.body);
  28595. * // => false
  28596. * console.log(el.nodeName);
  28597. * // => 'BODY'
  28598. * console.log(el.childNodes.length);
  28599. * // => 20
  28600. */
  28601. function cloneDeepWith(value, customizer) {
  28602. customizer = typeof customizer == 'function' ? customizer : undefined;
  28603. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28604. }
  28605. /**
  28606. * Checks if `object` conforms to `source` by invoking the predicate
  28607. * properties of `source` with the corresponding property values of `object`.
  28608. *
  28609. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28610. * partially applied.
  28611. *
  28612. * @static
  28613. * @memberOf _
  28614. * @since 4.14.0
  28615. * @category Lang
  28616. * @param {Object} object The object to inspect.
  28617. * @param {Object} source The object of property predicates to conform to.
  28618. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28619. * @example
  28620. *
  28621. * var object = { 'a': 1, 'b': 2 };
  28622. *
  28623. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28624. * // => true
  28625. *
  28626. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28627. * // => false
  28628. */
  28629. function conformsTo(object, source) {
  28630. return source == null || baseConformsTo(object, source, keys(source));
  28631. }
  28632. /**
  28633. * Performs a
  28634. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28635. * comparison between two values to determine if they are equivalent.
  28636. *
  28637. * @static
  28638. * @memberOf _
  28639. * @since 4.0.0
  28640. * @category Lang
  28641. * @param {*} value The value to compare.
  28642. * @param {*} other The other value to compare.
  28643. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28644. * @example
  28645. *
  28646. * var object = { 'a': 1 };
  28647. * var other = { 'a': 1 };
  28648. *
  28649. * _.eq(object, object);
  28650. * // => true
  28651. *
  28652. * _.eq(object, other);
  28653. * // => false
  28654. *
  28655. * _.eq('a', 'a');
  28656. * // => true
  28657. *
  28658. * _.eq('a', Object('a'));
  28659. * // => false
  28660. *
  28661. * _.eq(NaN, NaN);
  28662. * // => true
  28663. */
  28664. function eq(value, other) {
  28665. return value === other || (value !== value && other !== other);
  28666. }
  28667. /**
  28668. * Checks if `value` is greater than `other`.
  28669. *
  28670. * @static
  28671. * @memberOf _
  28672. * @since 3.9.0
  28673. * @category Lang
  28674. * @param {*} value The value to compare.
  28675. * @param {*} other The other value to compare.
  28676. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28677. * else `false`.
  28678. * @see _.lt
  28679. * @example
  28680. *
  28681. * _.gt(3, 1);
  28682. * // => true
  28683. *
  28684. * _.gt(3, 3);
  28685. * // => false
  28686. *
  28687. * _.gt(1, 3);
  28688. * // => false
  28689. */
  28690. var gt = createRelationalOperation(baseGt);
  28691. /**
  28692. * Checks if `value` is greater than or equal to `other`.
  28693. *
  28694. * @static
  28695. * @memberOf _
  28696. * @since 3.9.0
  28697. * @category Lang
  28698. * @param {*} value The value to compare.
  28699. * @param {*} other The other value to compare.
  28700. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28701. * `other`, else `false`.
  28702. * @see _.lte
  28703. * @example
  28704. *
  28705. * _.gte(3, 1);
  28706. * // => true
  28707. *
  28708. * _.gte(3, 3);
  28709. * // => true
  28710. *
  28711. * _.gte(1, 3);
  28712. * // => false
  28713. */
  28714. var gte = createRelationalOperation(function(value, other) {
  28715. return value >= other;
  28716. });
  28717. /**
  28718. * Checks if `value` is likely an `arguments` object.
  28719. *
  28720. * @static
  28721. * @memberOf _
  28722. * @since 0.1.0
  28723. * @category Lang
  28724. * @param {*} value The value to check.
  28725. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28726. * else `false`.
  28727. * @example
  28728. *
  28729. * _.isArguments(function() { return arguments; }());
  28730. * // => true
  28731. *
  28732. * _.isArguments([1, 2, 3]);
  28733. * // => false
  28734. */
  28735. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28736. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28737. !propertyIsEnumerable.call(value, 'callee');
  28738. };
  28739. /**
  28740. * Checks if `value` is classified as an `Array` object.
  28741. *
  28742. * @static
  28743. * @memberOf _
  28744. * @since 0.1.0
  28745. * @category Lang
  28746. * @param {*} value The value to check.
  28747. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28748. * @example
  28749. *
  28750. * _.isArray([1, 2, 3]);
  28751. * // => true
  28752. *
  28753. * _.isArray(document.body.children);
  28754. * // => false
  28755. *
  28756. * _.isArray('abc');
  28757. * // => false
  28758. *
  28759. * _.isArray(_.noop);
  28760. * // => false
  28761. */
  28762. var isArray = Array.isArray;
  28763. /**
  28764. * Checks if `value` is classified as an `ArrayBuffer` object.
  28765. *
  28766. * @static
  28767. * @memberOf _
  28768. * @since 4.3.0
  28769. * @category Lang
  28770. * @param {*} value The value to check.
  28771. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28772. * @example
  28773. *
  28774. * _.isArrayBuffer(new ArrayBuffer(2));
  28775. * // => true
  28776. *
  28777. * _.isArrayBuffer(new Array(2));
  28778. * // => false
  28779. */
  28780. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28781. /**
  28782. * Checks if `value` is array-like. A value is considered array-like if it's
  28783. * not a function and has a `value.length` that's an integer greater than or
  28784. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28785. *
  28786. * @static
  28787. * @memberOf _
  28788. * @since 4.0.0
  28789. * @category Lang
  28790. * @param {*} value The value to check.
  28791. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28792. * @example
  28793. *
  28794. * _.isArrayLike([1, 2, 3]);
  28795. * // => true
  28796. *
  28797. * _.isArrayLike(document.body.children);
  28798. * // => true
  28799. *
  28800. * _.isArrayLike('abc');
  28801. * // => true
  28802. *
  28803. * _.isArrayLike(_.noop);
  28804. * // => false
  28805. */
  28806. function isArrayLike(value) {
  28807. return value != null && isLength(value.length) && !isFunction(value);
  28808. }
  28809. /**
  28810. * This method is like `_.isArrayLike` except that it also checks if `value`
  28811. * is an object.
  28812. *
  28813. * @static
  28814. * @memberOf _
  28815. * @since 4.0.0
  28816. * @category Lang
  28817. * @param {*} value The value to check.
  28818. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28819. * else `false`.
  28820. * @example
  28821. *
  28822. * _.isArrayLikeObject([1, 2, 3]);
  28823. * // => true
  28824. *
  28825. * _.isArrayLikeObject(document.body.children);
  28826. * // => true
  28827. *
  28828. * _.isArrayLikeObject('abc');
  28829. * // => false
  28830. *
  28831. * _.isArrayLikeObject(_.noop);
  28832. * // => false
  28833. */
  28834. function isArrayLikeObject(value) {
  28835. return isObjectLike(value) && isArrayLike(value);
  28836. }
  28837. /**
  28838. * Checks if `value` is classified as a boolean primitive or object.
  28839. *
  28840. * @static
  28841. * @memberOf _
  28842. * @since 0.1.0
  28843. * @category Lang
  28844. * @param {*} value The value to check.
  28845. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28846. * @example
  28847. *
  28848. * _.isBoolean(false);
  28849. * // => true
  28850. *
  28851. * _.isBoolean(null);
  28852. * // => false
  28853. */
  28854. function isBoolean(value) {
  28855. return value === true || value === false ||
  28856. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28857. }
  28858. /**
  28859. * Checks if `value` is a buffer.
  28860. *
  28861. * @static
  28862. * @memberOf _
  28863. * @since 4.3.0
  28864. * @category Lang
  28865. * @param {*} value The value to check.
  28866. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28867. * @example
  28868. *
  28869. * _.isBuffer(new Buffer(2));
  28870. * // => true
  28871. *
  28872. * _.isBuffer(new Uint8Array(2));
  28873. * // => false
  28874. */
  28875. var isBuffer = nativeIsBuffer || stubFalse;
  28876. /**
  28877. * Checks if `value` is classified as a `Date` object.
  28878. *
  28879. * @static
  28880. * @memberOf _
  28881. * @since 0.1.0
  28882. * @category Lang
  28883. * @param {*} value The value to check.
  28884. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28885. * @example
  28886. *
  28887. * _.isDate(new Date);
  28888. * // => true
  28889. *
  28890. * _.isDate('Mon April 23 2012');
  28891. * // => false
  28892. */
  28893. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28894. /**
  28895. * Checks if `value` is likely a DOM element.
  28896. *
  28897. * @static
  28898. * @memberOf _
  28899. * @since 0.1.0
  28900. * @category Lang
  28901. * @param {*} value The value to check.
  28902. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28903. * @example
  28904. *
  28905. * _.isElement(document.body);
  28906. * // => true
  28907. *
  28908. * _.isElement('<body>');
  28909. * // => false
  28910. */
  28911. function isElement(value) {
  28912. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28913. }
  28914. /**
  28915. * Checks if `value` is an empty object, collection, map, or set.
  28916. *
  28917. * Objects are considered empty if they have no own enumerable string keyed
  28918. * properties.
  28919. *
  28920. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28921. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28922. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28923. *
  28924. * @static
  28925. * @memberOf _
  28926. * @since 0.1.0
  28927. * @category Lang
  28928. * @param {*} value The value to check.
  28929. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28930. * @example
  28931. *
  28932. * _.isEmpty(null);
  28933. * // => true
  28934. *
  28935. * _.isEmpty(true);
  28936. * // => true
  28937. *
  28938. * _.isEmpty(1);
  28939. * // => true
  28940. *
  28941. * _.isEmpty([1, 2, 3]);
  28942. * // => false
  28943. *
  28944. * _.isEmpty({ 'a': 1 });
  28945. * // => false
  28946. */
  28947. function isEmpty(value) {
  28948. if (value == null) {
  28949. return true;
  28950. }
  28951. if (isArrayLike(value) &&
  28952. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28953. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28954. return !value.length;
  28955. }
  28956. var tag = getTag(value);
  28957. if (tag == mapTag || tag == setTag) {
  28958. return !value.size;
  28959. }
  28960. if (isPrototype(value)) {
  28961. return !baseKeys(value).length;
  28962. }
  28963. for (var key in value) {
  28964. if (hasOwnProperty.call(value, key)) {
  28965. return false;
  28966. }
  28967. }
  28968. return true;
  28969. }
  28970. /**
  28971. * Performs a deep comparison between two values to determine if they are
  28972. * equivalent.
  28973. *
  28974. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28975. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28976. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28977. * by their own, not inherited, enumerable properties. Functions and DOM
  28978. * nodes are compared by strict equality, i.e. `===`.
  28979. *
  28980. * @static
  28981. * @memberOf _
  28982. * @since 0.1.0
  28983. * @category Lang
  28984. * @param {*} value The value to compare.
  28985. * @param {*} other The other value to compare.
  28986. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28987. * @example
  28988. *
  28989. * var object = { 'a': 1 };
  28990. * var other = { 'a': 1 };
  28991. *
  28992. * _.isEqual(object, other);
  28993. * // => true
  28994. *
  28995. * object === other;
  28996. * // => false
  28997. */
  28998. function isEqual(value, other) {
  28999. return baseIsEqual(value, other);
  29000. }
  29001. /**
  29002. * This method is like `_.isEqual` except that it accepts `customizer` which
  29003. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29004. * are handled by the method instead. The `customizer` is invoked with up to
  29005. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29006. *
  29007. * @static
  29008. * @memberOf _
  29009. * @since 4.0.0
  29010. * @category Lang
  29011. * @param {*} value The value to compare.
  29012. * @param {*} other The other value to compare.
  29013. * @param {Function} [customizer] The function to customize comparisons.
  29014. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29015. * @example
  29016. *
  29017. * function isGreeting(value) {
  29018. * return /^h(?:i|ello)$/.test(value);
  29019. * }
  29020. *
  29021. * function customizer(objValue, othValue) {
  29022. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29023. * return true;
  29024. * }
  29025. * }
  29026. *
  29027. * var array = ['hello', 'goodbye'];
  29028. * var other = ['hi', 'goodbye'];
  29029. *
  29030. * _.isEqualWith(array, other, customizer);
  29031. * // => true
  29032. */
  29033. function isEqualWith(value, other, customizer) {
  29034. customizer = typeof customizer == 'function' ? customizer : undefined;
  29035. var result = customizer ? customizer(value, other) : undefined;
  29036. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29037. }
  29038. /**
  29039. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29040. * `SyntaxError`, `TypeError`, or `URIError` object.
  29041. *
  29042. * @static
  29043. * @memberOf _
  29044. * @since 3.0.0
  29045. * @category Lang
  29046. * @param {*} value The value to check.
  29047. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29048. * @example
  29049. *
  29050. * _.isError(new Error);
  29051. * // => true
  29052. *
  29053. * _.isError(Error);
  29054. * // => false
  29055. */
  29056. function isError(value) {
  29057. if (!isObjectLike(value)) {
  29058. return false;
  29059. }
  29060. var tag = baseGetTag(value);
  29061. return tag == errorTag || tag == domExcTag ||
  29062. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29063. }
  29064. /**
  29065. * Checks if `value` is a finite primitive number.
  29066. *
  29067. * **Note:** This method is based on
  29068. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29069. *
  29070. * @static
  29071. * @memberOf _
  29072. * @since 0.1.0
  29073. * @category Lang
  29074. * @param {*} value The value to check.
  29075. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29076. * @example
  29077. *
  29078. * _.isFinite(3);
  29079. * // => true
  29080. *
  29081. * _.isFinite(Number.MIN_VALUE);
  29082. * // => true
  29083. *
  29084. * _.isFinite(Infinity);
  29085. * // => false
  29086. *
  29087. * _.isFinite('3');
  29088. * // => false
  29089. */
  29090. function isFinite(value) {
  29091. return typeof value == 'number' && nativeIsFinite(value);
  29092. }
  29093. /**
  29094. * Checks if `value` is classified as a `Function` object.
  29095. *
  29096. * @static
  29097. * @memberOf _
  29098. * @since 0.1.0
  29099. * @category Lang
  29100. * @param {*} value The value to check.
  29101. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29102. * @example
  29103. *
  29104. * _.isFunction(_);
  29105. * // => true
  29106. *
  29107. * _.isFunction(/abc/);
  29108. * // => false
  29109. */
  29110. function isFunction(value) {
  29111. if (!isObject(value)) {
  29112. return false;
  29113. }
  29114. // The use of `Object#toString` avoids issues with the `typeof` operator
  29115. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29116. var tag = baseGetTag(value);
  29117. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29118. }
  29119. /**
  29120. * Checks if `value` is an integer.
  29121. *
  29122. * **Note:** This method is based on
  29123. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29124. *
  29125. * @static
  29126. * @memberOf _
  29127. * @since 4.0.0
  29128. * @category Lang
  29129. * @param {*} value The value to check.
  29130. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29131. * @example
  29132. *
  29133. * _.isInteger(3);
  29134. * // => true
  29135. *
  29136. * _.isInteger(Number.MIN_VALUE);
  29137. * // => false
  29138. *
  29139. * _.isInteger(Infinity);
  29140. * // => false
  29141. *
  29142. * _.isInteger('3');
  29143. * // => false
  29144. */
  29145. function isInteger(value) {
  29146. return typeof value == 'number' && value == toInteger(value);
  29147. }
  29148. /**
  29149. * Checks if `value` is a valid array-like length.
  29150. *
  29151. * **Note:** This method is loosely based on
  29152. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29153. *
  29154. * @static
  29155. * @memberOf _
  29156. * @since 4.0.0
  29157. * @category Lang
  29158. * @param {*} value The value to check.
  29159. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29160. * @example
  29161. *
  29162. * _.isLength(3);
  29163. * // => true
  29164. *
  29165. * _.isLength(Number.MIN_VALUE);
  29166. * // => false
  29167. *
  29168. * _.isLength(Infinity);
  29169. * // => false
  29170. *
  29171. * _.isLength('3');
  29172. * // => false
  29173. */
  29174. function isLength(value) {
  29175. return typeof value == 'number' &&
  29176. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29177. }
  29178. /**
  29179. * Checks if `value` is the
  29180. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29181. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29182. *
  29183. * @static
  29184. * @memberOf _
  29185. * @since 0.1.0
  29186. * @category Lang
  29187. * @param {*} value The value to check.
  29188. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29189. * @example
  29190. *
  29191. * _.isObject({});
  29192. * // => true
  29193. *
  29194. * _.isObject([1, 2, 3]);
  29195. * // => true
  29196. *
  29197. * _.isObject(_.noop);
  29198. * // => true
  29199. *
  29200. * _.isObject(null);
  29201. * // => false
  29202. */
  29203. function isObject(value) {
  29204. var type = typeof value;
  29205. return value != null && (type == 'object' || type == 'function');
  29206. }
  29207. /**
  29208. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29209. * and has a `typeof` result of "object".
  29210. *
  29211. * @static
  29212. * @memberOf _
  29213. * @since 4.0.0
  29214. * @category Lang
  29215. * @param {*} value The value to check.
  29216. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29217. * @example
  29218. *
  29219. * _.isObjectLike({});
  29220. * // => true
  29221. *
  29222. * _.isObjectLike([1, 2, 3]);
  29223. * // => true
  29224. *
  29225. * _.isObjectLike(_.noop);
  29226. * // => false
  29227. *
  29228. * _.isObjectLike(null);
  29229. * // => false
  29230. */
  29231. function isObjectLike(value) {
  29232. return value != null && typeof value == 'object';
  29233. }
  29234. /**
  29235. * Checks if `value` is classified as a `Map` object.
  29236. *
  29237. * @static
  29238. * @memberOf _
  29239. * @since 4.3.0
  29240. * @category Lang
  29241. * @param {*} value The value to check.
  29242. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29243. * @example
  29244. *
  29245. * _.isMap(new Map);
  29246. * // => true
  29247. *
  29248. * _.isMap(new WeakMap);
  29249. * // => false
  29250. */
  29251. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29252. /**
  29253. * Performs a partial deep comparison between `object` and `source` to
  29254. * determine if `object` contains equivalent property values.
  29255. *
  29256. * **Note:** This method is equivalent to `_.matches` when `source` is
  29257. * partially applied.
  29258. *
  29259. * Partial comparisons will match empty array and empty object `source`
  29260. * values against any array or object value, respectively. See `_.isEqual`
  29261. * for a list of supported value comparisons.
  29262. *
  29263. * @static
  29264. * @memberOf _
  29265. * @since 3.0.0
  29266. * @category Lang
  29267. * @param {Object} object The object to inspect.
  29268. * @param {Object} source The object of property values to match.
  29269. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29270. * @example
  29271. *
  29272. * var object = { 'a': 1, 'b': 2 };
  29273. *
  29274. * _.isMatch(object, { 'b': 2 });
  29275. * // => true
  29276. *
  29277. * _.isMatch(object, { 'b': 1 });
  29278. * // => false
  29279. */
  29280. function isMatch(object, source) {
  29281. return object === source || baseIsMatch(object, source, getMatchData(source));
  29282. }
  29283. /**
  29284. * This method is like `_.isMatch` except that it accepts `customizer` which
  29285. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29286. * are handled by the method instead. The `customizer` is invoked with five
  29287. * arguments: (objValue, srcValue, index|key, object, source).
  29288. *
  29289. * @static
  29290. * @memberOf _
  29291. * @since 4.0.0
  29292. * @category Lang
  29293. * @param {Object} object The object to inspect.
  29294. * @param {Object} source The object of property values to match.
  29295. * @param {Function} [customizer] The function to customize comparisons.
  29296. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29297. * @example
  29298. *
  29299. * function isGreeting(value) {
  29300. * return /^h(?:i|ello)$/.test(value);
  29301. * }
  29302. *
  29303. * function customizer(objValue, srcValue) {
  29304. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29305. * return true;
  29306. * }
  29307. * }
  29308. *
  29309. * var object = { 'greeting': 'hello' };
  29310. * var source = { 'greeting': 'hi' };
  29311. *
  29312. * _.isMatchWith(object, source, customizer);
  29313. * // => true
  29314. */
  29315. function isMatchWith(object, source, customizer) {
  29316. customizer = typeof customizer == 'function' ? customizer : undefined;
  29317. return baseIsMatch(object, source, getMatchData(source), customizer);
  29318. }
  29319. /**
  29320. * Checks if `value` is `NaN`.
  29321. *
  29322. * **Note:** This method is based on
  29323. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29324. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29325. * `undefined` and other non-number values.
  29326. *
  29327. * @static
  29328. * @memberOf _
  29329. * @since 0.1.0
  29330. * @category Lang
  29331. * @param {*} value The value to check.
  29332. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29333. * @example
  29334. *
  29335. * _.isNaN(NaN);
  29336. * // => true
  29337. *
  29338. * _.isNaN(new Number(NaN));
  29339. * // => true
  29340. *
  29341. * isNaN(undefined);
  29342. * // => true
  29343. *
  29344. * _.isNaN(undefined);
  29345. * // => false
  29346. */
  29347. function isNaN(value) {
  29348. // An `NaN` primitive is the only value that is not equal to itself.
  29349. // Perform the `toStringTag` check first to avoid errors with some
  29350. // ActiveX objects in IE.
  29351. return isNumber(value) && value != +value;
  29352. }
  29353. /**
  29354. * Checks if `value` is a pristine native function.
  29355. *
  29356. * **Note:** This method can't reliably detect native functions in the presence
  29357. * of the core-js package because core-js circumvents this kind of detection.
  29358. * Despite multiple requests, the core-js maintainer has made it clear: any
  29359. * attempt to fix the detection will be obstructed. As a result, we're left
  29360. * with little choice but to throw an error. Unfortunately, this also affects
  29361. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29362. * which rely on core-js.
  29363. *
  29364. * @static
  29365. * @memberOf _
  29366. * @since 3.0.0
  29367. * @category Lang
  29368. * @param {*} value The value to check.
  29369. * @returns {boolean} Returns `true` if `value` is a native function,
  29370. * else `false`.
  29371. * @example
  29372. *
  29373. * _.isNative(Array.prototype.push);
  29374. * // => true
  29375. *
  29376. * _.isNative(_);
  29377. * // => false
  29378. */
  29379. function isNative(value) {
  29380. if (isMaskable(value)) {
  29381. throw new Error(CORE_ERROR_TEXT);
  29382. }
  29383. return baseIsNative(value);
  29384. }
  29385. /**
  29386. * Checks if `value` is `null`.
  29387. *
  29388. * @static
  29389. * @memberOf _
  29390. * @since 0.1.0
  29391. * @category Lang
  29392. * @param {*} value The value to check.
  29393. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29394. * @example
  29395. *
  29396. * _.isNull(null);
  29397. * // => true
  29398. *
  29399. * _.isNull(void 0);
  29400. * // => false
  29401. */
  29402. function isNull(value) {
  29403. return value === null;
  29404. }
  29405. /**
  29406. * Checks if `value` is `null` or `undefined`.
  29407. *
  29408. * @static
  29409. * @memberOf _
  29410. * @since 4.0.0
  29411. * @category Lang
  29412. * @param {*} value The value to check.
  29413. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29414. * @example
  29415. *
  29416. * _.isNil(null);
  29417. * // => true
  29418. *
  29419. * _.isNil(void 0);
  29420. * // => true
  29421. *
  29422. * _.isNil(NaN);
  29423. * // => false
  29424. */
  29425. function isNil(value) {
  29426. return value == null;
  29427. }
  29428. /**
  29429. * Checks if `value` is classified as a `Number` primitive or object.
  29430. *
  29431. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29432. * classified as numbers, use the `_.isFinite` method.
  29433. *
  29434. * @static
  29435. * @memberOf _
  29436. * @since 0.1.0
  29437. * @category Lang
  29438. * @param {*} value The value to check.
  29439. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29440. * @example
  29441. *
  29442. * _.isNumber(3);
  29443. * // => true
  29444. *
  29445. * _.isNumber(Number.MIN_VALUE);
  29446. * // => true
  29447. *
  29448. * _.isNumber(Infinity);
  29449. * // => true
  29450. *
  29451. * _.isNumber('3');
  29452. * // => false
  29453. */
  29454. function isNumber(value) {
  29455. return typeof value == 'number' ||
  29456. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29457. }
  29458. /**
  29459. * Checks if `value` is a plain object, that is, an object created by the
  29460. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29461. *
  29462. * @static
  29463. * @memberOf _
  29464. * @since 0.8.0
  29465. * @category Lang
  29466. * @param {*} value The value to check.
  29467. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29468. * @example
  29469. *
  29470. * function Foo() {
  29471. * this.a = 1;
  29472. * }
  29473. *
  29474. * _.isPlainObject(new Foo);
  29475. * // => false
  29476. *
  29477. * _.isPlainObject([1, 2, 3]);
  29478. * // => false
  29479. *
  29480. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29481. * // => true
  29482. *
  29483. * _.isPlainObject(Object.create(null));
  29484. * // => true
  29485. */
  29486. function isPlainObject(value) {
  29487. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29488. return false;
  29489. }
  29490. var proto = getPrototype(value);
  29491. if (proto === null) {
  29492. return true;
  29493. }
  29494. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29495. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29496. funcToString.call(Ctor) == objectCtorString;
  29497. }
  29498. /**
  29499. * Checks if `value` is classified as a `RegExp` object.
  29500. *
  29501. * @static
  29502. * @memberOf _
  29503. * @since 0.1.0
  29504. * @category Lang
  29505. * @param {*} value The value to check.
  29506. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29507. * @example
  29508. *
  29509. * _.isRegExp(/abc/);
  29510. * // => true
  29511. *
  29512. * _.isRegExp('/abc/');
  29513. * // => false
  29514. */
  29515. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29516. /**
  29517. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29518. * double precision number which isn't the result of a rounded unsafe integer.
  29519. *
  29520. * **Note:** This method is based on
  29521. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29522. *
  29523. * @static
  29524. * @memberOf _
  29525. * @since 4.0.0
  29526. * @category Lang
  29527. * @param {*} value The value to check.
  29528. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29529. * @example
  29530. *
  29531. * _.isSafeInteger(3);
  29532. * // => true
  29533. *
  29534. * _.isSafeInteger(Number.MIN_VALUE);
  29535. * // => false
  29536. *
  29537. * _.isSafeInteger(Infinity);
  29538. * // => false
  29539. *
  29540. * _.isSafeInteger('3');
  29541. * // => false
  29542. */
  29543. function isSafeInteger(value) {
  29544. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29545. }
  29546. /**
  29547. * Checks if `value` is classified as a `Set` object.
  29548. *
  29549. * @static
  29550. * @memberOf _
  29551. * @since 4.3.0
  29552. * @category Lang
  29553. * @param {*} value The value to check.
  29554. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29555. * @example
  29556. *
  29557. * _.isSet(new Set);
  29558. * // => true
  29559. *
  29560. * _.isSet(new WeakSet);
  29561. * // => false
  29562. */
  29563. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29564. /**
  29565. * Checks if `value` is classified as a `String` primitive or object.
  29566. *
  29567. * @static
  29568. * @since 0.1.0
  29569. * @memberOf _
  29570. * @category Lang
  29571. * @param {*} value The value to check.
  29572. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29573. * @example
  29574. *
  29575. * _.isString('abc');
  29576. * // => true
  29577. *
  29578. * _.isString(1);
  29579. * // => false
  29580. */
  29581. function isString(value) {
  29582. return typeof value == 'string' ||
  29583. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29584. }
  29585. /**
  29586. * Checks if `value` is classified as a `Symbol` primitive or object.
  29587. *
  29588. * @static
  29589. * @memberOf _
  29590. * @since 4.0.0
  29591. * @category Lang
  29592. * @param {*} value The value to check.
  29593. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29594. * @example
  29595. *
  29596. * _.isSymbol(Symbol.iterator);
  29597. * // => true
  29598. *
  29599. * _.isSymbol('abc');
  29600. * // => false
  29601. */
  29602. function isSymbol(value) {
  29603. return typeof value == 'symbol' ||
  29604. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29605. }
  29606. /**
  29607. * Checks if `value` is classified as a typed array.
  29608. *
  29609. * @static
  29610. * @memberOf _
  29611. * @since 3.0.0
  29612. * @category Lang
  29613. * @param {*} value The value to check.
  29614. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29615. * @example
  29616. *
  29617. * _.isTypedArray(new Uint8Array);
  29618. * // => true
  29619. *
  29620. * _.isTypedArray([]);
  29621. * // => false
  29622. */
  29623. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29624. /**
  29625. * Checks if `value` is `undefined`.
  29626. *
  29627. * @static
  29628. * @since 0.1.0
  29629. * @memberOf _
  29630. * @category Lang
  29631. * @param {*} value The value to check.
  29632. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29633. * @example
  29634. *
  29635. * _.isUndefined(void 0);
  29636. * // => true
  29637. *
  29638. * _.isUndefined(null);
  29639. * // => false
  29640. */
  29641. function isUndefined(value) {
  29642. return value === undefined;
  29643. }
  29644. /**
  29645. * Checks if `value` is classified as a `WeakMap` object.
  29646. *
  29647. * @static
  29648. * @memberOf _
  29649. * @since 4.3.0
  29650. * @category Lang
  29651. * @param {*} value The value to check.
  29652. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29653. * @example
  29654. *
  29655. * _.isWeakMap(new WeakMap);
  29656. * // => true
  29657. *
  29658. * _.isWeakMap(new Map);
  29659. * // => false
  29660. */
  29661. function isWeakMap(value) {
  29662. return isObjectLike(value) && getTag(value) == weakMapTag;
  29663. }
  29664. /**
  29665. * Checks if `value` is classified as a `WeakSet` object.
  29666. *
  29667. * @static
  29668. * @memberOf _
  29669. * @since 4.3.0
  29670. * @category Lang
  29671. * @param {*} value The value to check.
  29672. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29673. * @example
  29674. *
  29675. * _.isWeakSet(new WeakSet);
  29676. * // => true
  29677. *
  29678. * _.isWeakSet(new Set);
  29679. * // => false
  29680. */
  29681. function isWeakSet(value) {
  29682. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29683. }
  29684. /**
  29685. * Checks if `value` is less than `other`.
  29686. *
  29687. * @static
  29688. * @memberOf _
  29689. * @since 3.9.0
  29690. * @category Lang
  29691. * @param {*} value The value to compare.
  29692. * @param {*} other The other value to compare.
  29693. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29694. * else `false`.
  29695. * @see _.gt
  29696. * @example
  29697. *
  29698. * _.lt(1, 3);
  29699. * // => true
  29700. *
  29701. * _.lt(3, 3);
  29702. * // => false
  29703. *
  29704. * _.lt(3, 1);
  29705. * // => false
  29706. */
  29707. var lt = createRelationalOperation(baseLt);
  29708. /**
  29709. * Checks if `value` is less than or equal to `other`.
  29710. *
  29711. * @static
  29712. * @memberOf _
  29713. * @since 3.9.0
  29714. * @category Lang
  29715. * @param {*} value The value to compare.
  29716. * @param {*} other The other value to compare.
  29717. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29718. * `other`, else `false`.
  29719. * @see _.gte
  29720. * @example
  29721. *
  29722. * _.lte(1, 3);
  29723. * // => true
  29724. *
  29725. * _.lte(3, 3);
  29726. * // => true
  29727. *
  29728. * _.lte(3, 1);
  29729. * // => false
  29730. */
  29731. var lte = createRelationalOperation(function(value, other) {
  29732. return value <= other;
  29733. });
  29734. /**
  29735. * Converts `value` to an array.
  29736. *
  29737. * @static
  29738. * @since 0.1.0
  29739. * @memberOf _
  29740. * @category Lang
  29741. * @param {*} value The value to convert.
  29742. * @returns {Array} Returns the converted array.
  29743. * @example
  29744. *
  29745. * _.toArray({ 'a': 1, 'b': 2 });
  29746. * // => [1, 2]
  29747. *
  29748. * _.toArray('abc');
  29749. * // => ['a', 'b', 'c']
  29750. *
  29751. * _.toArray(1);
  29752. * // => []
  29753. *
  29754. * _.toArray(null);
  29755. * // => []
  29756. */
  29757. function toArray(value) {
  29758. if (!value) {
  29759. return [];
  29760. }
  29761. if (isArrayLike(value)) {
  29762. return isString(value) ? stringToArray(value) : copyArray(value);
  29763. }
  29764. if (symIterator && value[symIterator]) {
  29765. return iteratorToArray(value[symIterator]());
  29766. }
  29767. var tag = getTag(value),
  29768. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29769. return func(value);
  29770. }
  29771. /**
  29772. * Converts `value` to a finite number.
  29773. *
  29774. * @static
  29775. * @memberOf _
  29776. * @since 4.12.0
  29777. * @category Lang
  29778. * @param {*} value The value to convert.
  29779. * @returns {number} Returns the converted number.
  29780. * @example
  29781. *
  29782. * _.toFinite(3.2);
  29783. * // => 3.2
  29784. *
  29785. * _.toFinite(Number.MIN_VALUE);
  29786. * // => 5e-324
  29787. *
  29788. * _.toFinite(Infinity);
  29789. * // => 1.7976931348623157e+308
  29790. *
  29791. * _.toFinite('3.2');
  29792. * // => 3.2
  29793. */
  29794. function toFinite(value) {
  29795. if (!value) {
  29796. return value === 0 ? value : 0;
  29797. }
  29798. value = toNumber(value);
  29799. if (value === INFINITY || value === -INFINITY) {
  29800. var sign = (value < 0 ? -1 : 1);
  29801. return sign * MAX_INTEGER;
  29802. }
  29803. return value === value ? value : 0;
  29804. }
  29805. /**
  29806. * Converts `value` to an integer.
  29807. *
  29808. * **Note:** This method is loosely based on
  29809. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29810. *
  29811. * @static
  29812. * @memberOf _
  29813. * @since 4.0.0
  29814. * @category Lang
  29815. * @param {*} value The value to convert.
  29816. * @returns {number} Returns the converted integer.
  29817. * @example
  29818. *
  29819. * _.toInteger(3.2);
  29820. * // => 3
  29821. *
  29822. * _.toInteger(Number.MIN_VALUE);
  29823. * // => 0
  29824. *
  29825. * _.toInteger(Infinity);
  29826. * // => 1.7976931348623157e+308
  29827. *
  29828. * _.toInteger('3.2');
  29829. * // => 3
  29830. */
  29831. function toInteger(value) {
  29832. var result = toFinite(value),
  29833. remainder = result % 1;
  29834. return result === result ? (remainder ? result - remainder : result) : 0;
  29835. }
  29836. /**
  29837. * Converts `value` to an integer suitable for use as the length of an
  29838. * array-like object.
  29839. *
  29840. * **Note:** This method is based on
  29841. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29842. *
  29843. * @static
  29844. * @memberOf _
  29845. * @since 4.0.0
  29846. * @category Lang
  29847. * @param {*} value The value to convert.
  29848. * @returns {number} Returns the converted integer.
  29849. * @example
  29850. *
  29851. * _.toLength(3.2);
  29852. * // => 3
  29853. *
  29854. * _.toLength(Number.MIN_VALUE);
  29855. * // => 0
  29856. *
  29857. * _.toLength(Infinity);
  29858. * // => 4294967295
  29859. *
  29860. * _.toLength('3.2');
  29861. * // => 3
  29862. */
  29863. function toLength(value) {
  29864. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29865. }
  29866. /**
  29867. * Converts `value` to a number.
  29868. *
  29869. * @static
  29870. * @memberOf _
  29871. * @since 4.0.0
  29872. * @category Lang
  29873. * @param {*} value The value to process.
  29874. * @returns {number} Returns the number.
  29875. * @example
  29876. *
  29877. * _.toNumber(3.2);
  29878. * // => 3.2
  29879. *
  29880. * _.toNumber(Number.MIN_VALUE);
  29881. * // => 5e-324
  29882. *
  29883. * _.toNumber(Infinity);
  29884. * // => Infinity
  29885. *
  29886. * _.toNumber('3.2');
  29887. * // => 3.2
  29888. */
  29889. function toNumber(value) {
  29890. if (typeof value == 'number') {
  29891. return value;
  29892. }
  29893. if (isSymbol(value)) {
  29894. return NAN;
  29895. }
  29896. if (isObject(value)) {
  29897. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29898. value = isObject(other) ? (other + '') : other;
  29899. }
  29900. if (typeof value != 'string') {
  29901. return value === 0 ? value : +value;
  29902. }
  29903. value = value.replace(reTrim, '');
  29904. var isBinary = reIsBinary.test(value);
  29905. return (isBinary || reIsOctal.test(value))
  29906. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29907. : (reIsBadHex.test(value) ? NAN : +value);
  29908. }
  29909. /**
  29910. * Converts `value` to a plain object flattening inherited enumerable string
  29911. * keyed properties of `value` to own properties of the plain object.
  29912. *
  29913. * @static
  29914. * @memberOf _
  29915. * @since 3.0.0
  29916. * @category Lang
  29917. * @param {*} value The value to convert.
  29918. * @returns {Object} Returns the converted plain object.
  29919. * @example
  29920. *
  29921. * function Foo() {
  29922. * this.b = 2;
  29923. * }
  29924. *
  29925. * Foo.prototype.c = 3;
  29926. *
  29927. * _.assign({ 'a': 1 }, new Foo);
  29928. * // => { 'a': 1, 'b': 2 }
  29929. *
  29930. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29931. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29932. */
  29933. function toPlainObject(value) {
  29934. return copyObject(value, keysIn(value));
  29935. }
  29936. /**
  29937. * Converts `value` to a safe integer. A safe integer can be compared and
  29938. * represented correctly.
  29939. *
  29940. * @static
  29941. * @memberOf _
  29942. * @since 4.0.0
  29943. * @category Lang
  29944. * @param {*} value The value to convert.
  29945. * @returns {number} Returns the converted integer.
  29946. * @example
  29947. *
  29948. * _.toSafeInteger(3.2);
  29949. * // => 3
  29950. *
  29951. * _.toSafeInteger(Number.MIN_VALUE);
  29952. * // => 0
  29953. *
  29954. * _.toSafeInteger(Infinity);
  29955. * // => 9007199254740991
  29956. *
  29957. * _.toSafeInteger('3.2');
  29958. * // => 3
  29959. */
  29960. function toSafeInteger(value) {
  29961. return value
  29962. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29963. : (value === 0 ? value : 0);
  29964. }
  29965. /**
  29966. * Converts `value` to a string. An empty string is returned for `null`
  29967. * and `undefined` values. The sign of `-0` is preserved.
  29968. *
  29969. * @static
  29970. * @memberOf _
  29971. * @since 4.0.0
  29972. * @category Lang
  29973. * @param {*} value The value to convert.
  29974. * @returns {string} Returns the converted string.
  29975. * @example
  29976. *
  29977. * _.toString(null);
  29978. * // => ''
  29979. *
  29980. * _.toString(-0);
  29981. * // => '-0'
  29982. *
  29983. * _.toString([1, 2, 3]);
  29984. * // => '1,2,3'
  29985. */
  29986. function toString(value) {
  29987. return value == null ? '' : baseToString(value);
  29988. }
  29989. /*------------------------------------------------------------------------*/
  29990. /**
  29991. * Assigns own enumerable string keyed properties of source objects to the
  29992. * destination object. Source objects are applied from left to right.
  29993. * Subsequent sources overwrite property assignments of previous sources.
  29994. *
  29995. * **Note:** This method mutates `object` and is loosely based on
  29996. * [`Object.assign`](https://mdn.io/Object/assign).
  29997. *
  29998. * @static
  29999. * @memberOf _
  30000. * @since 0.10.0
  30001. * @category Object
  30002. * @param {Object} object The destination object.
  30003. * @param {...Object} [sources] The source objects.
  30004. * @returns {Object} Returns `object`.
  30005. * @see _.assignIn
  30006. * @example
  30007. *
  30008. * function Foo() {
  30009. * this.a = 1;
  30010. * }
  30011. *
  30012. * function Bar() {
  30013. * this.c = 3;
  30014. * }
  30015. *
  30016. * Foo.prototype.b = 2;
  30017. * Bar.prototype.d = 4;
  30018. *
  30019. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30020. * // => { 'a': 1, 'c': 3 }
  30021. */
  30022. var assign = createAssigner(function(object, source) {
  30023. if (isPrototype(source) || isArrayLike(source)) {
  30024. copyObject(source, keys(source), object);
  30025. return;
  30026. }
  30027. for (var key in source) {
  30028. if (hasOwnProperty.call(source, key)) {
  30029. assignValue(object, key, source[key]);
  30030. }
  30031. }
  30032. });
  30033. /**
  30034. * This method is like `_.assign` except that it iterates over own and
  30035. * inherited source properties.
  30036. *
  30037. * **Note:** This method mutates `object`.
  30038. *
  30039. * @static
  30040. * @memberOf _
  30041. * @since 4.0.0
  30042. * @alias extend
  30043. * @category Object
  30044. * @param {Object} object The destination object.
  30045. * @param {...Object} [sources] The source objects.
  30046. * @returns {Object} Returns `object`.
  30047. * @see _.assign
  30048. * @example
  30049. *
  30050. * function Foo() {
  30051. * this.a = 1;
  30052. * }
  30053. *
  30054. * function Bar() {
  30055. * this.c = 3;
  30056. * }
  30057. *
  30058. * Foo.prototype.b = 2;
  30059. * Bar.prototype.d = 4;
  30060. *
  30061. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30062. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30063. */
  30064. var assignIn = createAssigner(function(object, source) {
  30065. copyObject(source, keysIn(source), object);
  30066. });
  30067. /**
  30068. * This method is like `_.assignIn` except that it accepts `customizer`
  30069. * which is invoked to produce the assigned values. If `customizer` returns
  30070. * `undefined`, assignment is handled by the method instead. The `customizer`
  30071. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30072. *
  30073. * **Note:** This method mutates `object`.
  30074. *
  30075. * @static
  30076. * @memberOf _
  30077. * @since 4.0.0
  30078. * @alias extendWith
  30079. * @category Object
  30080. * @param {Object} object The destination object.
  30081. * @param {...Object} sources The source objects.
  30082. * @param {Function} [customizer] The function to customize assigned values.
  30083. * @returns {Object} Returns `object`.
  30084. * @see _.assignWith
  30085. * @example
  30086. *
  30087. * function customizer(objValue, srcValue) {
  30088. * return _.isUndefined(objValue) ? srcValue : objValue;
  30089. * }
  30090. *
  30091. * var defaults = _.partialRight(_.assignInWith, customizer);
  30092. *
  30093. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30094. * // => { 'a': 1, 'b': 2 }
  30095. */
  30096. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30097. copyObject(source, keysIn(source), object, customizer);
  30098. });
  30099. /**
  30100. * This method is like `_.assign` except that it accepts `customizer`
  30101. * which is invoked to produce the assigned values. If `customizer` returns
  30102. * `undefined`, assignment is handled by the method instead. The `customizer`
  30103. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30104. *
  30105. * **Note:** This method mutates `object`.
  30106. *
  30107. * @static
  30108. * @memberOf _
  30109. * @since 4.0.0
  30110. * @category Object
  30111. * @param {Object} object The destination object.
  30112. * @param {...Object} sources The source objects.
  30113. * @param {Function} [customizer] The function to customize assigned values.
  30114. * @returns {Object} Returns `object`.
  30115. * @see _.assignInWith
  30116. * @example
  30117. *
  30118. * function customizer(objValue, srcValue) {
  30119. * return _.isUndefined(objValue) ? srcValue : objValue;
  30120. * }
  30121. *
  30122. * var defaults = _.partialRight(_.assignWith, customizer);
  30123. *
  30124. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30125. * // => { 'a': 1, 'b': 2 }
  30126. */
  30127. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30128. copyObject(source, keys(source), object, customizer);
  30129. });
  30130. /**
  30131. * Creates an array of values corresponding to `paths` of `object`.
  30132. *
  30133. * @static
  30134. * @memberOf _
  30135. * @since 1.0.0
  30136. * @category Object
  30137. * @param {Object} object The object to iterate over.
  30138. * @param {...(string|string[])} [paths] The property paths to pick.
  30139. * @returns {Array} Returns the picked values.
  30140. * @example
  30141. *
  30142. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30143. *
  30144. * _.at(object, ['a[0].b.c', 'a[1]']);
  30145. * // => [3, 4]
  30146. */
  30147. var at = flatRest(baseAt);
  30148. /**
  30149. * Creates an object that inherits from the `prototype` object. If a
  30150. * `properties` object is given, its own enumerable string keyed properties
  30151. * are assigned to the created object.
  30152. *
  30153. * @static
  30154. * @memberOf _
  30155. * @since 2.3.0
  30156. * @category Object
  30157. * @param {Object} prototype The object to inherit from.
  30158. * @param {Object} [properties] The properties to assign to the object.
  30159. * @returns {Object} Returns the new object.
  30160. * @example
  30161. *
  30162. * function Shape() {
  30163. * this.x = 0;
  30164. * this.y = 0;
  30165. * }
  30166. *
  30167. * function Circle() {
  30168. * Shape.call(this);
  30169. * }
  30170. *
  30171. * Circle.prototype = _.create(Shape.prototype, {
  30172. * 'constructor': Circle
  30173. * });
  30174. *
  30175. * var circle = new Circle;
  30176. * circle instanceof Circle;
  30177. * // => true
  30178. *
  30179. * circle instanceof Shape;
  30180. * // => true
  30181. */
  30182. function create(prototype, properties) {
  30183. var result = baseCreate(prototype);
  30184. return properties == null ? result : baseAssign(result, properties);
  30185. }
  30186. /**
  30187. * Assigns own and inherited enumerable string keyed properties of source
  30188. * objects to the destination object for all destination properties that
  30189. * resolve to `undefined`. Source objects are applied from left to right.
  30190. * Once a property is set, additional values of the same property are ignored.
  30191. *
  30192. * **Note:** This method mutates `object`.
  30193. *
  30194. * @static
  30195. * @since 0.1.0
  30196. * @memberOf _
  30197. * @category Object
  30198. * @param {Object} object The destination object.
  30199. * @param {...Object} [sources] The source objects.
  30200. * @returns {Object} Returns `object`.
  30201. * @see _.defaultsDeep
  30202. * @example
  30203. *
  30204. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30205. * // => { 'a': 1, 'b': 2 }
  30206. */
  30207. var defaults = baseRest(function(object, sources) {
  30208. object = Object(object);
  30209. var index = -1;
  30210. var length = sources.length;
  30211. var guard = length > 2 ? sources[2] : undefined;
  30212. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30213. length = 1;
  30214. }
  30215. while (++index < length) {
  30216. var source = sources[index];
  30217. var props = keysIn(source);
  30218. var propsIndex = -1;
  30219. var propsLength = props.length;
  30220. while (++propsIndex < propsLength) {
  30221. var key = props[propsIndex];
  30222. var value = object[key];
  30223. if (value === undefined ||
  30224. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30225. object[key] = source[key];
  30226. }
  30227. }
  30228. }
  30229. return object;
  30230. });
  30231. /**
  30232. * This method is like `_.defaults` except that it recursively assigns
  30233. * default properties.
  30234. *
  30235. * **Note:** This method mutates `object`.
  30236. *
  30237. * @static
  30238. * @memberOf _
  30239. * @since 3.10.0
  30240. * @category Object
  30241. * @param {Object} object The destination object.
  30242. * @param {...Object} [sources] The source objects.
  30243. * @returns {Object} Returns `object`.
  30244. * @see _.defaults
  30245. * @example
  30246. *
  30247. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30248. * // => { 'a': { 'b': 2, 'c': 3 } }
  30249. */
  30250. var defaultsDeep = baseRest(function(args) {
  30251. args.push(undefined, customDefaultsMerge);
  30252. return apply(mergeWith, undefined, args);
  30253. });
  30254. /**
  30255. * This method is like `_.find` except that it returns the key of the first
  30256. * element `predicate` returns truthy for instead of the element itself.
  30257. *
  30258. * @static
  30259. * @memberOf _
  30260. * @since 1.1.0
  30261. * @category Object
  30262. * @param {Object} object The object to inspect.
  30263. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30264. * @returns {string|undefined} Returns the key of the matched element,
  30265. * else `undefined`.
  30266. * @example
  30267. *
  30268. * var users = {
  30269. * 'barney': { 'age': 36, 'active': true },
  30270. * 'fred': { 'age': 40, 'active': false },
  30271. * 'pebbles': { 'age': 1, 'active': true }
  30272. * };
  30273. *
  30274. * _.findKey(users, function(o) { return o.age < 40; });
  30275. * // => 'barney' (iteration order is not guaranteed)
  30276. *
  30277. * // The `_.matches` iteratee shorthand.
  30278. * _.findKey(users, { 'age': 1, 'active': true });
  30279. * // => 'pebbles'
  30280. *
  30281. * // The `_.matchesProperty` iteratee shorthand.
  30282. * _.findKey(users, ['active', false]);
  30283. * // => 'fred'
  30284. *
  30285. * // The `_.property` iteratee shorthand.
  30286. * _.findKey(users, 'active');
  30287. * // => 'barney'
  30288. */
  30289. function findKey(object, predicate) {
  30290. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30291. }
  30292. /**
  30293. * This method is like `_.findKey` except that it iterates over elements of
  30294. * a collection in the opposite order.
  30295. *
  30296. * @static
  30297. * @memberOf _
  30298. * @since 2.0.0
  30299. * @category Object
  30300. * @param {Object} object The object to inspect.
  30301. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30302. * @returns {string|undefined} Returns the key of the matched element,
  30303. * else `undefined`.
  30304. * @example
  30305. *
  30306. * var users = {
  30307. * 'barney': { 'age': 36, 'active': true },
  30308. * 'fred': { 'age': 40, 'active': false },
  30309. * 'pebbles': { 'age': 1, 'active': true }
  30310. * };
  30311. *
  30312. * _.findLastKey(users, function(o) { return o.age < 40; });
  30313. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30314. *
  30315. * // The `_.matches` iteratee shorthand.
  30316. * _.findLastKey(users, { 'age': 36, 'active': true });
  30317. * // => 'barney'
  30318. *
  30319. * // The `_.matchesProperty` iteratee shorthand.
  30320. * _.findLastKey(users, ['active', false]);
  30321. * // => 'fred'
  30322. *
  30323. * // The `_.property` iteratee shorthand.
  30324. * _.findLastKey(users, 'active');
  30325. * // => 'pebbles'
  30326. */
  30327. function findLastKey(object, predicate) {
  30328. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30329. }
  30330. /**
  30331. * Iterates over own and inherited enumerable string keyed properties of an
  30332. * object and invokes `iteratee` for each property. The iteratee is invoked
  30333. * with three arguments: (value, key, object). Iteratee functions may exit
  30334. * iteration early by explicitly returning `false`.
  30335. *
  30336. * @static
  30337. * @memberOf _
  30338. * @since 0.3.0
  30339. * @category Object
  30340. * @param {Object} object The object to iterate over.
  30341. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30342. * @returns {Object} Returns `object`.
  30343. * @see _.forInRight
  30344. * @example
  30345. *
  30346. * function Foo() {
  30347. * this.a = 1;
  30348. * this.b = 2;
  30349. * }
  30350. *
  30351. * Foo.prototype.c = 3;
  30352. *
  30353. * _.forIn(new Foo, function(value, key) {
  30354. * console.log(key);
  30355. * });
  30356. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30357. */
  30358. function forIn(object, iteratee) {
  30359. return object == null
  30360. ? object
  30361. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30362. }
  30363. /**
  30364. * This method is like `_.forIn` except that it iterates over properties of
  30365. * `object` in the opposite order.
  30366. *
  30367. * @static
  30368. * @memberOf _
  30369. * @since 2.0.0
  30370. * @category Object
  30371. * @param {Object} object The object to iterate over.
  30372. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30373. * @returns {Object} Returns `object`.
  30374. * @see _.forIn
  30375. * @example
  30376. *
  30377. * function Foo() {
  30378. * this.a = 1;
  30379. * this.b = 2;
  30380. * }
  30381. *
  30382. * Foo.prototype.c = 3;
  30383. *
  30384. * _.forInRight(new Foo, function(value, key) {
  30385. * console.log(key);
  30386. * });
  30387. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30388. */
  30389. function forInRight(object, iteratee) {
  30390. return object == null
  30391. ? object
  30392. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30393. }
  30394. /**
  30395. * Iterates over own enumerable string keyed properties of an object and
  30396. * invokes `iteratee` for each property. The iteratee is invoked with three
  30397. * arguments: (value, key, object). Iteratee functions may exit iteration
  30398. * early by explicitly returning `false`.
  30399. *
  30400. * @static
  30401. * @memberOf _
  30402. * @since 0.3.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 `object`.
  30407. * @see _.forOwnRight
  30408. * @example
  30409. *
  30410. * function Foo() {
  30411. * this.a = 1;
  30412. * this.b = 2;
  30413. * }
  30414. *
  30415. * Foo.prototype.c = 3;
  30416. *
  30417. * _.forOwn(new Foo, function(value, key) {
  30418. * console.log(key);
  30419. * });
  30420. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30421. */
  30422. function forOwn(object, iteratee) {
  30423. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30424. }
  30425. /**
  30426. * This method is like `_.forOwn` except that it iterates over properties of
  30427. * `object` in the opposite order.
  30428. *
  30429. * @static
  30430. * @memberOf _
  30431. * @since 2.0.0
  30432. * @category Object
  30433. * @param {Object} object The object to iterate over.
  30434. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30435. * @returns {Object} Returns `object`.
  30436. * @see _.forOwn
  30437. * @example
  30438. *
  30439. * function Foo() {
  30440. * this.a = 1;
  30441. * this.b = 2;
  30442. * }
  30443. *
  30444. * Foo.prototype.c = 3;
  30445. *
  30446. * _.forOwnRight(new Foo, function(value, key) {
  30447. * console.log(key);
  30448. * });
  30449. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30450. */
  30451. function forOwnRight(object, iteratee) {
  30452. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30453. }
  30454. /**
  30455. * Creates an array of function property names from own enumerable properties
  30456. * of `object`.
  30457. *
  30458. * @static
  30459. * @since 0.1.0
  30460. * @memberOf _
  30461. * @category Object
  30462. * @param {Object} object The object to inspect.
  30463. * @returns {Array} Returns the function names.
  30464. * @see _.functionsIn
  30465. * @example
  30466. *
  30467. * function Foo() {
  30468. * this.a = _.constant('a');
  30469. * this.b = _.constant('b');
  30470. * }
  30471. *
  30472. * Foo.prototype.c = _.constant('c');
  30473. *
  30474. * _.functions(new Foo);
  30475. * // => ['a', 'b']
  30476. */
  30477. function functions(object) {
  30478. return object == null ? [] : baseFunctions(object, keys(object));
  30479. }
  30480. /**
  30481. * Creates an array of function property names from own and inherited
  30482. * enumerable properties of `object`.
  30483. *
  30484. * @static
  30485. * @memberOf _
  30486. * @since 4.0.0
  30487. * @category Object
  30488. * @param {Object} object The object to inspect.
  30489. * @returns {Array} Returns the function names.
  30490. * @see _.functions
  30491. * @example
  30492. *
  30493. * function Foo() {
  30494. * this.a = _.constant('a');
  30495. * this.b = _.constant('b');
  30496. * }
  30497. *
  30498. * Foo.prototype.c = _.constant('c');
  30499. *
  30500. * _.functionsIn(new Foo);
  30501. * // => ['a', 'b', 'c']
  30502. */
  30503. function functionsIn(object) {
  30504. return object == null ? [] : baseFunctions(object, keysIn(object));
  30505. }
  30506. /**
  30507. * Gets the value at `path` of `object`. If the resolved value is
  30508. * `undefined`, the `defaultValue` is returned in its place.
  30509. *
  30510. * @static
  30511. * @memberOf _
  30512. * @since 3.7.0
  30513. * @category Object
  30514. * @param {Object} object The object to query.
  30515. * @param {Array|string} path The path of the property to get.
  30516. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30517. * @returns {*} Returns the resolved value.
  30518. * @example
  30519. *
  30520. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30521. *
  30522. * _.get(object, 'a[0].b.c');
  30523. * // => 3
  30524. *
  30525. * _.get(object, ['a', '0', 'b', 'c']);
  30526. * // => 3
  30527. *
  30528. * _.get(object, 'a.b.c', 'default');
  30529. * // => 'default'
  30530. */
  30531. function get(object, path, defaultValue) {
  30532. var result = object == null ? undefined : baseGet(object, path);
  30533. return result === undefined ? defaultValue : result;
  30534. }
  30535. /**
  30536. * Checks if `path` is a direct property of `object`.
  30537. *
  30538. * @static
  30539. * @since 0.1.0
  30540. * @memberOf _
  30541. * @category Object
  30542. * @param {Object} object The object to query.
  30543. * @param {Array|string} path The path to check.
  30544. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30545. * @example
  30546. *
  30547. * var object = { 'a': { 'b': 2 } };
  30548. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30549. *
  30550. * _.has(object, 'a');
  30551. * // => true
  30552. *
  30553. * _.has(object, 'a.b');
  30554. * // => true
  30555. *
  30556. * _.has(object, ['a', 'b']);
  30557. * // => true
  30558. *
  30559. * _.has(other, 'a');
  30560. * // => false
  30561. */
  30562. function has(object, path) {
  30563. return object != null && hasPath(object, path, baseHas);
  30564. }
  30565. /**
  30566. * Checks if `path` is a direct or inherited property of `object`.
  30567. *
  30568. * @static
  30569. * @memberOf _
  30570. * @since 4.0.0
  30571. * @category Object
  30572. * @param {Object} object The object to query.
  30573. * @param {Array|string} path The path to check.
  30574. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30575. * @example
  30576. *
  30577. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30578. *
  30579. * _.hasIn(object, 'a');
  30580. * // => true
  30581. *
  30582. * _.hasIn(object, 'a.b');
  30583. * // => true
  30584. *
  30585. * _.hasIn(object, ['a', 'b']);
  30586. * // => true
  30587. *
  30588. * _.hasIn(object, 'b');
  30589. * // => false
  30590. */
  30591. function hasIn(object, path) {
  30592. return object != null && hasPath(object, path, baseHasIn);
  30593. }
  30594. /**
  30595. * Creates an object composed of the inverted keys and values of `object`.
  30596. * If `object` contains duplicate values, subsequent values overwrite
  30597. * property assignments of previous values.
  30598. *
  30599. * @static
  30600. * @memberOf _
  30601. * @since 0.7.0
  30602. * @category Object
  30603. * @param {Object} object The object to invert.
  30604. * @returns {Object} Returns the new inverted object.
  30605. * @example
  30606. *
  30607. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30608. *
  30609. * _.invert(object);
  30610. * // => { '1': 'c', '2': 'b' }
  30611. */
  30612. var invert = createInverter(function(result, value, key) {
  30613. if (value != null &&
  30614. typeof value.toString != 'function') {
  30615. value = nativeObjectToString.call(value);
  30616. }
  30617. result[value] = key;
  30618. }, constant(identity));
  30619. /**
  30620. * This method is like `_.invert` except that the inverted object is generated
  30621. * from the results of running each element of `object` thru `iteratee`. The
  30622. * corresponding inverted value of each inverted key is an array of keys
  30623. * responsible for generating the inverted value. The iteratee is invoked
  30624. * with one argument: (value).
  30625. *
  30626. * @static
  30627. * @memberOf _
  30628. * @since 4.1.0
  30629. * @category Object
  30630. * @param {Object} object The object to invert.
  30631. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30632. * @returns {Object} Returns the new inverted object.
  30633. * @example
  30634. *
  30635. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30636. *
  30637. * _.invertBy(object);
  30638. * // => { '1': ['a', 'c'], '2': ['b'] }
  30639. *
  30640. * _.invertBy(object, function(value) {
  30641. * return 'group' + value;
  30642. * });
  30643. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30644. */
  30645. var invertBy = createInverter(function(result, value, key) {
  30646. if (value != null &&
  30647. typeof value.toString != 'function') {
  30648. value = nativeObjectToString.call(value);
  30649. }
  30650. if (hasOwnProperty.call(result, value)) {
  30651. result[value].push(key);
  30652. } else {
  30653. result[value] = [key];
  30654. }
  30655. }, getIteratee);
  30656. /**
  30657. * Invokes the method at `path` of `object`.
  30658. *
  30659. * @static
  30660. * @memberOf _
  30661. * @since 4.0.0
  30662. * @category Object
  30663. * @param {Object} object The object to query.
  30664. * @param {Array|string} path The path of the method to invoke.
  30665. * @param {...*} [args] The arguments to invoke the method with.
  30666. * @returns {*} Returns the result of the invoked method.
  30667. * @example
  30668. *
  30669. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30670. *
  30671. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30672. * // => [2, 3]
  30673. */
  30674. var invoke = baseRest(baseInvoke);
  30675. /**
  30676. * Creates an array of the own enumerable property names of `object`.
  30677. *
  30678. * **Note:** Non-object values are coerced to objects. See the
  30679. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30680. * for more details.
  30681. *
  30682. * @static
  30683. * @since 0.1.0
  30684. * @memberOf _
  30685. * @category Object
  30686. * @param {Object} object The object to query.
  30687. * @returns {Array} Returns the array of property names.
  30688. * @example
  30689. *
  30690. * function Foo() {
  30691. * this.a = 1;
  30692. * this.b = 2;
  30693. * }
  30694. *
  30695. * Foo.prototype.c = 3;
  30696. *
  30697. * _.keys(new Foo);
  30698. * // => ['a', 'b'] (iteration order is not guaranteed)
  30699. *
  30700. * _.keys('hi');
  30701. * // => ['0', '1']
  30702. */
  30703. function keys(object) {
  30704. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30705. }
  30706. /**
  30707. * Creates an array of the own and inherited enumerable property names of `object`.
  30708. *
  30709. * **Note:** Non-object values are coerced to objects.
  30710. *
  30711. * @static
  30712. * @memberOf _
  30713. * @since 3.0.0
  30714. * @category Object
  30715. * @param {Object} object The object to query.
  30716. * @returns {Array} Returns the array of property names.
  30717. * @example
  30718. *
  30719. * function Foo() {
  30720. * this.a = 1;
  30721. * this.b = 2;
  30722. * }
  30723. *
  30724. * Foo.prototype.c = 3;
  30725. *
  30726. * _.keysIn(new Foo);
  30727. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30728. */
  30729. function keysIn(object) {
  30730. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30731. }
  30732. /**
  30733. * The opposite of `_.mapValues`; this method creates an object with the
  30734. * same values as `object` and keys generated by running each own enumerable
  30735. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30736. * with three arguments: (value, key, object).
  30737. *
  30738. * @static
  30739. * @memberOf _
  30740. * @since 3.8.0
  30741. * @category Object
  30742. * @param {Object} object The object to iterate over.
  30743. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30744. * @returns {Object} Returns the new mapped object.
  30745. * @see _.mapValues
  30746. * @example
  30747. *
  30748. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30749. * return key + value;
  30750. * });
  30751. * // => { 'a1': 1, 'b2': 2 }
  30752. */
  30753. function mapKeys(object, iteratee) {
  30754. var result = {};
  30755. iteratee = getIteratee(iteratee, 3);
  30756. baseForOwn(object, function(value, key, object) {
  30757. baseAssignValue(result, iteratee(value, key, object), value);
  30758. });
  30759. return result;
  30760. }
  30761. /**
  30762. * Creates an object with the same keys as `object` and values generated
  30763. * by running each own enumerable string keyed property of `object` thru
  30764. * `iteratee`. The iteratee is invoked with three arguments:
  30765. * (value, key, object).
  30766. *
  30767. * @static
  30768. * @memberOf _
  30769. * @since 2.4.0
  30770. * @category Object
  30771. * @param {Object} object The object to iterate over.
  30772. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30773. * @returns {Object} Returns the new mapped object.
  30774. * @see _.mapKeys
  30775. * @example
  30776. *
  30777. * var users = {
  30778. * 'fred': { 'user': 'fred', 'age': 40 },
  30779. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30780. * };
  30781. *
  30782. * _.mapValues(users, function(o) { return o.age; });
  30783. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30784. *
  30785. * // The `_.property` iteratee shorthand.
  30786. * _.mapValues(users, 'age');
  30787. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30788. */
  30789. function mapValues(object, iteratee) {
  30790. var result = {};
  30791. iteratee = getIteratee(iteratee, 3);
  30792. baseForOwn(object, function(value, key, object) {
  30793. baseAssignValue(result, key, iteratee(value, key, object));
  30794. });
  30795. return result;
  30796. }
  30797. /**
  30798. * This method is like `_.assign` except that it recursively merges own and
  30799. * inherited enumerable string keyed properties of source objects into the
  30800. * destination object. Source properties that resolve to `undefined` are
  30801. * skipped if a destination value exists. Array and plain object properties
  30802. * are merged recursively. Other objects and value types are overridden by
  30803. * assignment. Source objects are applied from left to right. Subsequent
  30804. * sources overwrite property assignments of previous sources.
  30805. *
  30806. * **Note:** This method mutates `object`.
  30807. *
  30808. * @static
  30809. * @memberOf _
  30810. * @since 0.5.0
  30811. * @category Object
  30812. * @param {Object} object The destination object.
  30813. * @param {...Object} [sources] The source objects.
  30814. * @returns {Object} Returns `object`.
  30815. * @example
  30816. *
  30817. * var object = {
  30818. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30819. * };
  30820. *
  30821. * var other = {
  30822. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30823. * };
  30824. *
  30825. * _.merge(object, other);
  30826. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30827. */
  30828. var merge = createAssigner(function(object, source, srcIndex) {
  30829. baseMerge(object, source, srcIndex);
  30830. });
  30831. /**
  30832. * This method is like `_.merge` except that it accepts `customizer` which
  30833. * is invoked to produce the merged values of the destination and source
  30834. * properties. If `customizer` returns `undefined`, merging is handled by the
  30835. * method instead. The `customizer` is invoked with six arguments:
  30836. * (objValue, srcValue, key, object, source, stack).
  30837. *
  30838. * **Note:** This method mutates `object`.
  30839. *
  30840. * @static
  30841. * @memberOf _
  30842. * @since 4.0.0
  30843. * @category Object
  30844. * @param {Object} object The destination object.
  30845. * @param {...Object} sources The source objects.
  30846. * @param {Function} customizer The function to customize assigned values.
  30847. * @returns {Object} Returns `object`.
  30848. * @example
  30849. *
  30850. * function customizer(objValue, srcValue) {
  30851. * if (_.isArray(objValue)) {
  30852. * return objValue.concat(srcValue);
  30853. * }
  30854. * }
  30855. *
  30856. * var object = { 'a': [1], 'b': [2] };
  30857. * var other = { 'a': [3], 'b': [4] };
  30858. *
  30859. * _.mergeWith(object, other, customizer);
  30860. * // => { 'a': [1, 3], 'b': [2, 4] }
  30861. */
  30862. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30863. baseMerge(object, source, srcIndex, customizer);
  30864. });
  30865. /**
  30866. * The opposite of `_.pick`; this method creates an object composed of the
  30867. * own and inherited enumerable property paths of `object` that are not omitted.
  30868. *
  30869. * **Note:** This method is considerably slower than `_.pick`.
  30870. *
  30871. * @static
  30872. * @since 0.1.0
  30873. * @memberOf _
  30874. * @category Object
  30875. * @param {Object} object The source object.
  30876. * @param {...(string|string[])} [paths] The property paths to omit.
  30877. * @returns {Object} Returns the new object.
  30878. * @example
  30879. *
  30880. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30881. *
  30882. * _.omit(object, ['a', 'c']);
  30883. * // => { 'b': '2' }
  30884. */
  30885. var omit = flatRest(function(object, paths) {
  30886. var result = {};
  30887. if (object == null) {
  30888. return result;
  30889. }
  30890. var isDeep = false;
  30891. paths = arrayMap(paths, function(path) {
  30892. path = castPath(path, object);
  30893. isDeep || (isDeep = path.length > 1);
  30894. return path;
  30895. });
  30896. copyObject(object, getAllKeysIn(object), result);
  30897. if (isDeep) {
  30898. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30899. }
  30900. var length = paths.length;
  30901. while (length--) {
  30902. baseUnset(result, paths[length]);
  30903. }
  30904. return result;
  30905. });
  30906. /**
  30907. * The opposite of `_.pickBy`; this method creates an object composed of
  30908. * the own and inherited enumerable string keyed properties of `object` that
  30909. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30910. * arguments: (value, key).
  30911. *
  30912. * @static
  30913. * @memberOf _
  30914. * @since 4.0.0
  30915. * @category Object
  30916. * @param {Object} object The source object.
  30917. * @param {Function} [predicate=_.identity] The function invoked per property.
  30918. * @returns {Object} Returns the new object.
  30919. * @example
  30920. *
  30921. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30922. *
  30923. * _.omitBy(object, _.isNumber);
  30924. * // => { 'b': '2' }
  30925. */
  30926. function omitBy(object, predicate) {
  30927. return pickBy(object, negate(getIteratee(predicate)));
  30928. }
  30929. /**
  30930. * Creates an object composed of the picked `object` properties.
  30931. *
  30932. * @static
  30933. * @since 0.1.0
  30934. * @memberOf _
  30935. * @category Object
  30936. * @param {Object} object The source object.
  30937. * @param {...(string|string[])} [paths] The property paths to pick.
  30938. * @returns {Object} Returns the new object.
  30939. * @example
  30940. *
  30941. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30942. *
  30943. * _.pick(object, ['a', 'c']);
  30944. * // => { 'a': 1, 'c': 3 }
  30945. */
  30946. var pick = flatRest(function(object, paths) {
  30947. return object == null ? {} : basePick(object, paths);
  30948. });
  30949. /**
  30950. * Creates an object composed of the `object` properties `predicate` returns
  30951. * truthy for. The predicate is invoked with two arguments: (value, key).
  30952. *
  30953. * @static
  30954. * @memberOf _
  30955. * @since 4.0.0
  30956. * @category Object
  30957. * @param {Object} object The source object.
  30958. * @param {Function} [predicate=_.identity] The function invoked per property.
  30959. * @returns {Object} Returns the new object.
  30960. * @example
  30961. *
  30962. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30963. *
  30964. * _.pickBy(object, _.isNumber);
  30965. * // => { 'a': 1, 'c': 3 }
  30966. */
  30967. function pickBy(object, predicate) {
  30968. if (object == null) {
  30969. return {};
  30970. }
  30971. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30972. return [prop];
  30973. });
  30974. predicate = getIteratee(predicate);
  30975. return basePickBy(object, props, function(value, path) {
  30976. return predicate(value, path[0]);
  30977. });
  30978. }
  30979. /**
  30980. * This method is like `_.get` except that if the resolved value is a
  30981. * function it's invoked with the `this` binding of its parent object and
  30982. * its result is returned.
  30983. *
  30984. * @static
  30985. * @since 0.1.0
  30986. * @memberOf _
  30987. * @category Object
  30988. * @param {Object} object The object to query.
  30989. * @param {Array|string} path The path of the property to resolve.
  30990. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30991. * @returns {*} Returns the resolved value.
  30992. * @example
  30993. *
  30994. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30995. *
  30996. * _.result(object, 'a[0].b.c1');
  30997. * // => 3
  30998. *
  30999. * _.result(object, 'a[0].b.c2');
  31000. * // => 4
  31001. *
  31002. * _.result(object, 'a[0].b.c3', 'default');
  31003. * // => 'default'
  31004. *
  31005. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31006. * // => 'default'
  31007. */
  31008. function result(object, path, defaultValue) {
  31009. path = castPath(path, object);
  31010. var index = -1,
  31011. length = path.length;
  31012. // Ensure the loop is entered when path is empty.
  31013. if (!length) {
  31014. length = 1;
  31015. object = undefined;
  31016. }
  31017. while (++index < length) {
  31018. var value = object == null ? undefined : object[toKey(path[index])];
  31019. if (value === undefined) {
  31020. index = length;
  31021. value = defaultValue;
  31022. }
  31023. object = isFunction(value) ? value.call(object) : value;
  31024. }
  31025. return object;
  31026. }
  31027. /**
  31028. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31029. * it's created. Arrays are created for missing index properties while objects
  31030. * are created for all other missing properties. Use `_.setWith` to customize
  31031. * `path` creation.
  31032. *
  31033. * **Note:** This method mutates `object`.
  31034. *
  31035. * @static
  31036. * @memberOf _
  31037. * @since 3.7.0
  31038. * @category Object
  31039. * @param {Object} object The object to modify.
  31040. * @param {Array|string} path The path of the property to set.
  31041. * @param {*} value The value to set.
  31042. * @returns {Object} Returns `object`.
  31043. * @example
  31044. *
  31045. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31046. *
  31047. * _.set(object, 'a[0].b.c', 4);
  31048. * console.log(object.a[0].b.c);
  31049. * // => 4
  31050. *
  31051. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31052. * console.log(object.x[0].y.z);
  31053. * // => 5
  31054. */
  31055. function set(object, path, value) {
  31056. return object == null ? object : baseSet(object, path, value);
  31057. }
  31058. /**
  31059. * This method is like `_.set` except that it accepts `customizer` which is
  31060. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31061. * path creation is handled by the method instead. The `customizer` is invoked
  31062. * with three arguments: (nsValue, key, nsObject).
  31063. *
  31064. * **Note:** This method mutates `object`.
  31065. *
  31066. * @static
  31067. * @memberOf _
  31068. * @since 4.0.0
  31069. * @category Object
  31070. * @param {Object} object The object to modify.
  31071. * @param {Array|string} path The path of the property to set.
  31072. * @param {*} value The value to set.
  31073. * @param {Function} [customizer] The function to customize assigned values.
  31074. * @returns {Object} Returns `object`.
  31075. * @example
  31076. *
  31077. * var object = {};
  31078. *
  31079. * _.setWith(object, '[0][1]', 'a', Object);
  31080. * // => { '0': { '1': 'a' } }
  31081. */
  31082. function setWith(object, path, value, customizer) {
  31083. customizer = typeof customizer == 'function' ? customizer : undefined;
  31084. return object == null ? object : baseSet(object, path, value, customizer);
  31085. }
  31086. /**
  31087. * Creates an array of own enumerable string keyed-value pairs for `object`
  31088. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31089. * entries are returned.
  31090. *
  31091. * @static
  31092. * @memberOf _
  31093. * @since 4.0.0
  31094. * @alias entries
  31095. * @category Object
  31096. * @param {Object} object The object to query.
  31097. * @returns {Array} Returns the key-value pairs.
  31098. * @example
  31099. *
  31100. * function Foo() {
  31101. * this.a = 1;
  31102. * this.b = 2;
  31103. * }
  31104. *
  31105. * Foo.prototype.c = 3;
  31106. *
  31107. * _.toPairs(new Foo);
  31108. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31109. */
  31110. var toPairs = createToPairs(keys);
  31111. /**
  31112. * Creates an array of own and inherited enumerable string keyed-value pairs
  31113. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31114. * or set, its entries are returned.
  31115. *
  31116. * @static
  31117. * @memberOf _
  31118. * @since 4.0.0
  31119. * @alias entriesIn
  31120. * @category Object
  31121. * @param {Object} object The object to query.
  31122. * @returns {Array} Returns the key-value pairs.
  31123. * @example
  31124. *
  31125. * function Foo() {
  31126. * this.a = 1;
  31127. * this.b = 2;
  31128. * }
  31129. *
  31130. * Foo.prototype.c = 3;
  31131. *
  31132. * _.toPairsIn(new Foo);
  31133. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31134. */
  31135. var toPairsIn = createToPairs(keysIn);
  31136. /**
  31137. * An alternative to `_.reduce`; this method transforms `object` to a new
  31138. * `accumulator` object which is the result of running each of its own
  31139. * enumerable string keyed properties thru `iteratee`, with each invocation
  31140. * potentially mutating the `accumulator` object. If `accumulator` is not
  31141. * provided, a new object with the same `[[Prototype]]` will be used. The
  31142. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31143. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31144. *
  31145. * @static
  31146. * @memberOf _
  31147. * @since 1.3.0
  31148. * @category Object
  31149. * @param {Object} object The object to iterate over.
  31150. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31151. * @param {*} [accumulator] The custom accumulator value.
  31152. * @returns {*} Returns the accumulated value.
  31153. * @example
  31154. *
  31155. * _.transform([2, 3, 4], function(result, n) {
  31156. * result.push(n *= n);
  31157. * return n % 2 == 0;
  31158. * }, []);
  31159. * // => [4, 9]
  31160. *
  31161. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31162. * (result[value] || (result[value] = [])).push(key);
  31163. * }, {});
  31164. * // => { '1': ['a', 'c'], '2': ['b'] }
  31165. */
  31166. function transform(object, iteratee, accumulator) {
  31167. var isArr = isArray(object),
  31168. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31169. iteratee = getIteratee(iteratee, 4);
  31170. if (accumulator == null) {
  31171. var Ctor = object && object.constructor;
  31172. if (isArrLike) {
  31173. accumulator = isArr ? new Ctor : [];
  31174. }
  31175. else if (isObject(object)) {
  31176. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31177. }
  31178. else {
  31179. accumulator = {};
  31180. }
  31181. }
  31182. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31183. return iteratee(accumulator, value, index, object);
  31184. });
  31185. return accumulator;
  31186. }
  31187. /**
  31188. * Removes the property at `path` of `object`.
  31189. *
  31190. * **Note:** This method mutates `object`.
  31191. *
  31192. * @static
  31193. * @memberOf _
  31194. * @since 4.0.0
  31195. * @category Object
  31196. * @param {Object} object The object to modify.
  31197. * @param {Array|string} path The path of the property to unset.
  31198. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31199. * @example
  31200. *
  31201. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31202. * _.unset(object, 'a[0].b.c');
  31203. * // => true
  31204. *
  31205. * console.log(object);
  31206. * // => { 'a': [{ 'b': {} }] };
  31207. *
  31208. * _.unset(object, ['a', '0', 'b', 'c']);
  31209. * // => true
  31210. *
  31211. * console.log(object);
  31212. * // => { 'a': [{ 'b': {} }] };
  31213. */
  31214. function unset(object, path) {
  31215. return object == null ? true : baseUnset(object, path);
  31216. }
  31217. /**
  31218. * This method is like `_.set` except that accepts `updater` to produce the
  31219. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31220. * is invoked with one argument: (value).
  31221. *
  31222. * **Note:** This method mutates `object`.
  31223. *
  31224. * @static
  31225. * @memberOf _
  31226. * @since 4.6.0
  31227. * @category Object
  31228. * @param {Object} object The object to modify.
  31229. * @param {Array|string} path The path of the property to set.
  31230. * @param {Function} updater The function to produce the updated value.
  31231. * @returns {Object} Returns `object`.
  31232. * @example
  31233. *
  31234. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31235. *
  31236. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31237. * console.log(object.a[0].b.c);
  31238. * // => 9
  31239. *
  31240. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31241. * console.log(object.x[0].y.z);
  31242. * // => 0
  31243. */
  31244. function update(object, path, updater) {
  31245. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31246. }
  31247. /**
  31248. * This method is like `_.update` except that it accepts `customizer` which is
  31249. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31250. * path creation is handled by the method instead. The `customizer` is invoked
  31251. * with three arguments: (nsValue, key, nsObject).
  31252. *
  31253. * **Note:** This method mutates `object`.
  31254. *
  31255. * @static
  31256. * @memberOf _
  31257. * @since 4.6.0
  31258. * @category Object
  31259. * @param {Object} object The object to modify.
  31260. * @param {Array|string} path The path of the property to set.
  31261. * @param {Function} updater The function to produce the updated value.
  31262. * @param {Function} [customizer] The function to customize assigned values.
  31263. * @returns {Object} Returns `object`.
  31264. * @example
  31265. *
  31266. * var object = {};
  31267. *
  31268. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31269. * // => { '0': { '1': 'a' } }
  31270. */
  31271. function updateWith(object, path, updater, customizer) {
  31272. customizer = typeof customizer == 'function' ? customizer : undefined;
  31273. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31274. }
  31275. /**
  31276. * Creates an array of the own enumerable string keyed property values of `object`.
  31277. *
  31278. * **Note:** Non-object values are coerced to objects.
  31279. *
  31280. * @static
  31281. * @since 0.1.0
  31282. * @memberOf _
  31283. * @category Object
  31284. * @param {Object} object The object to query.
  31285. * @returns {Array} Returns the array of property values.
  31286. * @example
  31287. *
  31288. * function Foo() {
  31289. * this.a = 1;
  31290. * this.b = 2;
  31291. * }
  31292. *
  31293. * Foo.prototype.c = 3;
  31294. *
  31295. * _.values(new Foo);
  31296. * // => [1, 2] (iteration order is not guaranteed)
  31297. *
  31298. * _.values('hi');
  31299. * // => ['h', 'i']
  31300. */
  31301. function values(object) {
  31302. return object == null ? [] : baseValues(object, keys(object));
  31303. }
  31304. /**
  31305. * Creates an array of the own and inherited enumerable string keyed property
  31306. * values of `object`.
  31307. *
  31308. * **Note:** Non-object values are coerced to objects.
  31309. *
  31310. * @static
  31311. * @memberOf _
  31312. * @since 3.0.0
  31313. * @category Object
  31314. * @param {Object} object The object to query.
  31315. * @returns {Array} Returns the array of property values.
  31316. * @example
  31317. *
  31318. * function Foo() {
  31319. * this.a = 1;
  31320. * this.b = 2;
  31321. * }
  31322. *
  31323. * Foo.prototype.c = 3;
  31324. *
  31325. * _.valuesIn(new Foo);
  31326. * // => [1, 2, 3] (iteration order is not guaranteed)
  31327. */
  31328. function valuesIn(object) {
  31329. return object == null ? [] : baseValues(object, keysIn(object));
  31330. }
  31331. /*------------------------------------------------------------------------*/
  31332. /**
  31333. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31334. *
  31335. * @static
  31336. * @memberOf _
  31337. * @since 4.0.0
  31338. * @category Number
  31339. * @param {number} number The number to clamp.
  31340. * @param {number} [lower] The lower bound.
  31341. * @param {number} upper The upper bound.
  31342. * @returns {number} Returns the clamped number.
  31343. * @example
  31344. *
  31345. * _.clamp(-10, -5, 5);
  31346. * // => -5
  31347. *
  31348. * _.clamp(10, -5, 5);
  31349. * // => 5
  31350. */
  31351. function clamp(number, lower, upper) {
  31352. if (upper === undefined) {
  31353. upper = lower;
  31354. lower = undefined;
  31355. }
  31356. if (upper !== undefined) {
  31357. upper = toNumber(upper);
  31358. upper = upper === upper ? upper : 0;
  31359. }
  31360. if (lower !== undefined) {
  31361. lower = toNumber(lower);
  31362. lower = lower === lower ? lower : 0;
  31363. }
  31364. return baseClamp(toNumber(number), lower, upper);
  31365. }
  31366. /**
  31367. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31368. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31369. * If `start` is greater than `end` the params are swapped to support
  31370. * negative ranges.
  31371. *
  31372. * @static
  31373. * @memberOf _
  31374. * @since 3.3.0
  31375. * @category Number
  31376. * @param {number} number The number to check.
  31377. * @param {number} [start=0] The start of the range.
  31378. * @param {number} end The end of the range.
  31379. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31380. * @see _.range, _.rangeRight
  31381. * @example
  31382. *
  31383. * _.inRange(3, 2, 4);
  31384. * // => true
  31385. *
  31386. * _.inRange(4, 8);
  31387. * // => true
  31388. *
  31389. * _.inRange(4, 2);
  31390. * // => false
  31391. *
  31392. * _.inRange(2, 2);
  31393. * // => false
  31394. *
  31395. * _.inRange(1.2, 2);
  31396. * // => true
  31397. *
  31398. * _.inRange(5.2, 4);
  31399. * // => false
  31400. *
  31401. * _.inRange(-3, -2, -6);
  31402. * // => true
  31403. */
  31404. function inRange(number, start, end) {
  31405. start = toFinite(start);
  31406. if (end === undefined) {
  31407. end = start;
  31408. start = 0;
  31409. } else {
  31410. end = toFinite(end);
  31411. }
  31412. number = toNumber(number);
  31413. return baseInRange(number, start, end);
  31414. }
  31415. /**
  31416. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31417. * If only one argument is provided a number between `0` and the given number
  31418. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31419. * floats, a floating-point number is returned instead of an integer.
  31420. *
  31421. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31422. * floating-point values which can produce unexpected results.
  31423. *
  31424. * @static
  31425. * @memberOf _
  31426. * @since 0.7.0
  31427. * @category Number
  31428. * @param {number} [lower=0] The lower bound.
  31429. * @param {number} [upper=1] The upper bound.
  31430. * @param {boolean} [floating] Specify returning a floating-point number.
  31431. * @returns {number} Returns the random number.
  31432. * @example
  31433. *
  31434. * _.random(0, 5);
  31435. * // => an integer between 0 and 5
  31436. *
  31437. * _.random(5);
  31438. * // => also an integer between 0 and 5
  31439. *
  31440. * _.random(5, true);
  31441. * // => a floating-point number between 0 and 5
  31442. *
  31443. * _.random(1.2, 5.2);
  31444. * // => a floating-point number between 1.2 and 5.2
  31445. */
  31446. function random(lower, upper, floating) {
  31447. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31448. upper = floating = undefined;
  31449. }
  31450. if (floating === undefined) {
  31451. if (typeof upper == 'boolean') {
  31452. floating = upper;
  31453. upper = undefined;
  31454. }
  31455. else if (typeof lower == 'boolean') {
  31456. floating = lower;
  31457. lower = undefined;
  31458. }
  31459. }
  31460. if (lower === undefined && upper === undefined) {
  31461. lower = 0;
  31462. upper = 1;
  31463. }
  31464. else {
  31465. lower = toFinite(lower);
  31466. if (upper === undefined) {
  31467. upper = lower;
  31468. lower = 0;
  31469. } else {
  31470. upper = toFinite(upper);
  31471. }
  31472. }
  31473. if (lower > upper) {
  31474. var temp = lower;
  31475. lower = upper;
  31476. upper = temp;
  31477. }
  31478. if (floating || lower % 1 || upper % 1) {
  31479. var rand = nativeRandom();
  31480. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31481. }
  31482. return baseRandom(lower, upper);
  31483. }
  31484. /*------------------------------------------------------------------------*/
  31485. /**
  31486. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31487. *
  31488. * @static
  31489. * @memberOf _
  31490. * @since 3.0.0
  31491. * @category String
  31492. * @param {string} [string=''] The string to convert.
  31493. * @returns {string} Returns the camel cased string.
  31494. * @example
  31495. *
  31496. * _.camelCase('Foo Bar');
  31497. * // => 'fooBar'
  31498. *
  31499. * _.camelCase('--foo-bar--');
  31500. * // => 'fooBar'
  31501. *
  31502. * _.camelCase('__FOO_BAR__');
  31503. * // => 'fooBar'
  31504. */
  31505. var camelCase = createCompounder(function(result, word, index) {
  31506. word = word.toLowerCase();
  31507. return result + (index ? capitalize(word) : word);
  31508. });
  31509. /**
  31510. * Converts the first character of `string` to upper case and the remaining
  31511. * to lower case.
  31512. *
  31513. * @static
  31514. * @memberOf _
  31515. * @since 3.0.0
  31516. * @category String
  31517. * @param {string} [string=''] The string to capitalize.
  31518. * @returns {string} Returns the capitalized string.
  31519. * @example
  31520. *
  31521. * _.capitalize('FRED');
  31522. * // => 'Fred'
  31523. */
  31524. function capitalize(string) {
  31525. return upperFirst(toString(string).toLowerCase());
  31526. }
  31527. /**
  31528. * Deburrs `string` by converting
  31529. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31530. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31531. * letters to basic Latin letters and removing
  31532. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31533. *
  31534. * @static
  31535. * @memberOf _
  31536. * @since 3.0.0
  31537. * @category String
  31538. * @param {string} [string=''] The string to deburr.
  31539. * @returns {string} Returns the deburred string.
  31540. * @example
  31541. *
  31542. * _.deburr('déjà vu');
  31543. * // => 'deja vu'
  31544. */
  31545. function deburr(string) {
  31546. string = toString(string);
  31547. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31548. }
  31549. /**
  31550. * Checks if `string` ends with the given target string.
  31551. *
  31552. * @static
  31553. * @memberOf _
  31554. * @since 3.0.0
  31555. * @category String
  31556. * @param {string} [string=''] The string to inspect.
  31557. * @param {string} [target] The string to search for.
  31558. * @param {number} [position=string.length] The position to search up to.
  31559. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31560. * else `false`.
  31561. * @example
  31562. *
  31563. * _.endsWith('abc', 'c');
  31564. * // => true
  31565. *
  31566. * _.endsWith('abc', 'b');
  31567. * // => false
  31568. *
  31569. * _.endsWith('abc', 'b', 2);
  31570. * // => true
  31571. */
  31572. function endsWith(string, target, position) {
  31573. string = toString(string);
  31574. target = baseToString(target);
  31575. var length = string.length;
  31576. position = position === undefined
  31577. ? length
  31578. : baseClamp(toInteger(position), 0, length);
  31579. var end = position;
  31580. position -= target.length;
  31581. return position >= 0 && string.slice(position, end) == target;
  31582. }
  31583. /**
  31584. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31585. * corresponding HTML entities.
  31586. *
  31587. * **Note:** No other characters are escaped. To escape additional
  31588. * characters use a third-party library like [_he_](https://mths.be/he).
  31589. *
  31590. * Though the ">" character is escaped for symmetry, characters like
  31591. * ">" and "/" don't need escaping in HTML and have no special meaning
  31592. * unless they're part of a tag or unquoted attribute value. See
  31593. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31594. * (under "semi-related fun fact") for more details.
  31595. *
  31596. * When working with HTML you should always
  31597. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31598. * XSS vectors.
  31599. *
  31600. * @static
  31601. * @since 0.1.0
  31602. * @memberOf _
  31603. * @category String
  31604. * @param {string} [string=''] The string to escape.
  31605. * @returns {string} Returns the escaped string.
  31606. * @example
  31607. *
  31608. * _.escape('fred, barney, & pebbles');
  31609. * // => 'fred, barney, &amp; pebbles'
  31610. */
  31611. function escape(string) {
  31612. string = toString(string);
  31613. return (string && reHasUnescapedHtml.test(string))
  31614. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31615. : string;
  31616. }
  31617. /**
  31618. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31619. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31620. *
  31621. * @static
  31622. * @memberOf _
  31623. * @since 3.0.0
  31624. * @category String
  31625. * @param {string} [string=''] The string to escape.
  31626. * @returns {string} Returns the escaped string.
  31627. * @example
  31628. *
  31629. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31630. * // => '\[lodash\]\(https://lodash\.com/\)'
  31631. */
  31632. function escapeRegExp(string) {
  31633. string = toString(string);
  31634. return (string && reHasRegExpChar.test(string))
  31635. ? string.replace(reRegExpChar, '\\$&')
  31636. : string;
  31637. }
  31638. /**
  31639. * Converts `string` to
  31640. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31641. *
  31642. * @static
  31643. * @memberOf _
  31644. * @since 3.0.0
  31645. * @category String
  31646. * @param {string} [string=''] The string to convert.
  31647. * @returns {string} Returns the kebab cased string.
  31648. * @example
  31649. *
  31650. * _.kebabCase('Foo Bar');
  31651. * // => 'foo-bar'
  31652. *
  31653. * _.kebabCase('fooBar');
  31654. * // => 'foo-bar'
  31655. *
  31656. * _.kebabCase('__FOO_BAR__');
  31657. * // => 'foo-bar'
  31658. */
  31659. var kebabCase = createCompounder(function(result, word, index) {
  31660. return result + (index ? '-' : '') + word.toLowerCase();
  31661. });
  31662. /**
  31663. * Converts `string`, as space separated words, to lower case.
  31664. *
  31665. * @static
  31666. * @memberOf _
  31667. * @since 4.0.0
  31668. * @category String
  31669. * @param {string} [string=''] The string to convert.
  31670. * @returns {string} Returns the lower cased string.
  31671. * @example
  31672. *
  31673. * _.lowerCase('--Foo-Bar--');
  31674. * // => 'foo bar'
  31675. *
  31676. * _.lowerCase('fooBar');
  31677. * // => 'foo bar'
  31678. *
  31679. * _.lowerCase('__FOO_BAR__');
  31680. * // => 'foo bar'
  31681. */
  31682. var lowerCase = createCompounder(function(result, word, index) {
  31683. return result + (index ? ' ' : '') + word.toLowerCase();
  31684. });
  31685. /**
  31686. * Converts the first character of `string` to lower case.
  31687. *
  31688. * @static
  31689. * @memberOf _
  31690. * @since 4.0.0
  31691. * @category String
  31692. * @param {string} [string=''] The string to convert.
  31693. * @returns {string} Returns the converted string.
  31694. * @example
  31695. *
  31696. * _.lowerFirst('Fred');
  31697. * // => 'fred'
  31698. *
  31699. * _.lowerFirst('FRED');
  31700. * // => 'fRED'
  31701. */
  31702. var lowerFirst = createCaseFirst('toLowerCase');
  31703. /**
  31704. * Pads `string` on the left and right sides if it's shorter than `length`.
  31705. * Padding characters are truncated if they can't be evenly divided by `length`.
  31706. *
  31707. * @static
  31708. * @memberOf _
  31709. * @since 3.0.0
  31710. * @category String
  31711. * @param {string} [string=''] The string to pad.
  31712. * @param {number} [length=0] The padding length.
  31713. * @param {string} [chars=' '] The string used as padding.
  31714. * @returns {string} Returns the padded string.
  31715. * @example
  31716. *
  31717. * _.pad('abc', 8);
  31718. * // => ' abc '
  31719. *
  31720. * _.pad('abc', 8, '_-');
  31721. * // => '_-abc_-_'
  31722. *
  31723. * _.pad('abc', 3);
  31724. * // => 'abc'
  31725. */
  31726. function pad(string, length, chars) {
  31727. string = toString(string);
  31728. length = toInteger(length);
  31729. var strLength = length ? stringSize(string) : 0;
  31730. if (!length || strLength >= length) {
  31731. return string;
  31732. }
  31733. var mid = (length - strLength) / 2;
  31734. return (
  31735. createPadding(nativeFloor(mid), chars) +
  31736. string +
  31737. createPadding(nativeCeil(mid), chars)
  31738. );
  31739. }
  31740. /**
  31741. * Pads `string` on the right side if it's shorter than `length`. Padding
  31742. * characters are truncated if they exceed `length`.
  31743. *
  31744. * @static
  31745. * @memberOf _
  31746. * @since 4.0.0
  31747. * @category String
  31748. * @param {string} [string=''] The string to pad.
  31749. * @param {number} [length=0] The padding length.
  31750. * @param {string} [chars=' '] The string used as padding.
  31751. * @returns {string} Returns the padded string.
  31752. * @example
  31753. *
  31754. * _.padEnd('abc', 6);
  31755. * // => 'abc '
  31756. *
  31757. * _.padEnd('abc', 6, '_-');
  31758. * // => 'abc_-_'
  31759. *
  31760. * _.padEnd('abc', 3);
  31761. * // => 'abc'
  31762. */
  31763. function padEnd(string, length, chars) {
  31764. string = toString(string);
  31765. length = toInteger(length);
  31766. var strLength = length ? stringSize(string) : 0;
  31767. return (length && strLength < length)
  31768. ? (string + createPadding(length - strLength, chars))
  31769. : string;
  31770. }
  31771. /**
  31772. * Pads `string` on the left side if it's shorter than `length`. Padding
  31773. * characters are truncated if they exceed `length`.
  31774. *
  31775. * @static
  31776. * @memberOf _
  31777. * @since 4.0.0
  31778. * @category String
  31779. * @param {string} [string=''] The string to pad.
  31780. * @param {number} [length=0] The padding length.
  31781. * @param {string} [chars=' '] The string used as padding.
  31782. * @returns {string} Returns the padded string.
  31783. * @example
  31784. *
  31785. * _.padStart('abc', 6);
  31786. * // => ' abc'
  31787. *
  31788. * _.padStart('abc', 6, '_-');
  31789. * // => '_-_abc'
  31790. *
  31791. * _.padStart('abc', 3);
  31792. * // => 'abc'
  31793. */
  31794. function padStart(string, length, chars) {
  31795. string = toString(string);
  31796. length = toInteger(length);
  31797. var strLength = length ? stringSize(string) : 0;
  31798. return (length && strLength < length)
  31799. ? (createPadding(length - strLength, chars) + string)
  31800. : string;
  31801. }
  31802. /**
  31803. * Converts `string` to an integer of the specified radix. If `radix` is
  31804. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31805. * hexadecimal, in which case a `radix` of `16` is used.
  31806. *
  31807. * **Note:** This method aligns with the
  31808. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31809. *
  31810. * @static
  31811. * @memberOf _
  31812. * @since 1.1.0
  31813. * @category String
  31814. * @param {string} string The string to convert.
  31815. * @param {number} [radix=10] The radix to interpret `value` by.
  31816. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31817. * @returns {number} Returns the converted integer.
  31818. * @example
  31819. *
  31820. * _.parseInt('08');
  31821. * // => 8
  31822. *
  31823. * _.map(['6', '08', '10'], _.parseInt);
  31824. * // => [6, 8, 10]
  31825. */
  31826. function parseInt(string, radix, guard) {
  31827. if (guard || radix == null) {
  31828. radix = 0;
  31829. } else if (radix) {
  31830. radix = +radix;
  31831. }
  31832. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31833. }
  31834. /**
  31835. * Repeats the given string `n` times.
  31836. *
  31837. * @static
  31838. * @memberOf _
  31839. * @since 3.0.0
  31840. * @category String
  31841. * @param {string} [string=''] The string to repeat.
  31842. * @param {number} [n=1] The number of times to repeat the string.
  31843. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31844. * @returns {string} Returns the repeated string.
  31845. * @example
  31846. *
  31847. * _.repeat('*', 3);
  31848. * // => '***'
  31849. *
  31850. * _.repeat('abc', 2);
  31851. * // => 'abcabc'
  31852. *
  31853. * _.repeat('abc', 0);
  31854. * // => ''
  31855. */
  31856. function repeat(string, n, guard) {
  31857. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31858. n = 1;
  31859. } else {
  31860. n = toInteger(n);
  31861. }
  31862. return baseRepeat(toString(string), n);
  31863. }
  31864. /**
  31865. * Replaces matches for `pattern` in `string` with `replacement`.
  31866. *
  31867. * **Note:** This method is based on
  31868. * [`String#replace`](https://mdn.io/String/replace).
  31869. *
  31870. * @static
  31871. * @memberOf _
  31872. * @since 4.0.0
  31873. * @category String
  31874. * @param {string} [string=''] The string to modify.
  31875. * @param {RegExp|string} pattern The pattern to replace.
  31876. * @param {Function|string} replacement The match replacement.
  31877. * @returns {string} Returns the modified string.
  31878. * @example
  31879. *
  31880. * _.replace('Hi Fred', 'Fred', 'Barney');
  31881. * // => 'Hi Barney'
  31882. */
  31883. function replace() {
  31884. var args = arguments,
  31885. string = toString(args[0]);
  31886. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31887. }
  31888. /**
  31889. * Converts `string` to
  31890. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31891. *
  31892. * @static
  31893. * @memberOf _
  31894. * @since 3.0.0
  31895. * @category String
  31896. * @param {string} [string=''] The string to convert.
  31897. * @returns {string} Returns the snake cased string.
  31898. * @example
  31899. *
  31900. * _.snakeCase('Foo Bar');
  31901. * // => 'foo_bar'
  31902. *
  31903. * _.snakeCase('fooBar');
  31904. * // => 'foo_bar'
  31905. *
  31906. * _.snakeCase('--FOO-BAR--');
  31907. * // => 'foo_bar'
  31908. */
  31909. var snakeCase = createCompounder(function(result, word, index) {
  31910. return result + (index ? '_' : '') + word.toLowerCase();
  31911. });
  31912. /**
  31913. * Splits `string` by `separator`.
  31914. *
  31915. * **Note:** This method is based on
  31916. * [`String#split`](https://mdn.io/String/split).
  31917. *
  31918. * @static
  31919. * @memberOf _
  31920. * @since 4.0.0
  31921. * @category String
  31922. * @param {string} [string=''] The string to split.
  31923. * @param {RegExp|string} separator The separator pattern to split by.
  31924. * @param {number} [limit] The length to truncate results to.
  31925. * @returns {Array} Returns the string segments.
  31926. * @example
  31927. *
  31928. * _.split('a-b-c', '-', 2);
  31929. * // => ['a', 'b']
  31930. */
  31931. function split(string, separator, limit) {
  31932. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31933. separator = limit = undefined;
  31934. }
  31935. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31936. if (!limit) {
  31937. return [];
  31938. }
  31939. string = toString(string);
  31940. if (string && (
  31941. typeof separator == 'string' ||
  31942. (separator != null && !isRegExp(separator))
  31943. )) {
  31944. separator = baseToString(separator);
  31945. if (!separator && hasUnicode(string)) {
  31946. return castSlice(stringToArray(string), 0, limit);
  31947. }
  31948. }
  31949. return string.split(separator, limit);
  31950. }
  31951. /**
  31952. * Converts `string` to
  31953. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31954. *
  31955. * @static
  31956. * @memberOf _
  31957. * @since 3.1.0
  31958. * @category String
  31959. * @param {string} [string=''] The string to convert.
  31960. * @returns {string} Returns the start cased string.
  31961. * @example
  31962. *
  31963. * _.startCase('--foo-bar--');
  31964. * // => 'Foo Bar'
  31965. *
  31966. * _.startCase('fooBar');
  31967. * // => 'Foo Bar'
  31968. *
  31969. * _.startCase('__FOO_BAR__');
  31970. * // => 'FOO BAR'
  31971. */
  31972. var startCase = createCompounder(function(result, word, index) {
  31973. return result + (index ? ' ' : '') + upperFirst(word);
  31974. });
  31975. /**
  31976. * Checks if `string` starts with the given target string.
  31977. *
  31978. * @static
  31979. * @memberOf _
  31980. * @since 3.0.0
  31981. * @category String
  31982. * @param {string} [string=''] The string to inspect.
  31983. * @param {string} [target] The string to search for.
  31984. * @param {number} [position=0] The position to search from.
  31985. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31986. * else `false`.
  31987. * @example
  31988. *
  31989. * _.startsWith('abc', 'a');
  31990. * // => true
  31991. *
  31992. * _.startsWith('abc', 'b');
  31993. * // => false
  31994. *
  31995. * _.startsWith('abc', 'b', 1);
  31996. * // => true
  31997. */
  31998. function startsWith(string, target, position) {
  31999. string = toString(string);
  32000. position = position == null
  32001. ? 0
  32002. : baseClamp(toInteger(position), 0, string.length);
  32003. target = baseToString(target);
  32004. return string.slice(position, position + target.length) == target;
  32005. }
  32006. /**
  32007. * Creates a compiled template function that can interpolate data properties
  32008. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32009. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32010. * properties may be accessed as free variables in the template. If a setting
  32011. * object is given, it takes precedence over `_.templateSettings` values.
  32012. *
  32013. * **Note:** In the development build `_.template` utilizes
  32014. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32015. * for easier debugging.
  32016. *
  32017. * For more information on precompiling templates see
  32018. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32019. *
  32020. * For more information on Chrome extension sandboxes see
  32021. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32022. *
  32023. * @static
  32024. * @since 0.1.0
  32025. * @memberOf _
  32026. * @category String
  32027. * @param {string} [string=''] The template string.
  32028. * @param {Object} [options={}] The options object.
  32029. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32030. * The HTML "escape" delimiter.
  32031. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32032. * The "evaluate" delimiter.
  32033. * @param {Object} [options.imports=_.templateSettings.imports]
  32034. * An object to import into the template as free variables.
  32035. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32036. * The "interpolate" delimiter.
  32037. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32038. * The sourceURL of the compiled template.
  32039. * @param {string} [options.variable='obj']
  32040. * The data object variable name.
  32041. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32042. * @returns {Function} Returns the compiled template function.
  32043. * @example
  32044. *
  32045. * // Use the "interpolate" delimiter to create a compiled template.
  32046. * var compiled = _.template('hello <%= user %>!');
  32047. * compiled({ 'user': 'fred' });
  32048. * // => 'hello fred!'
  32049. *
  32050. * // Use the HTML "escape" delimiter to escape data property values.
  32051. * var compiled = _.template('<b><%- value %></b>');
  32052. * compiled({ 'value': '<script>' });
  32053. * // => '<b>&lt;script&gt;</b>'
  32054. *
  32055. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32056. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32057. * compiled({ 'users': ['fred', 'barney'] });
  32058. * // => '<li>fred</li><li>barney</li>'
  32059. *
  32060. * // Use the internal `print` function in "evaluate" delimiters.
  32061. * var compiled = _.template('<% print("hello " + user); %>!');
  32062. * compiled({ 'user': 'barney' });
  32063. * // => 'hello barney!'
  32064. *
  32065. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32066. * // Disable support by replacing the "interpolate" delimiter.
  32067. * var compiled = _.template('hello ${ user }!');
  32068. * compiled({ 'user': 'pebbles' });
  32069. * // => 'hello pebbles!'
  32070. *
  32071. * // Use backslashes to treat delimiters as plain text.
  32072. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32073. * compiled({ 'value': 'ignored' });
  32074. * // => '<%- value %>'
  32075. *
  32076. * // Use the `imports` option to import `jQuery` as `jq`.
  32077. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32078. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32079. * compiled({ 'users': ['fred', 'barney'] });
  32080. * // => '<li>fred</li><li>barney</li>'
  32081. *
  32082. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32083. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32084. * compiled(data);
  32085. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32086. *
  32087. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32088. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32089. * compiled.source;
  32090. * // => function(data) {
  32091. * // var __t, __p = '';
  32092. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32093. * // return __p;
  32094. * // }
  32095. *
  32096. * // Use custom template delimiters.
  32097. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32098. * var compiled = _.template('hello {{ user }}!');
  32099. * compiled({ 'user': 'mustache' });
  32100. * // => 'hello mustache!'
  32101. *
  32102. * // Use the `source` property to inline compiled templates for meaningful
  32103. * // line numbers in error messages and stack traces.
  32104. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32105. * var JST = {\
  32106. * "main": ' + _.template(mainText).source + '\
  32107. * };\
  32108. * ');
  32109. */
  32110. function template(string, options, guard) {
  32111. // Based on John Resig's `tmpl` implementation
  32112. // (http://ejohn.org/blog/javascript-micro-templating/)
  32113. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32114. var settings = lodash.templateSettings;
  32115. if (guard && isIterateeCall(string, options, guard)) {
  32116. options = undefined;
  32117. }
  32118. string = toString(string);
  32119. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32120. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32121. importsKeys = keys(imports),
  32122. importsValues = baseValues(imports, importsKeys);
  32123. var isEscaping,
  32124. isEvaluating,
  32125. index = 0,
  32126. interpolate = options.interpolate || reNoMatch,
  32127. source = "__p += '";
  32128. // Compile the regexp to match each delimiter.
  32129. var reDelimiters = RegExp(
  32130. (options.escape || reNoMatch).source + '|' +
  32131. interpolate.source + '|' +
  32132. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32133. (options.evaluate || reNoMatch).source + '|$'
  32134. , 'g');
  32135. // Use a sourceURL for easier debugging.
  32136. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32137. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32138. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32139. var sourceURL = '//# sourceURL=' +
  32140. (hasOwnProperty.call(options, 'sourceURL')
  32141. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32142. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32143. ) + '\n';
  32144. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32145. interpolateValue || (interpolateValue = esTemplateValue);
  32146. // Escape characters that can't be included in string literals.
  32147. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32148. // Replace delimiters with snippets.
  32149. if (escapeValue) {
  32150. isEscaping = true;
  32151. source += "' +\n__e(" + escapeValue + ") +\n'";
  32152. }
  32153. if (evaluateValue) {
  32154. isEvaluating = true;
  32155. source += "';\n" + evaluateValue + ";\n__p += '";
  32156. }
  32157. if (interpolateValue) {
  32158. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32159. }
  32160. index = offset + match.length;
  32161. // The JS engine embedded in Adobe products needs `match` returned in
  32162. // order to produce the correct `offset` value.
  32163. return match;
  32164. });
  32165. source += "';\n";
  32166. // If `variable` is not specified wrap a with-statement around the generated
  32167. // code to add the data object to the top of the scope chain.
  32168. // Like with sourceURL, we take care to not check the option's prototype,
  32169. // as this configuration is a code injection vector.
  32170. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32171. if (!variable) {
  32172. source = 'with (obj) {\n' + source + '\n}\n';
  32173. }
  32174. // Cleanup code by stripping empty strings.
  32175. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32176. .replace(reEmptyStringMiddle, '$1')
  32177. .replace(reEmptyStringTrailing, '$1;');
  32178. // Frame code as the function body.
  32179. source = 'function(' + (variable || 'obj') + ') {\n' +
  32180. (variable
  32181. ? ''
  32182. : 'obj || (obj = {});\n'
  32183. ) +
  32184. "var __t, __p = ''" +
  32185. (isEscaping
  32186. ? ', __e = _.escape'
  32187. : ''
  32188. ) +
  32189. (isEvaluating
  32190. ? ', __j = Array.prototype.join;\n' +
  32191. "function print() { __p += __j.call(arguments, '') }\n"
  32192. : ';\n'
  32193. ) +
  32194. source +
  32195. 'return __p\n}';
  32196. var result = attempt(function() {
  32197. return Function(importsKeys, sourceURL + 'return ' + source)
  32198. .apply(undefined, importsValues);
  32199. });
  32200. // Provide the compiled function's source by its `toString` method or
  32201. // the `source` property as a convenience for inlining compiled templates.
  32202. result.source = source;
  32203. if (isError(result)) {
  32204. throw result;
  32205. }
  32206. return result;
  32207. }
  32208. /**
  32209. * Converts `string`, as a whole, to lower case just like
  32210. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32211. *
  32212. * @static
  32213. * @memberOf _
  32214. * @since 4.0.0
  32215. * @category String
  32216. * @param {string} [string=''] The string to convert.
  32217. * @returns {string} Returns the lower cased string.
  32218. * @example
  32219. *
  32220. * _.toLower('--Foo-Bar--');
  32221. * // => '--foo-bar--'
  32222. *
  32223. * _.toLower('fooBar');
  32224. * // => 'foobar'
  32225. *
  32226. * _.toLower('__FOO_BAR__');
  32227. * // => '__foo_bar__'
  32228. */
  32229. function toLower(value) {
  32230. return toString(value).toLowerCase();
  32231. }
  32232. /**
  32233. * Converts `string`, as a whole, to upper case just like
  32234. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32235. *
  32236. * @static
  32237. * @memberOf _
  32238. * @since 4.0.0
  32239. * @category String
  32240. * @param {string} [string=''] The string to convert.
  32241. * @returns {string} Returns the upper cased string.
  32242. * @example
  32243. *
  32244. * _.toUpper('--foo-bar--');
  32245. * // => '--FOO-BAR--'
  32246. *
  32247. * _.toUpper('fooBar');
  32248. * // => 'FOOBAR'
  32249. *
  32250. * _.toUpper('__foo_bar__');
  32251. * // => '__FOO_BAR__'
  32252. */
  32253. function toUpper(value) {
  32254. return toString(value).toUpperCase();
  32255. }
  32256. /**
  32257. * Removes leading and trailing whitespace or specified characters from `string`.
  32258. *
  32259. * @static
  32260. * @memberOf _
  32261. * @since 3.0.0
  32262. * @category String
  32263. * @param {string} [string=''] The string to trim.
  32264. * @param {string} [chars=whitespace] The characters to trim.
  32265. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32266. * @returns {string} Returns the trimmed string.
  32267. * @example
  32268. *
  32269. * _.trim(' abc ');
  32270. * // => 'abc'
  32271. *
  32272. * _.trim('-_-abc-_-', '_-');
  32273. * // => 'abc'
  32274. *
  32275. * _.map([' foo ', ' bar '], _.trim);
  32276. * // => ['foo', 'bar']
  32277. */
  32278. function trim(string, chars, guard) {
  32279. string = toString(string);
  32280. if (string && (guard || chars === undefined)) {
  32281. return string.replace(reTrim, '');
  32282. }
  32283. if (!string || !(chars = baseToString(chars))) {
  32284. return string;
  32285. }
  32286. var strSymbols = stringToArray(string),
  32287. chrSymbols = stringToArray(chars),
  32288. start = charsStartIndex(strSymbols, chrSymbols),
  32289. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32290. return castSlice(strSymbols, start, end).join('');
  32291. }
  32292. /**
  32293. * Removes trailing whitespace or specified characters from `string`.
  32294. *
  32295. * @static
  32296. * @memberOf _
  32297. * @since 4.0.0
  32298. * @category String
  32299. * @param {string} [string=''] The string to trim.
  32300. * @param {string} [chars=whitespace] The characters to trim.
  32301. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32302. * @returns {string} Returns the trimmed string.
  32303. * @example
  32304. *
  32305. * _.trimEnd(' abc ');
  32306. * // => ' abc'
  32307. *
  32308. * _.trimEnd('-_-abc-_-', '_-');
  32309. * // => '-_-abc'
  32310. */
  32311. function trimEnd(string, chars, guard) {
  32312. string = toString(string);
  32313. if (string && (guard || chars === undefined)) {
  32314. return string.replace(reTrimEnd, '');
  32315. }
  32316. if (!string || !(chars = baseToString(chars))) {
  32317. return string;
  32318. }
  32319. var strSymbols = stringToArray(string),
  32320. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32321. return castSlice(strSymbols, 0, end).join('');
  32322. }
  32323. /**
  32324. * Removes leading whitespace or specified characters from `string`.
  32325. *
  32326. * @static
  32327. * @memberOf _
  32328. * @since 4.0.0
  32329. * @category String
  32330. * @param {string} [string=''] The string to trim.
  32331. * @param {string} [chars=whitespace] The characters to trim.
  32332. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32333. * @returns {string} Returns the trimmed string.
  32334. * @example
  32335. *
  32336. * _.trimStart(' abc ');
  32337. * // => 'abc '
  32338. *
  32339. * _.trimStart('-_-abc-_-', '_-');
  32340. * // => 'abc-_-'
  32341. */
  32342. function trimStart(string, chars, guard) {
  32343. string = toString(string);
  32344. if (string && (guard || chars === undefined)) {
  32345. return string.replace(reTrimStart, '');
  32346. }
  32347. if (!string || !(chars = baseToString(chars))) {
  32348. return string;
  32349. }
  32350. var strSymbols = stringToArray(string),
  32351. start = charsStartIndex(strSymbols, stringToArray(chars));
  32352. return castSlice(strSymbols, start).join('');
  32353. }
  32354. /**
  32355. * Truncates `string` if it's longer than the given maximum string length.
  32356. * The last characters of the truncated string are replaced with the omission
  32357. * string which defaults to "...".
  32358. *
  32359. * @static
  32360. * @memberOf _
  32361. * @since 4.0.0
  32362. * @category String
  32363. * @param {string} [string=''] The string to truncate.
  32364. * @param {Object} [options={}] The options object.
  32365. * @param {number} [options.length=30] The maximum string length.
  32366. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32367. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32368. * @returns {string} Returns the truncated string.
  32369. * @example
  32370. *
  32371. * _.truncate('hi-diddly-ho there, neighborino');
  32372. * // => 'hi-diddly-ho there, neighbo...'
  32373. *
  32374. * _.truncate('hi-diddly-ho there, neighborino', {
  32375. * 'length': 24,
  32376. * 'separator': ' '
  32377. * });
  32378. * // => 'hi-diddly-ho there,...'
  32379. *
  32380. * _.truncate('hi-diddly-ho there, neighborino', {
  32381. * 'length': 24,
  32382. * 'separator': /,? +/
  32383. * });
  32384. * // => 'hi-diddly-ho there...'
  32385. *
  32386. * _.truncate('hi-diddly-ho there, neighborino', {
  32387. * 'omission': ' [...]'
  32388. * });
  32389. * // => 'hi-diddly-ho there, neig [...]'
  32390. */
  32391. function truncate(string, options) {
  32392. var length = DEFAULT_TRUNC_LENGTH,
  32393. omission = DEFAULT_TRUNC_OMISSION;
  32394. if (isObject(options)) {
  32395. var separator = 'separator' in options ? options.separator : separator;
  32396. length = 'length' in options ? toInteger(options.length) : length;
  32397. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32398. }
  32399. string = toString(string);
  32400. var strLength = string.length;
  32401. if (hasUnicode(string)) {
  32402. var strSymbols = stringToArray(string);
  32403. strLength = strSymbols.length;
  32404. }
  32405. if (length >= strLength) {
  32406. return string;
  32407. }
  32408. var end = length - stringSize(omission);
  32409. if (end < 1) {
  32410. return omission;
  32411. }
  32412. var result = strSymbols
  32413. ? castSlice(strSymbols, 0, end).join('')
  32414. : string.slice(0, end);
  32415. if (separator === undefined) {
  32416. return result + omission;
  32417. }
  32418. if (strSymbols) {
  32419. end += (result.length - end);
  32420. }
  32421. if (isRegExp(separator)) {
  32422. if (string.slice(end).search(separator)) {
  32423. var match,
  32424. substring = result;
  32425. if (!separator.global) {
  32426. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32427. }
  32428. separator.lastIndex = 0;
  32429. while ((match = separator.exec(substring))) {
  32430. var newEnd = match.index;
  32431. }
  32432. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32433. }
  32434. } else if (string.indexOf(baseToString(separator), end) != end) {
  32435. var index = result.lastIndexOf(separator);
  32436. if (index > -1) {
  32437. result = result.slice(0, index);
  32438. }
  32439. }
  32440. return result + omission;
  32441. }
  32442. /**
  32443. * The inverse of `_.escape`; this method converts the HTML entities
  32444. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32445. * their corresponding characters.
  32446. *
  32447. * **Note:** No other HTML entities are unescaped. To unescape additional
  32448. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32449. *
  32450. * @static
  32451. * @memberOf _
  32452. * @since 0.6.0
  32453. * @category String
  32454. * @param {string} [string=''] The string to unescape.
  32455. * @returns {string} Returns the unescaped string.
  32456. * @example
  32457. *
  32458. * _.unescape('fred, barney, &amp; pebbles');
  32459. * // => 'fred, barney, & pebbles'
  32460. */
  32461. function unescape(string) {
  32462. string = toString(string);
  32463. return (string && reHasEscapedHtml.test(string))
  32464. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32465. : string;
  32466. }
  32467. /**
  32468. * Converts `string`, as space separated words, to upper case.
  32469. *
  32470. * @static
  32471. * @memberOf _
  32472. * @since 4.0.0
  32473. * @category String
  32474. * @param {string} [string=''] The string to convert.
  32475. * @returns {string} Returns the upper cased string.
  32476. * @example
  32477. *
  32478. * _.upperCase('--foo-bar');
  32479. * // => 'FOO BAR'
  32480. *
  32481. * _.upperCase('fooBar');
  32482. * // => 'FOO BAR'
  32483. *
  32484. * _.upperCase('__foo_bar__');
  32485. * // => 'FOO BAR'
  32486. */
  32487. var upperCase = createCompounder(function(result, word, index) {
  32488. return result + (index ? ' ' : '') + word.toUpperCase();
  32489. });
  32490. /**
  32491. * Converts the first character of `string` to upper case.
  32492. *
  32493. * @static
  32494. * @memberOf _
  32495. * @since 4.0.0
  32496. * @category String
  32497. * @param {string} [string=''] The string to convert.
  32498. * @returns {string} Returns the converted string.
  32499. * @example
  32500. *
  32501. * _.upperFirst('fred');
  32502. * // => 'Fred'
  32503. *
  32504. * _.upperFirst('FRED');
  32505. * // => 'FRED'
  32506. */
  32507. var upperFirst = createCaseFirst('toUpperCase');
  32508. /**
  32509. * Splits `string` into an array of its words.
  32510. *
  32511. * @static
  32512. * @memberOf _
  32513. * @since 3.0.0
  32514. * @category String
  32515. * @param {string} [string=''] The string to inspect.
  32516. * @param {RegExp|string} [pattern] The pattern to match words.
  32517. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32518. * @returns {Array} Returns the words of `string`.
  32519. * @example
  32520. *
  32521. * _.words('fred, barney, & pebbles');
  32522. * // => ['fred', 'barney', 'pebbles']
  32523. *
  32524. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32525. * // => ['fred', 'barney', '&', 'pebbles']
  32526. */
  32527. function words(string, pattern, guard) {
  32528. string = toString(string);
  32529. pattern = guard ? undefined : pattern;
  32530. if (pattern === undefined) {
  32531. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32532. }
  32533. return string.match(pattern) || [];
  32534. }
  32535. /*------------------------------------------------------------------------*/
  32536. /**
  32537. * Attempts to invoke `func`, returning either the result or the caught error
  32538. * object. Any additional arguments are provided to `func` when it's invoked.
  32539. *
  32540. * @static
  32541. * @memberOf _
  32542. * @since 3.0.0
  32543. * @category Util
  32544. * @param {Function} func The function to attempt.
  32545. * @param {...*} [args] The arguments to invoke `func` with.
  32546. * @returns {*} Returns the `func` result or error object.
  32547. * @example
  32548. *
  32549. * // Avoid throwing errors for invalid selectors.
  32550. * var elements = _.attempt(function(selector) {
  32551. * return document.querySelectorAll(selector);
  32552. * }, '>_>');
  32553. *
  32554. * if (_.isError(elements)) {
  32555. * elements = [];
  32556. * }
  32557. */
  32558. var attempt = baseRest(function(func, args) {
  32559. try {
  32560. return apply(func, undefined, args);
  32561. } catch (e) {
  32562. return isError(e) ? e : new Error(e);
  32563. }
  32564. });
  32565. /**
  32566. * Binds methods of an object to the object itself, overwriting the existing
  32567. * method.
  32568. *
  32569. * **Note:** This method doesn't set the "length" property of bound functions.
  32570. *
  32571. * @static
  32572. * @since 0.1.0
  32573. * @memberOf _
  32574. * @category Util
  32575. * @param {Object} object The object to bind and assign the bound methods to.
  32576. * @param {...(string|string[])} methodNames The object method names to bind.
  32577. * @returns {Object} Returns `object`.
  32578. * @example
  32579. *
  32580. * var view = {
  32581. * 'label': 'docs',
  32582. * 'click': function() {
  32583. * console.log('clicked ' + this.label);
  32584. * }
  32585. * };
  32586. *
  32587. * _.bindAll(view, ['click']);
  32588. * jQuery(element).on('click', view.click);
  32589. * // => Logs 'clicked docs' when clicked.
  32590. */
  32591. var bindAll = flatRest(function(object, methodNames) {
  32592. arrayEach(methodNames, function(key) {
  32593. key = toKey(key);
  32594. baseAssignValue(object, key, bind(object[key], object));
  32595. });
  32596. return object;
  32597. });
  32598. /**
  32599. * Creates a function that iterates over `pairs` and invokes the corresponding
  32600. * function of the first predicate to return truthy. The predicate-function
  32601. * pairs are invoked with the `this` binding and arguments of the created
  32602. * function.
  32603. *
  32604. * @static
  32605. * @memberOf _
  32606. * @since 4.0.0
  32607. * @category Util
  32608. * @param {Array} pairs The predicate-function pairs.
  32609. * @returns {Function} Returns the new composite function.
  32610. * @example
  32611. *
  32612. * var func = _.cond([
  32613. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32614. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32615. * [_.stubTrue, _.constant('no match')]
  32616. * ]);
  32617. *
  32618. * func({ 'a': 1, 'b': 2 });
  32619. * // => 'matches A'
  32620. *
  32621. * func({ 'a': 0, 'b': 1 });
  32622. * // => 'matches B'
  32623. *
  32624. * func({ 'a': '1', 'b': '2' });
  32625. * // => 'no match'
  32626. */
  32627. function cond(pairs) {
  32628. var length = pairs == null ? 0 : pairs.length,
  32629. toIteratee = getIteratee();
  32630. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32631. if (typeof pair[1] != 'function') {
  32632. throw new TypeError(FUNC_ERROR_TEXT);
  32633. }
  32634. return [toIteratee(pair[0]), pair[1]];
  32635. });
  32636. return baseRest(function(args) {
  32637. var index = -1;
  32638. while (++index < length) {
  32639. var pair = pairs[index];
  32640. if (apply(pair[0], this, args)) {
  32641. return apply(pair[1], this, args);
  32642. }
  32643. }
  32644. });
  32645. }
  32646. /**
  32647. * Creates a function that invokes the predicate properties of `source` with
  32648. * the corresponding property values of a given object, returning `true` if
  32649. * all predicates return truthy, else `false`.
  32650. *
  32651. * **Note:** The created function is equivalent to `_.conformsTo` with
  32652. * `source` partially applied.
  32653. *
  32654. * @static
  32655. * @memberOf _
  32656. * @since 4.0.0
  32657. * @category Util
  32658. * @param {Object} source The object of property predicates to conform to.
  32659. * @returns {Function} Returns the new spec function.
  32660. * @example
  32661. *
  32662. * var objects = [
  32663. * { 'a': 2, 'b': 1 },
  32664. * { 'a': 1, 'b': 2 }
  32665. * ];
  32666. *
  32667. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32668. * // => [{ 'a': 1, 'b': 2 }]
  32669. */
  32670. function conforms(source) {
  32671. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32672. }
  32673. /**
  32674. * Creates a function that returns `value`.
  32675. *
  32676. * @static
  32677. * @memberOf _
  32678. * @since 2.4.0
  32679. * @category Util
  32680. * @param {*} value The value to return from the new function.
  32681. * @returns {Function} Returns the new constant function.
  32682. * @example
  32683. *
  32684. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32685. *
  32686. * console.log(objects);
  32687. * // => [{ 'a': 1 }, { 'a': 1 }]
  32688. *
  32689. * console.log(objects[0] === objects[1]);
  32690. * // => true
  32691. */
  32692. function constant(value) {
  32693. return function() {
  32694. return value;
  32695. };
  32696. }
  32697. /**
  32698. * Checks `value` to determine whether a default value should be returned in
  32699. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32700. * or `undefined`.
  32701. *
  32702. * @static
  32703. * @memberOf _
  32704. * @since 4.14.0
  32705. * @category Util
  32706. * @param {*} value The value to check.
  32707. * @param {*} defaultValue The default value.
  32708. * @returns {*} Returns the resolved value.
  32709. * @example
  32710. *
  32711. * _.defaultTo(1, 10);
  32712. * // => 1
  32713. *
  32714. * _.defaultTo(undefined, 10);
  32715. * // => 10
  32716. */
  32717. function defaultTo(value, defaultValue) {
  32718. return (value == null || value !== value) ? defaultValue : value;
  32719. }
  32720. /**
  32721. * Creates a function that returns the result of invoking the given functions
  32722. * with the `this` binding of the created function, where each successive
  32723. * invocation is supplied the return value of the previous.
  32724. *
  32725. * @static
  32726. * @memberOf _
  32727. * @since 3.0.0
  32728. * @category Util
  32729. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32730. * @returns {Function} Returns the new composite function.
  32731. * @see _.flowRight
  32732. * @example
  32733. *
  32734. * function square(n) {
  32735. * return n * n;
  32736. * }
  32737. *
  32738. * var addSquare = _.flow([_.add, square]);
  32739. * addSquare(1, 2);
  32740. * // => 9
  32741. */
  32742. var flow = createFlow();
  32743. /**
  32744. * This method is like `_.flow` except that it creates a function that
  32745. * invokes the given functions from right to left.
  32746. *
  32747. * @static
  32748. * @since 3.0.0
  32749. * @memberOf _
  32750. * @category Util
  32751. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32752. * @returns {Function} Returns the new composite function.
  32753. * @see _.flow
  32754. * @example
  32755. *
  32756. * function square(n) {
  32757. * return n * n;
  32758. * }
  32759. *
  32760. * var addSquare = _.flowRight([square, _.add]);
  32761. * addSquare(1, 2);
  32762. * // => 9
  32763. */
  32764. var flowRight = createFlow(true);
  32765. /**
  32766. * This method returns the first argument it receives.
  32767. *
  32768. * @static
  32769. * @since 0.1.0
  32770. * @memberOf _
  32771. * @category Util
  32772. * @param {*} value Any value.
  32773. * @returns {*} Returns `value`.
  32774. * @example
  32775. *
  32776. * var object = { 'a': 1 };
  32777. *
  32778. * console.log(_.identity(object) === object);
  32779. * // => true
  32780. */
  32781. function identity(value) {
  32782. return value;
  32783. }
  32784. /**
  32785. * Creates a function that invokes `func` with the arguments of the created
  32786. * function. If `func` is a property name, the created function returns the
  32787. * property value for a given element. If `func` is an array or object, the
  32788. * created function returns `true` for elements that contain the equivalent
  32789. * source properties, otherwise it returns `false`.
  32790. *
  32791. * @static
  32792. * @since 4.0.0
  32793. * @memberOf _
  32794. * @category Util
  32795. * @param {*} [func=_.identity] The value to convert to a callback.
  32796. * @returns {Function} Returns the callback.
  32797. * @example
  32798. *
  32799. * var users = [
  32800. * { 'user': 'barney', 'age': 36, 'active': true },
  32801. * { 'user': 'fred', 'age': 40, 'active': false }
  32802. * ];
  32803. *
  32804. * // The `_.matches` iteratee shorthand.
  32805. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32806. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32807. *
  32808. * // The `_.matchesProperty` iteratee shorthand.
  32809. * _.filter(users, _.iteratee(['user', 'fred']));
  32810. * // => [{ 'user': 'fred', 'age': 40 }]
  32811. *
  32812. * // The `_.property` iteratee shorthand.
  32813. * _.map(users, _.iteratee('user'));
  32814. * // => ['barney', 'fred']
  32815. *
  32816. * // Create custom iteratee shorthands.
  32817. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32818. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32819. * return func.test(string);
  32820. * };
  32821. * });
  32822. *
  32823. * _.filter(['abc', 'def'], /ef/);
  32824. * // => ['def']
  32825. */
  32826. function iteratee(func) {
  32827. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32828. }
  32829. /**
  32830. * Creates a function that performs a partial deep comparison between a given
  32831. * object and `source`, returning `true` if the given object has equivalent
  32832. * property values, else `false`.
  32833. *
  32834. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32835. * partially applied.
  32836. *
  32837. * Partial comparisons will match empty array and empty object `source`
  32838. * values against any array or object value, respectively. See `_.isEqual`
  32839. * for a list of supported value comparisons.
  32840. *
  32841. * @static
  32842. * @memberOf _
  32843. * @since 3.0.0
  32844. * @category Util
  32845. * @param {Object} source The object of property values to match.
  32846. * @returns {Function} Returns the new spec function.
  32847. * @example
  32848. *
  32849. * var objects = [
  32850. * { 'a': 1, 'b': 2, 'c': 3 },
  32851. * { 'a': 4, 'b': 5, 'c': 6 }
  32852. * ];
  32853. *
  32854. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32855. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32856. */
  32857. function matches(source) {
  32858. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32859. }
  32860. /**
  32861. * Creates a function that performs a partial deep comparison between the
  32862. * value at `path` of a given object to `srcValue`, returning `true` if the
  32863. * object value is equivalent, else `false`.
  32864. *
  32865. * **Note:** Partial comparisons will match empty array and empty object
  32866. * `srcValue` values against any array or object value, respectively. See
  32867. * `_.isEqual` for a list of supported value comparisons.
  32868. *
  32869. * @static
  32870. * @memberOf _
  32871. * @since 3.2.0
  32872. * @category Util
  32873. * @param {Array|string} path The path of the property to get.
  32874. * @param {*} srcValue The value to match.
  32875. * @returns {Function} Returns the new spec function.
  32876. * @example
  32877. *
  32878. * var objects = [
  32879. * { 'a': 1, 'b': 2, 'c': 3 },
  32880. * { 'a': 4, 'b': 5, 'c': 6 }
  32881. * ];
  32882. *
  32883. * _.find(objects, _.matchesProperty('a', 4));
  32884. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32885. */
  32886. function matchesProperty(path, srcValue) {
  32887. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32888. }
  32889. /**
  32890. * Creates a function that invokes the method at `path` of a given object.
  32891. * Any additional arguments are provided to the invoked method.
  32892. *
  32893. * @static
  32894. * @memberOf _
  32895. * @since 3.7.0
  32896. * @category Util
  32897. * @param {Array|string} path The path of the method to invoke.
  32898. * @param {...*} [args] The arguments to invoke the method with.
  32899. * @returns {Function} Returns the new invoker function.
  32900. * @example
  32901. *
  32902. * var objects = [
  32903. * { 'a': { 'b': _.constant(2) } },
  32904. * { 'a': { 'b': _.constant(1) } }
  32905. * ];
  32906. *
  32907. * _.map(objects, _.method('a.b'));
  32908. * // => [2, 1]
  32909. *
  32910. * _.map(objects, _.method(['a', 'b']));
  32911. * // => [2, 1]
  32912. */
  32913. var method = baseRest(function(path, args) {
  32914. return function(object) {
  32915. return baseInvoke(object, path, args);
  32916. };
  32917. });
  32918. /**
  32919. * The opposite of `_.method`; this method creates a function that invokes
  32920. * the method at a given path of `object`. Any additional arguments are
  32921. * provided to the invoked method.
  32922. *
  32923. * @static
  32924. * @memberOf _
  32925. * @since 3.7.0
  32926. * @category Util
  32927. * @param {Object} object The object to query.
  32928. * @param {...*} [args] The arguments to invoke the method with.
  32929. * @returns {Function} Returns the new invoker function.
  32930. * @example
  32931. *
  32932. * var array = _.times(3, _.constant),
  32933. * object = { 'a': array, 'b': array, 'c': array };
  32934. *
  32935. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32936. * // => [2, 0]
  32937. *
  32938. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32939. * // => [2, 0]
  32940. */
  32941. var methodOf = baseRest(function(object, args) {
  32942. return function(path) {
  32943. return baseInvoke(object, path, args);
  32944. };
  32945. });
  32946. /**
  32947. * Adds all own enumerable string keyed function properties of a source
  32948. * object to the destination object. If `object` is a function, then methods
  32949. * are added to its prototype as well.
  32950. *
  32951. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32952. * avoid conflicts caused by modifying the original.
  32953. *
  32954. * @static
  32955. * @since 0.1.0
  32956. * @memberOf _
  32957. * @category Util
  32958. * @param {Function|Object} [object=lodash] The destination object.
  32959. * @param {Object} source The object of functions to add.
  32960. * @param {Object} [options={}] The options object.
  32961. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32962. * @returns {Function|Object} Returns `object`.
  32963. * @example
  32964. *
  32965. * function vowels(string) {
  32966. * return _.filter(string, function(v) {
  32967. * return /[aeiou]/i.test(v);
  32968. * });
  32969. * }
  32970. *
  32971. * _.mixin({ 'vowels': vowels });
  32972. * _.vowels('fred');
  32973. * // => ['e']
  32974. *
  32975. * _('fred').vowels().value();
  32976. * // => ['e']
  32977. *
  32978. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32979. * _('fred').vowels();
  32980. * // => ['e']
  32981. */
  32982. function mixin(object, source, options) {
  32983. var props = keys(source),
  32984. methodNames = baseFunctions(source, props);
  32985. if (options == null &&
  32986. !(isObject(source) && (methodNames.length || !props.length))) {
  32987. options = source;
  32988. source = object;
  32989. object = this;
  32990. methodNames = baseFunctions(source, keys(source));
  32991. }
  32992. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32993. isFunc = isFunction(object);
  32994. arrayEach(methodNames, function(methodName) {
  32995. var func = source[methodName];
  32996. object[methodName] = func;
  32997. if (isFunc) {
  32998. object.prototype[methodName] = function() {
  32999. var chainAll = this.__chain__;
  33000. if (chain || chainAll) {
  33001. var result = object(this.__wrapped__),
  33002. actions = result.__actions__ = copyArray(this.__actions__);
  33003. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33004. result.__chain__ = chainAll;
  33005. return result;
  33006. }
  33007. return func.apply(object, arrayPush([this.value()], arguments));
  33008. };
  33009. }
  33010. });
  33011. return object;
  33012. }
  33013. /**
  33014. * Reverts the `_` variable to its previous value and returns a reference to
  33015. * the `lodash` function.
  33016. *
  33017. * @static
  33018. * @since 0.1.0
  33019. * @memberOf _
  33020. * @category Util
  33021. * @returns {Function} Returns the `lodash` function.
  33022. * @example
  33023. *
  33024. * var lodash = _.noConflict();
  33025. */
  33026. function noConflict() {
  33027. if (root._ === this) {
  33028. root._ = oldDash;
  33029. }
  33030. return this;
  33031. }
  33032. /**
  33033. * This method returns `undefined`.
  33034. *
  33035. * @static
  33036. * @memberOf _
  33037. * @since 2.3.0
  33038. * @category Util
  33039. * @example
  33040. *
  33041. * _.times(2, _.noop);
  33042. * // => [undefined, undefined]
  33043. */
  33044. function noop() {
  33045. // No operation performed.
  33046. }
  33047. /**
  33048. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33049. * the nth argument from the end is returned.
  33050. *
  33051. * @static
  33052. * @memberOf _
  33053. * @since 4.0.0
  33054. * @category Util
  33055. * @param {number} [n=0] The index of the argument to return.
  33056. * @returns {Function} Returns the new pass-thru function.
  33057. * @example
  33058. *
  33059. * var func = _.nthArg(1);
  33060. * func('a', 'b', 'c', 'd');
  33061. * // => 'b'
  33062. *
  33063. * var func = _.nthArg(-2);
  33064. * func('a', 'b', 'c', 'd');
  33065. * // => 'c'
  33066. */
  33067. function nthArg(n) {
  33068. n = toInteger(n);
  33069. return baseRest(function(args) {
  33070. return baseNth(args, n);
  33071. });
  33072. }
  33073. /**
  33074. * Creates a function that invokes `iteratees` with the arguments it receives
  33075. * and returns their results.
  33076. *
  33077. * @static
  33078. * @memberOf _
  33079. * @since 4.0.0
  33080. * @category Util
  33081. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33082. * The iteratees to invoke.
  33083. * @returns {Function} Returns the new function.
  33084. * @example
  33085. *
  33086. * var func = _.over([Math.max, Math.min]);
  33087. *
  33088. * func(1, 2, 3, 4);
  33089. * // => [4, 1]
  33090. */
  33091. var over = createOver(arrayMap);
  33092. /**
  33093. * Creates a function that checks if **all** of the `predicates` return
  33094. * truthy when invoked with the arguments it receives.
  33095. *
  33096. * @static
  33097. * @memberOf _
  33098. * @since 4.0.0
  33099. * @category Util
  33100. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33101. * The predicates to check.
  33102. * @returns {Function} Returns the new function.
  33103. * @example
  33104. *
  33105. * var func = _.overEvery([Boolean, isFinite]);
  33106. *
  33107. * func('1');
  33108. * // => true
  33109. *
  33110. * func(null);
  33111. * // => false
  33112. *
  33113. * func(NaN);
  33114. * // => false
  33115. */
  33116. var overEvery = createOver(arrayEvery);
  33117. /**
  33118. * Creates a function that checks if **any** of the `predicates` return
  33119. * truthy when invoked with the arguments it receives.
  33120. *
  33121. * @static
  33122. * @memberOf _
  33123. * @since 4.0.0
  33124. * @category Util
  33125. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33126. * The predicates to check.
  33127. * @returns {Function} Returns the new function.
  33128. * @example
  33129. *
  33130. * var func = _.overSome([Boolean, isFinite]);
  33131. *
  33132. * func('1');
  33133. * // => true
  33134. *
  33135. * func(null);
  33136. * // => true
  33137. *
  33138. * func(NaN);
  33139. * // => false
  33140. */
  33141. var overSome = createOver(arraySome);
  33142. /**
  33143. * Creates a function that returns the value at `path` of a given object.
  33144. *
  33145. * @static
  33146. * @memberOf _
  33147. * @since 2.4.0
  33148. * @category Util
  33149. * @param {Array|string} path The path of the property to get.
  33150. * @returns {Function} Returns the new accessor function.
  33151. * @example
  33152. *
  33153. * var objects = [
  33154. * { 'a': { 'b': 2 } },
  33155. * { 'a': { 'b': 1 } }
  33156. * ];
  33157. *
  33158. * _.map(objects, _.property('a.b'));
  33159. * // => [2, 1]
  33160. *
  33161. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33162. * // => [1, 2]
  33163. */
  33164. function property(path) {
  33165. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33166. }
  33167. /**
  33168. * The opposite of `_.property`; this method creates a function that returns
  33169. * the value at a given path of `object`.
  33170. *
  33171. * @static
  33172. * @memberOf _
  33173. * @since 3.0.0
  33174. * @category Util
  33175. * @param {Object} object The object to query.
  33176. * @returns {Function} Returns the new accessor function.
  33177. * @example
  33178. *
  33179. * var array = [0, 1, 2],
  33180. * object = { 'a': array, 'b': array, 'c': array };
  33181. *
  33182. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33183. * // => [2, 0]
  33184. *
  33185. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33186. * // => [2, 0]
  33187. */
  33188. function propertyOf(object) {
  33189. return function(path) {
  33190. return object == null ? undefined : baseGet(object, path);
  33191. };
  33192. }
  33193. /**
  33194. * Creates an array of numbers (positive and/or negative) progressing from
  33195. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33196. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33197. * it's set to `start` with `start` then set to `0`.
  33198. *
  33199. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33200. * floating-point values which can produce unexpected results.
  33201. *
  33202. * @static
  33203. * @since 0.1.0
  33204. * @memberOf _
  33205. * @category Util
  33206. * @param {number} [start=0] The start of the range.
  33207. * @param {number} end The end of the range.
  33208. * @param {number} [step=1] The value to increment or decrement by.
  33209. * @returns {Array} Returns the range of numbers.
  33210. * @see _.inRange, _.rangeRight
  33211. * @example
  33212. *
  33213. * _.range(4);
  33214. * // => [0, 1, 2, 3]
  33215. *
  33216. * _.range(-4);
  33217. * // => [0, -1, -2, -3]
  33218. *
  33219. * _.range(1, 5);
  33220. * // => [1, 2, 3, 4]
  33221. *
  33222. * _.range(0, 20, 5);
  33223. * // => [0, 5, 10, 15]
  33224. *
  33225. * _.range(0, -4, -1);
  33226. * // => [0, -1, -2, -3]
  33227. *
  33228. * _.range(1, 4, 0);
  33229. * // => [1, 1, 1]
  33230. *
  33231. * _.range(0);
  33232. * // => []
  33233. */
  33234. var range = createRange();
  33235. /**
  33236. * This method is like `_.range` except that it populates values in
  33237. * descending order.
  33238. *
  33239. * @static
  33240. * @memberOf _
  33241. * @since 4.0.0
  33242. * @category Util
  33243. * @param {number} [start=0] The start of the range.
  33244. * @param {number} end The end of the range.
  33245. * @param {number} [step=1] The value to increment or decrement by.
  33246. * @returns {Array} Returns the range of numbers.
  33247. * @see _.inRange, _.range
  33248. * @example
  33249. *
  33250. * _.rangeRight(4);
  33251. * // => [3, 2, 1, 0]
  33252. *
  33253. * _.rangeRight(-4);
  33254. * // => [-3, -2, -1, 0]
  33255. *
  33256. * _.rangeRight(1, 5);
  33257. * // => [4, 3, 2, 1]
  33258. *
  33259. * _.rangeRight(0, 20, 5);
  33260. * // => [15, 10, 5, 0]
  33261. *
  33262. * _.rangeRight(0, -4, -1);
  33263. * // => [-3, -2, -1, 0]
  33264. *
  33265. * _.rangeRight(1, 4, 0);
  33266. * // => [1, 1, 1]
  33267. *
  33268. * _.rangeRight(0);
  33269. * // => []
  33270. */
  33271. var rangeRight = createRange(true);
  33272. /**
  33273. * This method returns a new empty array.
  33274. *
  33275. * @static
  33276. * @memberOf _
  33277. * @since 4.13.0
  33278. * @category Util
  33279. * @returns {Array} Returns the new empty array.
  33280. * @example
  33281. *
  33282. * var arrays = _.times(2, _.stubArray);
  33283. *
  33284. * console.log(arrays);
  33285. * // => [[], []]
  33286. *
  33287. * console.log(arrays[0] === arrays[1]);
  33288. * // => false
  33289. */
  33290. function stubArray() {
  33291. return [];
  33292. }
  33293. /**
  33294. * This method returns `false`.
  33295. *
  33296. * @static
  33297. * @memberOf _
  33298. * @since 4.13.0
  33299. * @category Util
  33300. * @returns {boolean} Returns `false`.
  33301. * @example
  33302. *
  33303. * _.times(2, _.stubFalse);
  33304. * // => [false, false]
  33305. */
  33306. function stubFalse() {
  33307. return false;
  33308. }
  33309. /**
  33310. * This method returns a new empty object.
  33311. *
  33312. * @static
  33313. * @memberOf _
  33314. * @since 4.13.0
  33315. * @category Util
  33316. * @returns {Object} Returns the new empty object.
  33317. * @example
  33318. *
  33319. * var objects = _.times(2, _.stubObject);
  33320. *
  33321. * console.log(objects);
  33322. * // => [{}, {}]
  33323. *
  33324. * console.log(objects[0] === objects[1]);
  33325. * // => false
  33326. */
  33327. function stubObject() {
  33328. return {};
  33329. }
  33330. /**
  33331. * This method returns an empty string.
  33332. *
  33333. * @static
  33334. * @memberOf _
  33335. * @since 4.13.0
  33336. * @category Util
  33337. * @returns {string} Returns the empty string.
  33338. * @example
  33339. *
  33340. * _.times(2, _.stubString);
  33341. * // => ['', '']
  33342. */
  33343. function stubString() {
  33344. return '';
  33345. }
  33346. /**
  33347. * This method returns `true`.
  33348. *
  33349. * @static
  33350. * @memberOf _
  33351. * @since 4.13.0
  33352. * @category Util
  33353. * @returns {boolean} Returns `true`.
  33354. * @example
  33355. *
  33356. * _.times(2, _.stubTrue);
  33357. * // => [true, true]
  33358. */
  33359. function stubTrue() {
  33360. return true;
  33361. }
  33362. /**
  33363. * Invokes the iteratee `n` times, returning an array of the results of
  33364. * each invocation. The iteratee is invoked with one argument; (index).
  33365. *
  33366. * @static
  33367. * @since 0.1.0
  33368. * @memberOf _
  33369. * @category Util
  33370. * @param {number} n The number of times to invoke `iteratee`.
  33371. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33372. * @returns {Array} Returns the array of results.
  33373. * @example
  33374. *
  33375. * _.times(3, String);
  33376. * // => ['0', '1', '2']
  33377. *
  33378. * _.times(4, _.constant(0));
  33379. * // => [0, 0, 0, 0]
  33380. */
  33381. function times(n, iteratee) {
  33382. n = toInteger(n);
  33383. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33384. return [];
  33385. }
  33386. var index = MAX_ARRAY_LENGTH,
  33387. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33388. iteratee = getIteratee(iteratee);
  33389. n -= MAX_ARRAY_LENGTH;
  33390. var result = baseTimes(length, iteratee);
  33391. while (++index < n) {
  33392. iteratee(index);
  33393. }
  33394. return result;
  33395. }
  33396. /**
  33397. * Converts `value` to a property path array.
  33398. *
  33399. * @static
  33400. * @memberOf _
  33401. * @since 4.0.0
  33402. * @category Util
  33403. * @param {*} value The value to convert.
  33404. * @returns {Array} Returns the new property path array.
  33405. * @example
  33406. *
  33407. * _.toPath('a.b.c');
  33408. * // => ['a', 'b', 'c']
  33409. *
  33410. * _.toPath('a[0].b.c');
  33411. * // => ['a', '0', 'b', 'c']
  33412. */
  33413. function toPath(value) {
  33414. if (isArray(value)) {
  33415. return arrayMap(value, toKey);
  33416. }
  33417. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33418. }
  33419. /**
  33420. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33421. *
  33422. * @static
  33423. * @since 0.1.0
  33424. * @memberOf _
  33425. * @category Util
  33426. * @param {string} [prefix=''] The value to prefix the ID with.
  33427. * @returns {string} Returns the unique ID.
  33428. * @example
  33429. *
  33430. * _.uniqueId('contact_');
  33431. * // => 'contact_104'
  33432. *
  33433. * _.uniqueId();
  33434. * // => '105'
  33435. */
  33436. function uniqueId(prefix) {
  33437. var id = ++idCounter;
  33438. return toString(prefix) + id;
  33439. }
  33440. /*------------------------------------------------------------------------*/
  33441. /**
  33442. * Adds two numbers.
  33443. *
  33444. * @static
  33445. * @memberOf _
  33446. * @since 3.4.0
  33447. * @category Math
  33448. * @param {number} augend The first number in an addition.
  33449. * @param {number} addend The second number in an addition.
  33450. * @returns {number} Returns the total.
  33451. * @example
  33452. *
  33453. * _.add(6, 4);
  33454. * // => 10
  33455. */
  33456. var add = createMathOperation(function(augend, addend) {
  33457. return augend + addend;
  33458. }, 0);
  33459. /**
  33460. * Computes `number` rounded up to `precision`.
  33461. *
  33462. * @static
  33463. * @memberOf _
  33464. * @since 3.10.0
  33465. * @category Math
  33466. * @param {number} number The number to round up.
  33467. * @param {number} [precision=0] The precision to round up to.
  33468. * @returns {number} Returns the rounded up number.
  33469. * @example
  33470. *
  33471. * _.ceil(4.006);
  33472. * // => 5
  33473. *
  33474. * _.ceil(6.004, 2);
  33475. * // => 6.01
  33476. *
  33477. * _.ceil(6040, -2);
  33478. * // => 6100
  33479. */
  33480. var ceil = createRound('ceil');
  33481. /**
  33482. * Divide two numbers.
  33483. *
  33484. * @static
  33485. * @memberOf _
  33486. * @since 4.7.0
  33487. * @category Math
  33488. * @param {number} dividend The first number in a division.
  33489. * @param {number} divisor The second number in a division.
  33490. * @returns {number} Returns the quotient.
  33491. * @example
  33492. *
  33493. * _.divide(6, 4);
  33494. * // => 1.5
  33495. */
  33496. var divide = createMathOperation(function(dividend, divisor) {
  33497. return dividend / divisor;
  33498. }, 1);
  33499. /**
  33500. * Computes `number` rounded down to `precision`.
  33501. *
  33502. * @static
  33503. * @memberOf _
  33504. * @since 3.10.0
  33505. * @category Math
  33506. * @param {number} number The number to round down.
  33507. * @param {number} [precision=0] The precision to round down to.
  33508. * @returns {number} Returns the rounded down number.
  33509. * @example
  33510. *
  33511. * _.floor(4.006);
  33512. * // => 4
  33513. *
  33514. * _.floor(0.046, 2);
  33515. * // => 0.04
  33516. *
  33517. * _.floor(4060, -2);
  33518. * // => 4000
  33519. */
  33520. var floor = createRound('floor');
  33521. /**
  33522. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33523. * `undefined` is returned.
  33524. *
  33525. * @static
  33526. * @since 0.1.0
  33527. * @memberOf _
  33528. * @category Math
  33529. * @param {Array} array The array to iterate over.
  33530. * @returns {*} Returns the maximum value.
  33531. * @example
  33532. *
  33533. * _.max([4, 2, 8, 6]);
  33534. * // => 8
  33535. *
  33536. * _.max([]);
  33537. * // => undefined
  33538. */
  33539. function max(array) {
  33540. return (array && array.length)
  33541. ? baseExtremum(array, identity, baseGt)
  33542. : undefined;
  33543. }
  33544. /**
  33545. * This method is like `_.max` except that it accepts `iteratee` which is
  33546. * invoked for each element in `array` to generate the criterion by which
  33547. * the value is ranked. The iteratee is invoked with one argument: (value).
  33548. *
  33549. * @static
  33550. * @memberOf _
  33551. * @since 4.0.0
  33552. * @category Math
  33553. * @param {Array} array The array to iterate over.
  33554. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33555. * @returns {*} Returns the maximum value.
  33556. * @example
  33557. *
  33558. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33559. *
  33560. * _.maxBy(objects, function(o) { return o.n; });
  33561. * // => { 'n': 2 }
  33562. *
  33563. * // The `_.property` iteratee shorthand.
  33564. * _.maxBy(objects, 'n');
  33565. * // => { 'n': 2 }
  33566. */
  33567. function maxBy(array, iteratee) {
  33568. return (array && array.length)
  33569. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33570. : undefined;
  33571. }
  33572. /**
  33573. * Computes the mean of the values in `array`.
  33574. *
  33575. * @static
  33576. * @memberOf _
  33577. * @since 4.0.0
  33578. * @category Math
  33579. * @param {Array} array The array to iterate over.
  33580. * @returns {number} Returns the mean.
  33581. * @example
  33582. *
  33583. * _.mean([4, 2, 8, 6]);
  33584. * // => 5
  33585. */
  33586. function mean(array) {
  33587. return baseMean(array, identity);
  33588. }
  33589. /**
  33590. * This method is like `_.mean` except that it accepts `iteratee` which is
  33591. * invoked for each element in `array` to generate the value to be averaged.
  33592. * The iteratee is invoked with one argument: (value).
  33593. *
  33594. * @static
  33595. * @memberOf _
  33596. * @since 4.7.0
  33597. * @category Math
  33598. * @param {Array} array The array to iterate over.
  33599. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33600. * @returns {number} Returns the mean.
  33601. * @example
  33602. *
  33603. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33604. *
  33605. * _.meanBy(objects, function(o) { return o.n; });
  33606. * // => 5
  33607. *
  33608. * // The `_.property` iteratee shorthand.
  33609. * _.meanBy(objects, 'n');
  33610. * // => 5
  33611. */
  33612. function meanBy(array, iteratee) {
  33613. return baseMean(array, getIteratee(iteratee, 2));
  33614. }
  33615. /**
  33616. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33617. * `undefined` is returned.
  33618. *
  33619. * @static
  33620. * @since 0.1.0
  33621. * @memberOf _
  33622. * @category Math
  33623. * @param {Array} array The array to iterate over.
  33624. * @returns {*} Returns the minimum value.
  33625. * @example
  33626. *
  33627. * _.min([4, 2, 8, 6]);
  33628. * // => 2
  33629. *
  33630. * _.min([]);
  33631. * // => undefined
  33632. */
  33633. function min(array) {
  33634. return (array && array.length)
  33635. ? baseExtremum(array, identity, baseLt)
  33636. : undefined;
  33637. }
  33638. /**
  33639. * This method is like `_.min` except that it accepts `iteratee` which is
  33640. * invoked for each element in `array` to generate the criterion by which
  33641. * the value is ranked. The iteratee is invoked with one argument: (value).
  33642. *
  33643. * @static
  33644. * @memberOf _
  33645. * @since 4.0.0
  33646. * @category Math
  33647. * @param {Array} array The array to iterate over.
  33648. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33649. * @returns {*} Returns the minimum value.
  33650. * @example
  33651. *
  33652. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33653. *
  33654. * _.minBy(objects, function(o) { return o.n; });
  33655. * // => { 'n': 1 }
  33656. *
  33657. * // The `_.property` iteratee shorthand.
  33658. * _.minBy(objects, 'n');
  33659. * // => { 'n': 1 }
  33660. */
  33661. function minBy(array, iteratee) {
  33662. return (array && array.length)
  33663. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33664. : undefined;
  33665. }
  33666. /**
  33667. * Multiply two numbers.
  33668. *
  33669. * @static
  33670. * @memberOf _
  33671. * @since 4.7.0
  33672. * @category Math
  33673. * @param {number} multiplier The first number in a multiplication.
  33674. * @param {number} multiplicand The second number in a multiplication.
  33675. * @returns {number} Returns the product.
  33676. * @example
  33677. *
  33678. * _.multiply(6, 4);
  33679. * // => 24
  33680. */
  33681. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33682. return multiplier * multiplicand;
  33683. }, 1);
  33684. /**
  33685. * Computes `number` rounded to `precision`.
  33686. *
  33687. * @static
  33688. * @memberOf _
  33689. * @since 3.10.0
  33690. * @category Math
  33691. * @param {number} number The number to round.
  33692. * @param {number} [precision=0] The precision to round to.
  33693. * @returns {number} Returns the rounded number.
  33694. * @example
  33695. *
  33696. * _.round(4.006);
  33697. * // => 4
  33698. *
  33699. * _.round(4.006, 2);
  33700. * // => 4.01
  33701. *
  33702. * _.round(4060, -2);
  33703. * // => 4100
  33704. */
  33705. var round = createRound('round');
  33706. /**
  33707. * Subtract two numbers.
  33708. *
  33709. * @static
  33710. * @memberOf _
  33711. * @since 4.0.0
  33712. * @category Math
  33713. * @param {number} minuend The first number in a subtraction.
  33714. * @param {number} subtrahend The second number in a subtraction.
  33715. * @returns {number} Returns the difference.
  33716. * @example
  33717. *
  33718. * _.subtract(6, 4);
  33719. * // => 2
  33720. */
  33721. var subtract = createMathOperation(function(minuend, subtrahend) {
  33722. return minuend - subtrahend;
  33723. }, 0);
  33724. /**
  33725. * Computes the sum of the values in `array`.
  33726. *
  33727. * @static
  33728. * @memberOf _
  33729. * @since 3.4.0
  33730. * @category Math
  33731. * @param {Array} array The array to iterate over.
  33732. * @returns {number} Returns the sum.
  33733. * @example
  33734. *
  33735. * _.sum([4, 2, 8, 6]);
  33736. * // => 20
  33737. */
  33738. function sum(array) {
  33739. return (array && array.length)
  33740. ? baseSum(array, identity)
  33741. : 0;
  33742. }
  33743. /**
  33744. * This method is like `_.sum` except that it accepts `iteratee` which is
  33745. * invoked for each element in `array` to generate the value to be summed.
  33746. * The iteratee is invoked with one argument: (value).
  33747. *
  33748. * @static
  33749. * @memberOf _
  33750. * @since 4.0.0
  33751. * @category Math
  33752. * @param {Array} array The array to iterate over.
  33753. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33754. * @returns {number} Returns the sum.
  33755. * @example
  33756. *
  33757. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33758. *
  33759. * _.sumBy(objects, function(o) { return o.n; });
  33760. * // => 20
  33761. *
  33762. * // The `_.property` iteratee shorthand.
  33763. * _.sumBy(objects, 'n');
  33764. * // => 20
  33765. */
  33766. function sumBy(array, iteratee) {
  33767. return (array && array.length)
  33768. ? baseSum(array, getIteratee(iteratee, 2))
  33769. : 0;
  33770. }
  33771. /*------------------------------------------------------------------------*/
  33772. // Add methods that return wrapped values in chain sequences.
  33773. lodash.after = after;
  33774. lodash.ary = ary;
  33775. lodash.assign = assign;
  33776. lodash.assignIn = assignIn;
  33777. lodash.assignInWith = assignInWith;
  33778. lodash.assignWith = assignWith;
  33779. lodash.at = at;
  33780. lodash.before = before;
  33781. lodash.bind = bind;
  33782. lodash.bindAll = bindAll;
  33783. lodash.bindKey = bindKey;
  33784. lodash.castArray = castArray;
  33785. lodash.chain = chain;
  33786. lodash.chunk = chunk;
  33787. lodash.compact = compact;
  33788. lodash.concat = concat;
  33789. lodash.cond = cond;
  33790. lodash.conforms = conforms;
  33791. lodash.constant = constant;
  33792. lodash.countBy = countBy;
  33793. lodash.create = create;
  33794. lodash.curry = curry;
  33795. lodash.curryRight = curryRight;
  33796. lodash.debounce = debounce;
  33797. lodash.defaults = defaults;
  33798. lodash.defaultsDeep = defaultsDeep;
  33799. lodash.defer = defer;
  33800. lodash.delay = delay;
  33801. lodash.difference = difference;
  33802. lodash.differenceBy = differenceBy;
  33803. lodash.differenceWith = differenceWith;
  33804. lodash.drop = drop;
  33805. lodash.dropRight = dropRight;
  33806. lodash.dropRightWhile = dropRightWhile;
  33807. lodash.dropWhile = dropWhile;
  33808. lodash.fill = fill;
  33809. lodash.filter = filter;
  33810. lodash.flatMap = flatMap;
  33811. lodash.flatMapDeep = flatMapDeep;
  33812. lodash.flatMapDepth = flatMapDepth;
  33813. lodash.flatten = flatten;
  33814. lodash.flattenDeep = flattenDeep;
  33815. lodash.flattenDepth = flattenDepth;
  33816. lodash.flip = flip;
  33817. lodash.flow = flow;
  33818. lodash.flowRight = flowRight;
  33819. lodash.fromPairs = fromPairs;
  33820. lodash.functions = functions;
  33821. lodash.functionsIn = functionsIn;
  33822. lodash.groupBy = groupBy;
  33823. lodash.initial = initial;
  33824. lodash.intersection = intersection;
  33825. lodash.intersectionBy = intersectionBy;
  33826. lodash.intersectionWith = intersectionWith;
  33827. lodash.invert = invert;
  33828. lodash.invertBy = invertBy;
  33829. lodash.invokeMap = invokeMap;
  33830. lodash.iteratee = iteratee;
  33831. lodash.keyBy = keyBy;
  33832. lodash.keys = keys;
  33833. lodash.keysIn = keysIn;
  33834. lodash.map = map;
  33835. lodash.mapKeys = mapKeys;
  33836. lodash.mapValues = mapValues;
  33837. lodash.matches = matches;
  33838. lodash.matchesProperty = matchesProperty;
  33839. lodash.memoize = memoize;
  33840. lodash.merge = merge;
  33841. lodash.mergeWith = mergeWith;
  33842. lodash.method = method;
  33843. lodash.methodOf = methodOf;
  33844. lodash.mixin = mixin;
  33845. lodash.negate = negate;
  33846. lodash.nthArg = nthArg;
  33847. lodash.omit = omit;
  33848. lodash.omitBy = omitBy;
  33849. lodash.once = once;
  33850. lodash.orderBy = orderBy;
  33851. lodash.over = over;
  33852. lodash.overArgs = overArgs;
  33853. lodash.overEvery = overEvery;
  33854. lodash.overSome = overSome;
  33855. lodash.partial = partial;
  33856. lodash.partialRight = partialRight;
  33857. lodash.partition = partition;
  33858. lodash.pick = pick;
  33859. lodash.pickBy = pickBy;
  33860. lodash.property = property;
  33861. lodash.propertyOf = propertyOf;
  33862. lodash.pull = pull;
  33863. lodash.pullAll = pullAll;
  33864. lodash.pullAllBy = pullAllBy;
  33865. lodash.pullAllWith = pullAllWith;
  33866. lodash.pullAt = pullAt;
  33867. lodash.range = range;
  33868. lodash.rangeRight = rangeRight;
  33869. lodash.rearg = rearg;
  33870. lodash.reject = reject;
  33871. lodash.remove = remove;
  33872. lodash.rest = rest;
  33873. lodash.reverse = reverse;
  33874. lodash.sampleSize = sampleSize;
  33875. lodash.set = set;
  33876. lodash.setWith = setWith;
  33877. lodash.shuffle = shuffle;
  33878. lodash.slice = slice;
  33879. lodash.sortBy = sortBy;
  33880. lodash.sortedUniq = sortedUniq;
  33881. lodash.sortedUniqBy = sortedUniqBy;
  33882. lodash.split = split;
  33883. lodash.spread = spread;
  33884. lodash.tail = tail;
  33885. lodash.take = take;
  33886. lodash.takeRight = takeRight;
  33887. lodash.takeRightWhile = takeRightWhile;
  33888. lodash.takeWhile = takeWhile;
  33889. lodash.tap = tap;
  33890. lodash.throttle = throttle;
  33891. lodash.thru = thru;
  33892. lodash.toArray = toArray;
  33893. lodash.toPairs = toPairs;
  33894. lodash.toPairsIn = toPairsIn;
  33895. lodash.toPath = toPath;
  33896. lodash.toPlainObject = toPlainObject;
  33897. lodash.transform = transform;
  33898. lodash.unary = unary;
  33899. lodash.union = union;
  33900. lodash.unionBy = unionBy;
  33901. lodash.unionWith = unionWith;
  33902. lodash.uniq = uniq;
  33903. lodash.uniqBy = uniqBy;
  33904. lodash.uniqWith = uniqWith;
  33905. lodash.unset = unset;
  33906. lodash.unzip = unzip;
  33907. lodash.unzipWith = unzipWith;
  33908. lodash.update = update;
  33909. lodash.updateWith = updateWith;
  33910. lodash.values = values;
  33911. lodash.valuesIn = valuesIn;
  33912. lodash.without = without;
  33913. lodash.words = words;
  33914. lodash.wrap = wrap;
  33915. lodash.xor = xor;
  33916. lodash.xorBy = xorBy;
  33917. lodash.xorWith = xorWith;
  33918. lodash.zip = zip;
  33919. lodash.zipObject = zipObject;
  33920. lodash.zipObjectDeep = zipObjectDeep;
  33921. lodash.zipWith = zipWith;
  33922. // Add aliases.
  33923. lodash.entries = toPairs;
  33924. lodash.entriesIn = toPairsIn;
  33925. lodash.extend = assignIn;
  33926. lodash.extendWith = assignInWith;
  33927. // Add methods to `lodash.prototype`.
  33928. mixin(lodash, lodash);
  33929. /*------------------------------------------------------------------------*/
  33930. // Add methods that return unwrapped values in chain sequences.
  33931. lodash.add = add;
  33932. lodash.attempt = attempt;
  33933. lodash.camelCase = camelCase;
  33934. lodash.capitalize = capitalize;
  33935. lodash.ceil = ceil;
  33936. lodash.clamp = clamp;
  33937. lodash.clone = clone;
  33938. lodash.cloneDeep = cloneDeep;
  33939. lodash.cloneDeepWith = cloneDeepWith;
  33940. lodash.cloneWith = cloneWith;
  33941. lodash.conformsTo = conformsTo;
  33942. lodash.deburr = deburr;
  33943. lodash.defaultTo = defaultTo;
  33944. lodash.divide = divide;
  33945. lodash.endsWith = endsWith;
  33946. lodash.eq = eq;
  33947. lodash.escape = escape;
  33948. lodash.escapeRegExp = escapeRegExp;
  33949. lodash.every = every;
  33950. lodash.find = find;
  33951. lodash.findIndex = findIndex;
  33952. lodash.findKey = findKey;
  33953. lodash.findLast = findLast;
  33954. lodash.findLastIndex = findLastIndex;
  33955. lodash.findLastKey = findLastKey;
  33956. lodash.floor = floor;
  33957. lodash.forEach = forEach;
  33958. lodash.forEachRight = forEachRight;
  33959. lodash.forIn = forIn;
  33960. lodash.forInRight = forInRight;
  33961. lodash.forOwn = forOwn;
  33962. lodash.forOwnRight = forOwnRight;
  33963. lodash.get = get;
  33964. lodash.gt = gt;
  33965. lodash.gte = gte;
  33966. lodash.has = has;
  33967. lodash.hasIn = hasIn;
  33968. lodash.head = head;
  33969. lodash.identity = identity;
  33970. lodash.includes = includes;
  33971. lodash.indexOf = indexOf;
  33972. lodash.inRange = inRange;
  33973. lodash.invoke = invoke;
  33974. lodash.isArguments = isArguments;
  33975. lodash.isArray = isArray;
  33976. lodash.isArrayBuffer = isArrayBuffer;
  33977. lodash.isArrayLike = isArrayLike;
  33978. lodash.isArrayLikeObject = isArrayLikeObject;
  33979. lodash.isBoolean = isBoolean;
  33980. lodash.isBuffer = isBuffer;
  33981. lodash.isDate = isDate;
  33982. lodash.isElement = isElement;
  33983. lodash.isEmpty = isEmpty;
  33984. lodash.isEqual = isEqual;
  33985. lodash.isEqualWith = isEqualWith;
  33986. lodash.isError = isError;
  33987. lodash.isFinite = isFinite;
  33988. lodash.isFunction = isFunction;
  33989. lodash.isInteger = isInteger;
  33990. lodash.isLength = isLength;
  33991. lodash.isMap = isMap;
  33992. lodash.isMatch = isMatch;
  33993. lodash.isMatchWith = isMatchWith;
  33994. lodash.isNaN = isNaN;
  33995. lodash.isNative = isNative;
  33996. lodash.isNil = isNil;
  33997. lodash.isNull = isNull;
  33998. lodash.isNumber = isNumber;
  33999. lodash.isObject = isObject;
  34000. lodash.isObjectLike = isObjectLike;
  34001. lodash.isPlainObject = isPlainObject;
  34002. lodash.isRegExp = isRegExp;
  34003. lodash.isSafeInteger = isSafeInteger;
  34004. lodash.isSet = isSet;
  34005. lodash.isString = isString;
  34006. lodash.isSymbol = isSymbol;
  34007. lodash.isTypedArray = isTypedArray;
  34008. lodash.isUndefined = isUndefined;
  34009. lodash.isWeakMap = isWeakMap;
  34010. lodash.isWeakSet = isWeakSet;
  34011. lodash.join = join;
  34012. lodash.kebabCase = kebabCase;
  34013. lodash.last = last;
  34014. lodash.lastIndexOf = lastIndexOf;
  34015. lodash.lowerCase = lowerCase;
  34016. lodash.lowerFirst = lowerFirst;
  34017. lodash.lt = lt;
  34018. lodash.lte = lte;
  34019. lodash.max = max;
  34020. lodash.maxBy = maxBy;
  34021. lodash.mean = mean;
  34022. lodash.meanBy = meanBy;
  34023. lodash.min = min;
  34024. lodash.minBy = minBy;
  34025. lodash.stubArray = stubArray;
  34026. lodash.stubFalse = stubFalse;
  34027. lodash.stubObject = stubObject;
  34028. lodash.stubString = stubString;
  34029. lodash.stubTrue = stubTrue;
  34030. lodash.multiply = multiply;
  34031. lodash.nth = nth;
  34032. lodash.noConflict = noConflict;
  34033. lodash.noop = noop;
  34034. lodash.now = now;
  34035. lodash.pad = pad;
  34036. lodash.padEnd = padEnd;
  34037. lodash.padStart = padStart;
  34038. lodash.parseInt = parseInt;
  34039. lodash.random = random;
  34040. lodash.reduce = reduce;
  34041. lodash.reduceRight = reduceRight;
  34042. lodash.repeat = repeat;
  34043. lodash.replace = replace;
  34044. lodash.result = result;
  34045. lodash.round = round;
  34046. lodash.runInContext = runInContext;
  34047. lodash.sample = sample;
  34048. lodash.size = size;
  34049. lodash.snakeCase = snakeCase;
  34050. lodash.some = some;
  34051. lodash.sortedIndex = sortedIndex;
  34052. lodash.sortedIndexBy = sortedIndexBy;
  34053. lodash.sortedIndexOf = sortedIndexOf;
  34054. lodash.sortedLastIndex = sortedLastIndex;
  34055. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34056. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34057. lodash.startCase = startCase;
  34058. lodash.startsWith = startsWith;
  34059. lodash.subtract = subtract;
  34060. lodash.sum = sum;
  34061. lodash.sumBy = sumBy;
  34062. lodash.template = template;
  34063. lodash.times = times;
  34064. lodash.toFinite = toFinite;
  34065. lodash.toInteger = toInteger;
  34066. lodash.toLength = toLength;
  34067. lodash.toLower = toLower;
  34068. lodash.toNumber = toNumber;
  34069. lodash.toSafeInteger = toSafeInteger;
  34070. lodash.toString = toString;
  34071. lodash.toUpper = toUpper;
  34072. lodash.trim = trim;
  34073. lodash.trimEnd = trimEnd;
  34074. lodash.trimStart = trimStart;
  34075. lodash.truncate = truncate;
  34076. lodash.unescape = unescape;
  34077. lodash.uniqueId = uniqueId;
  34078. lodash.upperCase = upperCase;
  34079. lodash.upperFirst = upperFirst;
  34080. // Add aliases.
  34081. lodash.each = forEach;
  34082. lodash.eachRight = forEachRight;
  34083. lodash.first = head;
  34084. mixin(lodash, (function() {
  34085. var source = {};
  34086. baseForOwn(lodash, function(func, methodName) {
  34087. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34088. source[methodName] = func;
  34089. }
  34090. });
  34091. return source;
  34092. }()), { 'chain': false });
  34093. /*------------------------------------------------------------------------*/
  34094. /**
  34095. * The semantic version number.
  34096. *
  34097. * @static
  34098. * @memberOf _
  34099. * @type {string}
  34100. */
  34101. lodash.VERSION = VERSION;
  34102. // Assign default placeholders.
  34103. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34104. lodash[methodName].placeholder = lodash;
  34105. });
  34106. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34107. arrayEach(['drop', 'take'], function(methodName, index) {
  34108. LazyWrapper.prototype[methodName] = function(n) {
  34109. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34110. var result = (this.__filtered__ && !index)
  34111. ? new LazyWrapper(this)
  34112. : this.clone();
  34113. if (result.__filtered__) {
  34114. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34115. } else {
  34116. result.__views__.push({
  34117. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34118. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34119. });
  34120. }
  34121. return result;
  34122. };
  34123. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34124. return this.reverse()[methodName](n).reverse();
  34125. };
  34126. });
  34127. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34128. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34129. var type = index + 1,
  34130. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34131. LazyWrapper.prototype[methodName] = function(iteratee) {
  34132. var result = this.clone();
  34133. result.__iteratees__.push({
  34134. 'iteratee': getIteratee(iteratee, 3),
  34135. 'type': type
  34136. });
  34137. result.__filtered__ = result.__filtered__ || isFilter;
  34138. return result;
  34139. };
  34140. });
  34141. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34142. arrayEach(['head', 'last'], function(methodName, index) {
  34143. var takeName = 'take' + (index ? 'Right' : '');
  34144. LazyWrapper.prototype[methodName] = function() {
  34145. return this[takeName](1).value()[0];
  34146. };
  34147. });
  34148. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34149. arrayEach(['initial', 'tail'], function(methodName, index) {
  34150. var dropName = 'drop' + (index ? '' : 'Right');
  34151. LazyWrapper.prototype[methodName] = function() {
  34152. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34153. };
  34154. });
  34155. LazyWrapper.prototype.compact = function() {
  34156. return this.filter(identity);
  34157. };
  34158. LazyWrapper.prototype.find = function(predicate) {
  34159. return this.filter(predicate).head();
  34160. };
  34161. LazyWrapper.prototype.findLast = function(predicate) {
  34162. return this.reverse().find(predicate);
  34163. };
  34164. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34165. if (typeof path == 'function') {
  34166. return new LazyWrapper(this);
  34167. }
  34168. return this.map(function(value) {
  34169. return baseInvoke(value, path, args);
  34170. });
  34171. });
  34172. LazyWrapper.prototype.reject = function(predicate) {
  34173. return this.filter(negate(getIteratee(predicate)));
  34174. };
  34175. LazyWrapper.prototype.slice = function(start, end) {
  34176. start = toInteger(start);
  34177. var result = this;
  34178. if (result.__filtered__ && (start > 0 || end < 0)) {
  34179. return new LazyWrapper(result);
  34180. }
  34181. if (start < 0) {
  34182. result = result.takeRight(-start);
  34183. } else if (start) {
  34184. result = result.drop(start);
  34185. }
  34186. if (end !== undefined) {
  34187. end = toInteger(end);
  34188. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34189. }
  34190. return result;
  34191. };
  34192. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34193. return this.reverse().takeWhile(predicate).reverse();
  34194. };
  34195. LazyWrapper.prototype.toArray = function() {
  34196. return this.take(MAX_ARRAY_LENGTH);
  34197. };
  34198. // Add `LazyWrapper` methods to `lodash.prototype`.
  34199. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34200. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34201. isTaker = /^(?:head|last)$/.test(methodName),
  34202. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34203. retUnwrapped = isTaker || /^find/.test(methodName);
  34204. if (!lodashFunc) {
  34205. return;
  34206. }
  34207. lodash.prototype[methodName] = function() {
  34208. var value = this.__wrapped__,
  34209. args = isTaker ? [1] : arguments,
  34210. isLazy = value instanceof LazyWrapper,
  34211. iteratee = args[0],
  34212. useLazy = isLazy || isArray(value);
  34213. var interceptor = function(value) {
  34214. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34215. return (isTaker && chainAll) ? result[0] : result;
  34216. };
  34217. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34218. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34219. isLazy = useLazy = false;
  34220. }
  34221. var chainAll = this.__chain__,
  34222. isHybrid = !!this.__actions__.length,
  34223. isUnwrapped = retUnwrapped && !chainAll,
  34224. onlyLazy = isLazy && !isHybrid;
  34225. if (!retUnwrapped && useLazy) {
  34226. value = onlyLazy ? value : new LazyWrapper(this);
  34227. var result = func.apply(value, args);
  34228. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34229. return new LodashWrapper(result, chainAll);
  34230. }
  34231. if (isUnwrapped && onlyLazy) {
  34232. return func.apply(this, args);
  34233. }
  34234. result = this.thru(interceptor);
  34235. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34236. };
  34237. });
  34238. // Add `Array` methods to `lodash.prototype`.
  34239. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34240. var func = arrayProto[methodName],
  34241. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34242. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34243. lodash.prototype[methodName] = function() {
  34244. var args = arguments;
  34245. if (retUnwrapped && !this.__chain__) {
  34246. var value = this.value();
  34247. return func.apply(isArray(value) ? value : [], args);
  34248. }
  34249. return this[chainName](function(value) {
  34250. return func.apply(isArray(value) ? value : [], args);
  34251. });
  34252. };
  34253. });
  34254. // Map minified method names to their real names.
  34255. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34256. var lodashFunc = lodash[methodName];
  34257. if (lodashFunc) {
  34258. var key = lodashFunc.name + '';
  34259. if (!hasOwnProperty.call(realNames, key)) {
  34260. realNames[key] = [];
  34261. }
  34262. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34263. }
  34264. });
  34265. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34266. 'name': 'wrapper',
  34267. 'func': undefined
  34268. }];
  34269. // Add methods to `LazyWrapper`.
  34270. LazyWrapper.prototype.clone = lazyClone;
  34271. LazyWrapper.prototype.reverse = lazyReverse;
  34272. LazyWrapper.prototype.value = lazyValue;
  34273. // Add chain sequence methods to the `lodash` wrapper.
  34274. lodash.prototype.at = wrapperAt;
  34275. lodash.prototype.chain = wrapperChain;
  34276. lodash.prototype.commit = wrapperCommit;
  34277. lodash.prototype.next = wrapperNext;
  34278. lodash.prototype.plant = wrapperPlant;
  34279. lodash.prototype.reverse = wrapperReverse;
  34280. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34281. // Add lazy aliases.
  34282. lodash.prototype.first = lodash.prototype.head;
  34283. if (symIterator) {
  34284. lodash.prototype[symIterator] = wrapperToIterator;
  34285. }
  34286. return lodash;
  34287. });
  34288. /*--------------------------------------------------------------------------*/
  34289. // Export lodash.
  34290. var _ = runInContext();
  34291. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34292. if (true) {
  34293. // Expose Lodash on the global object to prevent errors when Lodash is
  34294. // loaded by a script tag in the presence of an AMD loader.
  34295. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34296. // Use `_.noConflict` to remove Lodash from the global object.
  34297. root._ = _;
  34298. // Define as an anonymous module so, through path mapping, it can be
  34299. // referenced as the "underscore" module.
  34300. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34301. return _;
  34302. }).call(exports, __webpack_require__, exports, module),
  34303. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34304. }
  34305. // Check for `exports` after `define` in case a build optimizer adds it.
  34306. else {}
  34307. }.call(this));
  34308. /* 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)))
  34309. /***/ }),
  34310. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34311. /*!***************************************************!*\
  34312. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34313. \***************************************************/
  34314. /*! exports provided: default */
  34315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34316. "use strict";
  34317. __webpack_require__.r(__webpack_exports__);
  34318. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34319. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34320. * @version 1.16.1
  34321. * @license
  34322. * Copyright (c) 2016 Federico Zivolo and contributors
  34323. *
  34324. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34325. * of this software and associated documentation files (the "Software"), to deal
  34326. * in the Software without restriction, including without limitation the rights
  34327. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34328. * copies of the Software, and to permit persons to whom the Software is
  34329. * furnished to do so, subject to the following conditions:
  34330. *
  34331. * The above copyright notice and this permission notice shall be included in all
  34332. * copies or substantial portions of the Software.
  34333. *
  34334. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34335. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34336. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34337. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34338. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34339. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34340. * SOFTWARE.
  34341. */
  34342. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34343. var timeoutDuration = function () {
  34344. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34345. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34346. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34347. return 1;
  34348. }
  34349. }
  34350. return 0;
  34351. }();
  34352. function microtaskDebounce(fn) {
  34353. var called = false;
  34354. return function () {
  34355. if (called) {
  34356. return;
  34357. }
  34358. called = true;
  34359. window.Promise.resolve().then(function () {
  34360. called = false;
  34361. fn();
  34362. });
  34363. };
  34364. }
  34365. function taskDebounce(fn) {
  34366. var scheduled = false;
  34367. return function () {
  34368. if (!scheduled) {
  34369. scheduled = true;
  34370. setTimeout(function () {
  34371. scheduled = false;
  34372. fn();
  34373. }, timeoutDuration);
  34374. }
  34375. };
  34376. }
  34377. var supportsMicroTasks = isBrowser && window.Promise;
  34378. /**
  34379. * Create a debounced version of a method, that's asynchronously deferred
  34380. * but called in the minimum time possible.
  34381. *
  34382. * @method
  34383. * @memberof Popper.Utils
  34384. * @argument {Function} fn
  34385. * @returns {Function}
  34386. */
  34387. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34388. /**
  34389. * Check if the given variable is a function
  34390. * @method
  34391. * @memberof Popper.Utils
  34392. * @argument {Any} functionToCheck - variable to check
  34393. * @returns {Boolean} answer to: is a function?
  34394. */
  34395. function isFunction(functionToCheck) {
  34396. var getType = {};
  34397. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34398. }
  34399. /**
  34400. * Get CSS computed property of the given element
  34401. * @method
  34402. * @memberof Popper.Utils
  34403. * @argument {Eement} element
  34404. * @argument {String} property
  34405. */
  34406. function getStyleComputedProperty(element, property) {
  34407. if (element.nodeType !== 1) {
  34408. return [];
  34409. }
  34410. // NOTE: 1 DOM access here
  34411. var window = element.ownerDocument.defaultView;
  34412. var css = window.getComputedStyle(element, null);
  34413. return property ? css[property] : css;
  34414. }
  34415. /**
  34416. * Returns the parentNode or the host of the element
  34417. * @method
  34418. * @memberof Popper.Utils
  34419. * @argument {Element} element
  34420. * @returns {Element} parent
  34421. */
  34422. function getParentNode(element) {
  34423. if (element.nodeName === 'HTML') {
  34424. return element;
  34425. }
  34426. return element.parentNode || element.host;
  34427. }
  34428. /**
  34429. * Returns the scrolling parent of the given element
  34430. * @method
  34431. * @memberof Popper.Utils
  34432. * @argument {Element} element
  34433. * @returns {Element} scroll parent
  34434. */
  34435. function getScrollParent(element) {
  34436. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34437. if (!element) {
  34438. return document.body;
  34439. }
  34440. switch (element.nodeName) {
  34441. case 'HTML':
  34442. case 'BODY':
  34443. return element.ownerDocument.body;
  34444. case '#document':
  34445. return element.body;
  34446. }
  34447. // Firefox want us to check `-x` and `-y` variations as well
  34448. var _getStyleComputedProp = getStyleComputedProperty(element),
  34449. overflow = _getStyleComputedProp.overflow,
  34450. overflowX = _getStyleComputedProp.overflowX,
  34451. overflowY = _getStyleComputedProp.overflowY;
  34452. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34453. return element;
  34454. }
  34455. return getScrollParent(getParentNode(element));
  34456. }
  34457. /**
  34458. * Returns the reference node of the reference object, or the reference object itself.
  34459. * @method
  34460. * @memberof Popper.Utils
  34461. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34462. * @returns {Element} parent
  34463. */
  34464. function getReferenceNode(reference) {
  34465. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34466. }
  34467. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34468. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34469. /**
  34470. * Determines if the browser is Internet Explorer
  34471. * @method
  34472. * @memberof Popper.Utils
  34473. * @param {Number} version to check
  34474. * @returns {Boolean} isIE
  34475. */
  34476. function isIE(version) {
  34477. if (version === 11) {
  34478. return isIE11;
  34479. }
  34480. if (version === 10) {
  34481. return isIE10;
  34482. }
  34483. return isIE11 || isIE10;
  34484. }
  34485. /**
  34486. * Returns the offset parent of the given element
  34487. * @method
  34488. * @memberof Popper.Utils
  34489. * @argument {Element} element
  34490. * @returns {Element} offset parent
  34491. */
  34492. function getOffsetParent(element) {
  34493. if (!element) {
  34494. return document.documentElement;
  34495. }
  34496. var noOffsetParent = isIE(10) ? document.body : null;
  34497. // NOTE: 1 DOM access here
  34498. var offsetParent = element.offsetParent || null;
  34499. // Skip hidden elements which don't have an offsetParent
  34500. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34501. offsetParent = (element = element.nextElementSibling).offsetParent;
  34502. }
  34503. var nodeName = offsetParent && offsetParent.nodeName;
  34504. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34505. return element ? element.ownerDocument.documentElement : document.documentElement;
  34506. }
  34507. // .offsetParent will return the closest TH, TD or TABLE in case
  34508. // no offsetParent is present, I hate this job...
  34509. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34510. return getOffsetParent(offsetParent);
  34511. }
  34512. return offsetParent;
  34513. }
  34514. function isOffsetContainer(element) {
  34515. var nodeName = element.nodeName;
  34516. if (nodeName === 'BODY') {
  34517. return false;
  34518. }
  34519. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34520. }
  34521. /**
  34522. * Finds the root node (document, shadowDOM root) of the given element
  34523. * @method
  34524. * @memberof Popper.Utils
  34525. * @argument {Element} node
  34526. * @returns {Element} root node
  34527. */
  34528. function getRoot(node) {
  34529. if (node.parentNode !== null) {
  34530. return getRoot(node.parentNode);
  34531. }
  34532. return node;
  34533. }
  34534. /**
  34535. * Finds the offset parent common to the two provided nodes
  34536. * @method
  34537. * @memberof Popper.Utils
  34538. * @argument {Element} element1
  34539. * @argument {Element} element2
  34540. * @returns {Element} common offset parent
  34541. */
  34542. function findCommonOffsetParent(element1, element2) {
  34543. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34544. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34545. return document.documentElement;
  34546. }
  34547. // Here we make sure to give as "start" the element that comes first in the DOM
  34548. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34549. var start = order ? element1 : element2;
  34550. var end = order ? element2 : element1;
  34551. // Get common ancestor container
  34552. var range = document.createRange();
  34553. range.setStart(start, 0);
  34554. range.setEnd(end, 0);
  34555. var commonAncestorContainer = range.commonAncestorContainer;
  34556. // Both nodes are inside #document
  34557. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34558. if (isOffsetContainer(commonAncestorContainer)) {
  34559. return commonAncestorContainer;
  34560. }
  34561. return getOffsetParent(commonAncestorContainer);
  34562. }
  34563. // one of the nodes is inside shadowDOM, find which one
  34564. var element1root = getRoot(element1);
  34565. if (element1root.host) {
  34566. return findCommonOffsetParent(element1root.host, element2);
  34567. } else {
  34568. return findCommonOffsetParent(element1, getRoot(element2).host);
  34569. }
  34570. }
  34571. /**
  34572. * Gets the scroll value of the given element in the given side (top and left)
  34573. * @method
  34574. * @memberof Popper.Utils
  34575. * @argument {Element} element
  34576. * @argument {String} side `top` or `left`
  34577. * @returns {number} amount of scrolled pixels
  34578. */
  34579. function getScroll(element) {
  34580. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34581. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34582. var nodeName = element.nodeName;
  34583. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34584. var html = element.ownerDocument.documentElement;
  34585. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34586. return scrollingElement[upperSide];
  34587. }
  34588. return element[upperSide];
  34589. }
  34590. /*
  34591. * Sum or subtract the element scroll values (left and top) from a given rect object
  34592. * @method
  34593. * @memberof Popper.Utils
  34594. * @param {Object} rect - Rect object you want to change
  34595. * @param {HTMLElement} element - The element from the function reads the scroll values
  34596. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34597. * @return {Object} rect - The modifier rect object
  34598. */
  34599. function includeScroll(rect, element) {
  34600. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34601. var scrollTop = getScroll(element, 'top');
  34602. var scrollLeft = getScroll(element, 'left');
  34603. var modifier = subtract ? -1 : 1;
  34604. rect.top += scrollTop * modifier;
  34605. rect.bottom += scrollTop * modifier;
  34606. rect.left += scrollLeft * modifier;
  34607. rect.right += scrollLeft * modifier;
  34608. return rect;
  34609. }
  34610. /*
  34611. * Helper to detect borders of a given element
  34612. * @method
  34613. * @memberof Popper.Utils
  34614. * @param {CSSStyleDeclaration} styles
  34615. * Result of `getStyleComputedProperty` on the given element
  34616. * @param {String} axis - `x` or `y`
  34617. * @return {number} borders - The borders size of the given axis
  34618. */
  34619. function getBordersSize(styles, axis) {
  34620. var sideA = axis === 'x' ? 'Left' : 'Top';
  34621. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34622. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34623. }
  34624. function getSize(axis, body, html, computedStyle) {
  34625. 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);
  34626. }
  34627. function getWindowSizes(document) {
  34628. var body = document.body;
  34629. var html = document.documentElement;
  34630. var computedStyle = isIE(10) && getComputedStyle(html);
  34631. return {
  34632. height: getSize('Height', body, html, computedStyle),
  34633. width: getSize('Width', body, html, computedStyle)
  34634. };
  34635. }
  34636. var classCallCheck = function (instance, Constructor) {
  34637. if (!(instance instanceof Constructor)) {
  34638. throw new TypeError("Cannot call a class as a function");
  34639. }
  34640. };
  34641. var createClass = function () {
  34642. function defineProperties(target, props) {
  34643. for (var i = 0; i < props.length; i++) {
  34644. var descriptor = props[i];
  34645. descriptor.enumerable = descriptor.enumerable || false;
  34646. descriptor.configurable = true;
  34647. if ("value" in descriptor) descriptor.writable = true;
  34648. Object.defineProperty(target, descriptor.key, descriptor);
  34649. }
  34650. }
  34651. return function (Constructor, protoProps, staticProps) {
  34652. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34653. if (staticProps) defineProperties(Constructor, staticProps);
  34654. return Constructor;
  34655. };
  34656. }();
  34657. var defineProperty = function (obj, key, value) {
  34658. if (key in obj) {
  34659. Object.defineProperty(obj, key, {
  34660. value: value,
  34661. enumerable: true,
  34662. configurable: true,
  34663. writable: true
  34664. });
  34665. } else {
  34666. obj[key] = value;
  34667. }
  34668. return obj;
  34669. };
  34670. var _extends = Object.assign || function (target) {
  34671. for (var i = 1; i < arguments.length; i++) {
  34672. var source = arguments[i];
  34673. for (var key in source) {
  34674. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34675. target[key] = source[key];
  34676. }
  34677. }
  34678. }
  34679. return target;
  34680. };
  34681. /**
  34682. * Given element offsets, generate an output similar to getBoundingClientRect
  34683. * @method
  34684. * @memberof Popper.Utils
  34685. * @argument {Object} offsets
  34686. * @returns {Object} ClientRect like output
  34687. */
  34688. function getClientRect(offsets) {
  34689. return _extends({}, offsets, {
  34690. right: offsets.left + offsets.width,
  34691. bottom: offsets.top + offsets.height
  34692. });
  34693. }
  34694. /**
  34695. * Get bounding client rect of given element
  34696. * @method
  34697. * @memberof Popper.Utils
  34698. * @param {HTMLElement} element
  34699. * @return {Object} client rect
  34700. */
  34701. function getBoundingClientRect(element) {
  34702. var rect = {};
  34703. // IE10 10 FIX: Please, don't ask, the element isn't
  34704. // considered in DOM in some circumstances...
  34705. // This isn't reproducible in IE10 compatibility mode of IE11
  34706. try {
  34707. if (isIE(10)) {
  34708. rect = element.getBoundingClientRect();
  34709. var scrollTop = getScroll(element, 'top');
  34710. var scrollLeft = getScroll(element, 'left');
  34711. rect.top += scrollTop;
  34712. rect.left += scrollLeft;
  34713. rect.bottom += scrollTop;
  34714. rect.right += scrollLeft;
  34715. } else {
  34716. rect = element.getBoundingClientRect();
  34717. }
  34718. } catch (e) {}
  34719. var result = {
  34720. left: rect.left,
  34721. top: rect.top,
  34722. width: rect.right - rect.left,
  34723. height: rect.bottom - rect.top
  34724. };
  34725. // subtract scrollbar size from sizes
  34726. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34727. var width = sizes.width || element.clientWidth || result.width;
  34728. var height = sizes.height || element.clientHeight || result.height;
  34729. var horizScrollbar = element.offsetWidth - width;
  34730. var vertScrollbar = element.offsetHeight - height;
  34731. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34732. // we make this check conditional for performance reasons
  34733. if (horizScrollbar || vertScrollbar) {
  34734. var styles = getStyleComputedProperty(element);
  34735. horizScrollbar -= getBordersSize(styles, 'x');
  34736. vertScrollbar -= getBordersSize(styles, 'y');
  34737. result.width -= horizScrollbar;
  34738. result.height -= vertScrollbar;
  34739. }
  34740. return getClientRect(result);
  34741. }
  34742. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34743. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34744. var isIE10 = isIE(10);
  34745. var isHTML = parent.nodeName === 'HTML';
  34746. var childrenRect = getBoundingClientRect(children);
  34747. var parentRect = getBoundingClientRect(parent);
  34748. var scrollParent = getScrollParent(children);
  34749. var styles = getStyleComputedProperty(parent);
  34750. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34751. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34752. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34753. if (fixedPosition && isHTML) {
  34754. parentRect.top = Math.max(parentRect.top, 0);
  34755. parentRect.left = Math.max(parentRect.left, 0);
  34756. }
  34757. var offsets = getClientRect({
  34758. top: childrenRect.top - parentRect.top - borderTopWidth,
  34759. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34760. width: childrenRect.width,
  34761. height: childrenRect.height
  34762. });
  34763. offsets.marginTop = 0;
  34764. offsets.marginLeft = 0;
  34765. // Subtract margins of documentElement in case it's being used as parent
  34766. // we do this only on HTML because it's the only element that behaves
  34767. // differently when margins are applied to it. The margins are included in
  34768. // the box of the documentElement, in the other cases not.
  34769. if (!isIE10 && isHTML) {
  34770. var marginTop = parseFloat(styles.marginTop);
  34771. var marginLeft = parseFloat(styles.marginLeft);
  34772. offsets.top -= borderTopWidth - marginTop;
  34773. offsets.bottom -= borderTopWidth - marginTop;
  34774. offsets.left -= borderLeftWidth - marginLeft;
  34775. offsets.right -= borderLeftWidth - marginLeft;
  34776. // Attach marginTop and marginLeft because in some circumstances we may need them
  34777. offsets.marginTop = marginTop;
  34778. offsets.marginLeft = marginLeft;
  34779. }
  34780. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34781. offsets = includeScroll(offsets, parent);
  34782. }
  34783. return offsets;
  34784. }
  34785. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34786. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34787. var html = element.ownerDocument.documentElement;
  34788. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34789. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34790. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34791. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34792. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34793. var offset = {
  34794. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34795. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34796. width: width,
  34797. height: height
  34798. };
  34799. return getClientRect(offset);
  34800. }
  34801. /**
  34802. * Check if the given element is fixed or is inside a fixed parent
  34803. * @method
  34804. * @memberof Popper.Utils
  34805. * @argument {Element} element
  34806. * @argument {Element} customContainer
  34807. * @returns {Boolean} answer to "isFixed?"
  34808. */
  34809. function isFixed(element) {
  34810. var nodeName = element.nodeName;
  34811. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34812. return false;
  34813. }
  34814. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34815. return true;
  34816. }
  34817. var parentNode = getParentNode(element);
  34818. if (!parentNode) {
  34819. return false;
  34820. }
  34821. return isFixed(parentNode);
  34822. }
  34823. /**
  34824. * Finds the first parent of an element that has a transformed property defined
  34825. * @method
  34826. * @memberof Popper.Utils
  34827. * @argument {Element} element
  34828. * @returns {Element} first transformed parent or documentElement
  34829. */
  34830. function getFixedPositionOffsetParent(element) {
  34831. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34832. if (!element || !element.parentElement || isIE()) {
  34833. return document.documentElement;
  34834. }
  34835. var el = element.parentElement;
  34836. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34837. el = el.parentElement;
  34838. }
  34839. return el || document.documentElement;
  34840. }
  34841. /**
  34842. * Computed the boundaries limits and return them
  34843. * @method
  34844. * @memberof Popper.Utils
  34845. * @param {HTMLElement} popper
  34846. * @param {HTMLElement} reference
  34847. * @param {number} padding
  34848. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34849. * @param {Boolean} fixedPosition - Is in fixed position mode
  34850. * @returns {Object} Coordinates of the boundaries
  34851. */
  34852. function getBoundaries(popper, reference, padding, boundariesElement) {
  34853. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34854. // NOTE: 1 DOM access here
  34855. var boundaries = { top: 0, left: 0 };
  34856. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34857. // Handle viewport case
  34858. if (boundariesElement === 'viewport') {
  34859. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34860. } else {
  34861. // Handle other cases based on DOM element used as boundaries
  34862. var boundariesNode = void 0;
  34863. if (boundariesElement === 'scrollParent') {
  34864. boundariesNode = getScrollParent(getParentNode(reference));
  34865. if (boundariesNode.nodeName === 'BODY') {
  34866. boundariesNode = popper.ownerDocument.documentElement;
  34867. }
  34868. } else if (boundariesElement === 'window') {
  34869. boundariesNode = popper.ownerDocument.documentElement;
  34870. } else {
  34871. boundariesNode = boundariesElement;
  34872. }
  34873. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34874. // In case of HTML, we need a different computation
  34875. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34876. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34877. height = _getWindowSizes.height,
  34878. width = _getWindowSizes.width;
  34879. boundaries.top += offsets.top - offsets.marginTop;
  34880. boundaries.bottom = height + offsets.top;
  34881. boundaries.left += offsets.left - offsets.marginLeft;
  34882. boundaries.right = width + offsets.left;
  34883. } else {
  34884. // for all the other DOM elements, this one is good
  34885. boundaries = offsets;
  34886. }
  34887. }
  34888. // Add paddings
  34889. padding = padding || 0;
  34890. var isPaddingNumber = typeof padding === 'number';
  34891. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34892. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34893. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34894. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34895. return boundaries;
  34896. }
  34897. function getArea(_ref) {
  34898. var width = _ref.width,
  34899. height = _ref.height;
  34900. return width * height;
  34901. }
  34902. /**
  34903. * Utility used to transform the `auto` placement to the placement with more
  34904. * available space.
  34905. * @method
  34906. * @memberof Popper.Utils
  34907. * @argument {Object} data - The data object generated by update method
  34908. * @argument {Object} options - Modifiers configuration and options
  34909. * @returns {Object} The data object, properly modified
  34910. */
  34911. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34912. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34913. if (placement.indexOf('auto') === -1) {
  34914. return placement;
  34915. }
  34916. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34917. var rects = {
  34918. top: {
  34919. width: boundaries.width,
  34920. height: refRect.top - boundaries.top
  34921. },
  34922. right: {
  34923. width: boundaries.right - refRect.right,
  34924. height: boundaries.height
  34925. },
  34926. bottom: {
  34927. width: boundaries.width,
  34928. height: boundaries.bottom - refRect.bottom
  34929. },
  34930. left: {
  34931. width: refRect.left - boundaries.left,
  34932. height: boundaries.height
  34933. }
  34934. };
  34935. var sortedAreas = Object.keys(rects).map(function (key) {
  34936. return _extends({
  34937. key: key
  34938. }, rects[key], {
  34939. area: getArea(rects[key])
  34940. });
  34941. }).sort(function (a, b) {
  34942. return b.area - a.area;
  34943. });
  34944. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34945. var width = _ref2.width,
  34946. height = _ref2.height;
  34947. return width >= popper.clientWidth && height >= popper.clientHeight;
  34948. });
  34949. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34950. var variation = placement.split('-')[1];
  34951. return computedPlacement + (variation ? '-' + variation : '');
  34952. }
  34953. /**
  34954. * Get offsets to the reference element
  34955. * @method
  34956. * @memberof Popper.Utils
  34957. * @param {Object} state
  34958. * @param {Element} popper - the popper element
  34959. * @param {Element} reference - the reference element (the popper will be relative to this)
  34960. * @param {Element} fixedPosition - is in fixed position mode
  34961. * @returns {Object} An object containing the offsets which will be applied to the popper
  34962. */
  34963. function getReferenceOffsets(state, popper, reference) {
  34964. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34965. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34966. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34967. }
  34968. /**
  34969. * Get the outer sizes of the given element (offset size + margins)
  34970. * @method
  34971. * @memberof Popper.Utils
  34972. * @argument {Element} element
  34973. * @returns {Object} object containing width and height properties
  34974. */
  34975. function getOuterSizes(element) {
  34976. var window = element.ownerDocument.defaultView;
  34977. var styles = window.getComputedStyle(element);
  34978. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34979. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34980. var result = {
  34981. width: element.offsetWidth + y,
  34982. height: element.offsetHeight + x
  34983. };
  34984. return result;
  34985. }
  34986. /**
  34987. * Get the opposite placement of the given one
  34988. * @method
  34989. * @memberof Popper.Utils
  34990. * @argument {String} placement
  34991. * @returns {String} flipped placement
  34992. */
  34993. function getOppositePlacement(placement) {
  34994. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34995. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34996. return hash[matched];
  34997. });
  34998. }
  34999. /**
  35000. * Get offsets to the popper
  35001. * @method
  35002. * @memberof Popper.Utils
  35003. * @param {Object} position - CSS position the Popper will get applied
  35004. * @param {HTMLElement} popper - the popper element
  35005. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35006. * @param {String} placement - one of the valid placement options
  35007. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35008. */
  35009. function getPopperOffsets(popper, referenceOffsets, placement) {
  35010. placement = placement.split('-')[0];
  35011. // Get popper node sizes
  35012. var popperRect = getOuterSizes(popper);
  35013. // Add position, width and height to our offsets object
  35014. var popperOffsets = {
  35015. width: popperRect.width,
  35016. height: popperRect.height
  35017. };
  35018. // depending by the popper placement we have to compute its offsets slightly differently
  35019. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35020. var mainSide = isHoriz ? 'top' : 'left';
  35021. var secondarySide = isHoriz ? 'left' : 'top';
  35022. var measurement = isHoriz ? 'height' : 'width';
  35023. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35024. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35025. if (placement === secondarySide) {
  35026. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35027. } else {
  35028. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35029. }
  35030. return popperOffsets;
  35031. }
  35032. /**
  35033. * Mimics the `find` method of Array
  35034. * @method
  35035. * @memberof Popper.Utils
  35036. * @argument {Array} arr
  35037. * @argument prop
  35038. * @argument value
  35039. * @returns index or -1
  35040. */
  35041. function find(arr, check) {
  35042. // use native find if supported
  35043. if (Array.prototype.find) {
  35044. return arr.find(check);
  35045. }
  35046. // use `filter` to obtain the same behavior of `find`
  35047. return arr.filter(check)[0];
  35048. }
  35049. /**
  35050. * Return the index of the matching object
  35051. * @method
  35052. * @memberof Popper.Utils
  35053. * @argument {Array} arr
  35054. * @argument prop
  35055. * @argument value
  35056. * @returns index or -1
  35057. */
  35058. function findIndex(arr, prop, value) {
  35059. // use native findIndex if supported
  35060. if (Array.prototype.findIndex) {
  35061. return arr.findIndex(function (cur) {
  35062. return cur[prop] === value;
  35063. });
  35064. }
  35065. // use `find` + `indexOf` if `findIndex` isn't supported
  35066. var match = find(arr, function (obj) {
  35067. return obj[prop] === value;
  35068. });
  35069. return arr.indexOf(match);
  35070. }
  35071. /**
  35072. * Loop trough the list of modifiers and run them in order,
  35073. * each of them will then edit the data object.
  35074. * @method
  35075. * @memberof Popper.Utils
  35076. * @param {dataObject} data
  35077. * @param {Array} modifiers
  35078. * @param {String} ends - Optional modifier name used as stopper
  35079. * @returns {dataObject}
  35080. */
  35081. function runModifiers(modifiers, data, ends) {
  35082. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35083. modifiersToRun.forEach(function (modifier) {
  35084. if (modifier['function']) {
  35085. // eslint-disable-line dot-notation
  35086. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35087. }
  35088. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35089. if (modifier.enabled && isFunction(fn)) {
  35090. // Add properties to offsets to make them a complete clientRect object
  35091. // we do this before each modifier to make sure the previous one doesn't
  35092. // mess with these values
  35093. data.offsets.popper = getClientRect(data.offsets.popper);
  35094. data.offsets.reference = getClientRect(data.offsets.reference);
  35095. data = fn(data, modifier);
  35096. }
  35097. });
  35098. return data;
  35099. }
  35100. /**
  35101. * Updates the position of the popper, computing the new offsets and applying
  35102. * the new style.<br />
  35103. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35104. * @method
  35105. * @memberof Popper
  35106. */
  35107. function update() {
  35108. // if popper is destroyed, don't perform any further update
  35109. if (this.state.isDestroyed) {
  35110. return;
  35111. }
  35112. var data = {
  35113. instance: this,
  35114. styles: {},
  35115. arrowStyles: {},
  35116. attributes: {},
  35117. flipped: false,
  35118. offsets: {}
  35119. };
  35120. // compute reference element offsets
  35121. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35122. // compute auto placement, store placement inside the data object,
  35123. // modifiers will be able to edit `placement` if needed
  35124. // and refer to originalPlacement to know the original value
  35125. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35126. // store the computed placement inside `originalPlacement`
  35127. data.originalPlacement = data.placement;
  35128. data.positionFixed = this.options.positionFixed;
  35129. // compute the popper offsets
  35130. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35131. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35132. // run the modifiers
  35133. data = runModifiers(this.modifiers, data);
  35134. // the first `update` will call `onCreate` callback
  35135. // the other ones will call `onUpdate` callback
  35136. if (!this.state.isCreated) {
  35137. this.state.isCreated = true;
  35138. this.options.onCreate(data);
  35139. } else {
  35140. this.options.onUpdate(data);
  35141. }
  35142. }
  35143. /**
  35144. * Helper used to know if the given modifier is enabled.
  35145. * @method
  35146. * @memberof Popper.Utils
  35147. * @returns {Boolean}
  35148. */
  35149. function isModifierEnabled(modifiers, modifierName) {
  35150. return modifiers.some(function (_ref) {
  35151. var name = _ref.name,
  35152. enabled = _ref.enabled;
  35153. return enabled && name === modifierName;
  35154. });
  35155. }
  35156. /**
  35157. * Get the prefixed supported property name
  35158. * @method
  35159. * @memberof Popper.Utils
  35160. * @argument {String} property (camelCase)
  35161. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35162. */
  35163. function getSupportedPropertyName(property) {
  35164. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35165. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35166. for (var i = 0; i < prefixes.length; i++) {
  35167. var prefix = prefixes[i];
  35168. var toCheck = prefix ? '' + prefix + upperProp : property;
  35169. if (typeof document.body.style[toCheck] !== 'undefined') {
  35170. return toCheck;
  35171. }
  35172. }
  35173. return null;
  35174. }
  35175. /**
  35176. * Destroys the popper.
  35177. * @method
  35178. * @memberof Popper
  35179. */
  35180. function destroy() {
  35181. this.state.isDestroyed = true;
  35182. // touch DOM only if `applyStyle` modifier is enabled
  35183. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35184. this.popper.removeAttribute('x-placement');
  35185. this.popper.style.position = '';
  35186. this.popper.style.top = '';
  35187. this.popper.style.left = '';
  35188. this.popper.style.right = '';
  35189. this.popper.style.bottom = '';
  35190. this.popper.style.willChange = '';
  35191. this.popper.style[getSupportedPropertyName('transform')] = '';
  35192. }
  35193. this.disableEventListeners();
  35194. // remove the popper if user explicitly asked for the deletion on destroy
  35195. // do not use `remove` because IE11 doesn't support it
  35196. if (this.options.removeOnDestroy) {
  35197. this.popper.parentNode.removeChild(this.popper);
  35198. }
  35199. return this;
  35200. }
  35201. /**
  35202. * Get the window associated with the element
  35203. * @argument {Element} element
  35204. * @returns {Window}
  35205. */
  35206. function getWindow(element) {
  35207. var ownerDocument = element.ownerDocument;
  35208. return ownerDocument ? ownerDocument.defaultView : window;
  35209. }
  35210. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35211. var isBody = scrollParent.nodeName === 'BODY';
  35212. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35213. target.addEventListener(event, callback, { passive: true });
  35214. if (!isBody) {
  35215. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35216. }
  35217. scrollParents.push(target);
  35218. }
  35219. /**
  35220. * Setup needed event listeners used to update the popper position
  35221. * @method
  35222. * @memberof Popper.Utils
  35223. * @private
  35224. */
  35225. function setupEventListeners(reference, options, state, updateBound) {
  35226. // Resize event listener on window
  35227. state.updateBound = updateBound;
  35228. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35229. // Scroll event listener on scroll parents
  35230. var scrollElement = getScrollParent(reference);
  35231. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35232. state.scrollElement = scrollElement;
  35233. state.eventsEnabled = true;
  35234. return state;
  35235. }
  35236. /**
  35237. * It will add resize/scroll events and start recalculating
  35238. * position of the popper element when they are triggered.
  35239. * @method
  35240. * @memberof Popper
  35241. */
  35242. function enableEventListeners() {
  35243. if (!this.state.eventsEnabled) {
  35244. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35245. }
  35246. }
  35247. /**
  35248. * Remove event listeners used to update the popper position
  35249. * @method
  35250. * @memberof Popper.Utils
  35251. * @private
  35252. */
  35253. function removeEventListeners(reference, state) {
  35254. // Remove resize event listener on window
  35255. getWindow(reference).removeEventListener('resize', state.updateBound);
  35256. // Remove scroll event listener on scroll parents
  35257. state.scrollParents.forEach(function (target) {
  35258. target.removeEventListener('scroll', state.updateBound);
  35259. });
  35260. // Reset state
  35261. state.updateBound = null;
  35262. state.scrollParents = [];
  35263. state.scrollElement = null;
  35264. state.eventsEnabled = false;
  35265. return state;
  35266. }
  35267. /**
  35268. * It will remove resize/scroll events and won't recalculate popper position
  35269. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35270. * unless you call `update` method manually.
  35271. * @method
  35272. * @memberof Popper
  35273. */
  35274. function disableEventListeners() {
  35275. if (this.state.eventsEnabled) {
  35276. cancelAnimationFrame(this.scheduleUpdate);
  35277. this.state = removeEventListeners(this.reference, this.state);
  35278. }
  35279. }
  35280. /**
  35281. * Tells if a given input is a number
  35282. * @method
  35283. * @memberof Popper.Utils
  35284. * @param {*} input to check
  35285. * @return {Boolean}
  35286. */
  35287. function isNumeric(n) {
  35288. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35289. }
  35290. /**
  35291. * Set the style to the given popper
  35292. * @method
  35293. * @memberof Popper.Utils
  35294. * @argument {Element} element - Element to apply the style to
  35295. * @argument {Object} styles
  35296. * Object with a list of properties and values which will be applied to the element
  35297. */
  35298. function setStyles(element, styles) {
  35299. Object.keys(styles).forEach(function (prop) {
  35300. var unit = '';
  35301. // add unit if the value is numeric and is one of the following
  35302. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35303. unit = 'px';
  35304. }
  35305. element.style[prop] = styles[prop] + unit;
  35306. });
  35307. }
  35308. /**
  35309. * Set the attributes to the given popper
  35310. * @method
  35311. * @memberof Popper.Utils
  35312. * @argument {Element} element - Element to apply the attributes to
  35313. * @argument {Object} styles
  35314. * Object with a list of properties and values which will be applied to the element
  35315. */
  35316. function setAttributes(element, attributes) {
  35317. Object.keys(attributes).forEach(function (prop) {
  35318. var value = attributes[prop];
  35319. if (value !== false) {
  35320. element.setAttribute(prop, attributes[prop]);
  35321. } else {
  35322. element.removeAttribute(prop);
  35323. }
  35324. });
  35325. }
  35326. /**
  35327. * @function
  35328. * @memberof Modifiers
  35329. * @argument {Object} data - The data object generated by `update` method
  35330. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35331. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35332. * @argument {Object} options - Modifiers configuration and options
  35333. * @returns {Object} The same data object
  35334. */
  35335. function applyStyle(data) {
  35336. // any property present in `data.styles` will be applied to the popper,
  35337. // in this way we can make the 3rd party modifiers add custom styles to it
  35338. // Be aware, modifiers could override the properties defined in the previous
  35339. // lines of this modifier!
  35340. setStyles(data.instance.popper, data.styles);
  35341. // any property present in `data.attributes` will be applied to the popper,
  35342. // they will be set as HTML attributes of the element
  35343. setAttributes(data.instance.popper, data.attributes);
  35344. // if arrowElement is defined and arrowStyles has some properties
  35345. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35346. setStyles(data.arrowElement, data.arrowStyles);
  35347. }
  35348. return data;
  35349. }
  35350. /**
  35351. * Set the x-placement attribute before everything else because it could be used
  35352. * to add margins to the popper margins needs to be calculated to get the
  35353. * correct popper offsets.
  35354. * @method
  35355. * @memberof Popper.modifiers
  35356. * @param {HTMLElement} reference - The reference element used to position the popper
  35357. * @param {HTMLElement} popper - The HTML element used as popper
  35358. * @param {Object} options - Popper.js options
  35359. */
  35360. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35361. // compute reference element offsets
  35362. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35363. // compute auto placement, store placement inside the data object,
  35364. // modifiers will be able to edit `placement` if needed
  35365. // and refer to originalPlacement to know the original value
  35366. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35367. popper.setAttribute('x-placement', placement);
  35368. // Apply `position` to popper before anything else because
  35369. // without the position applied we can't guarantee correct computations
  35370. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35371. return options;
  35372. }
  35373. /**
  35374. * @function
  35375. * @memberof Popper.Utils
  35376. * @argument {Object} data - The data object generated by `update` method
  35377. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35378. * @returns {Object} The popper's position offsets rounded
  35379. *
  35380. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35381. * good as it can be within reason.
  35382. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35383. *
  35384. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35385. * as well on High DPI screens).
  35386. *
  35387. * Firefox prefers no rounding for positioning and does not have blurriness on
  35388. * high DPI screens.
  35389. *
  35390. * Only horizontal placement and left/right values need to be considered.
  35391. */
  35392. function getRoundedOffsets(data, shouldRound) {
  35393. var _data$offsets = data.offsets,
  35394. popper = _data$offsets.popper,
  35395. reference = _data$offsets.reference;
  35396. var round = Math.round,
  35397. floor = Math.floor;
  35398. var noRound = function noRound(v) {
  35399. return v;
  35400. };
  35401. var referenceWidth = round(reference.width);
  35402. var popperWidth = round(popper.width);
  35403. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35404. var isVariation = data.placement.indexOf('-') !== -1;
  35405. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35406. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35407. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35408. var verticalToInteger = !shouldRound ? noRound : round;
  35409. return {
  35410. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35411. top: verticalToInteger(popper.top),
  35412. bottom: verticalToInteger(popper.bottom),
  35413. right: horizontalToInteger(popper.right)
  35414. };
  35415. }
  35416. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35417. /**
  35418. * @function
  35419. * @memberof Modifiers
  35420. * @argument {Object} data - The data object generated by `update` method
  35421. * @argument {Object} options - Modifiers configuration and options
  35422. * @returns {Object} The data object, properly modified
  35423. */
  35424. function computeStyle(data, options) {
  35425. var x = options.x,
  35426. y = options.y;
  35427. var popper = data.offsets.popper;
  35428. // Remove this legacy support in Popper.js v2
  35429. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35430. return modifier.name === 'applyStyle';
  35431. }).gpuAcceleration;
  35432. if (legacyGpuAccelerationOption !== undefined) {
  35433. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35434. }
  35435. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35436. var offsetParent = getOffsetParent(data.instance.popper);
  35437. var offsetParentRect = getBoundingClientRect(offsetParent);
  35438. // Styles
  35439. var styles = {
  35440. position: popper.position
  35441. };
  35442. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35443. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35444. var sideB = y === 'right' ? 'left' : 'right';
  35445. // if gpuAcceleration is set to `true` and transform is supported,
  35446. // we use `translate3d` to apply the position to the popper we
  35447. // automatically use the supported prefixed version if needed
  35448. var prefixedProperty = getSupportedPropertyName('transform');
  35449. // now, let's make a step back and look at this code closely (wtf?)
  35450. // If the content of the popper grows once it's been positioned, it
  35451. // may happen that the popper gets misplaced because of the new content
  35452. // overflowing its reference element
  35453. // To avoid this problem, we provide two options (x and y), which allow
  35454. // the consumer to define the offset origin.
  35455. // If we position a popper on top of a reference element, we can set
  35456. // `x` to `top` to make the popper grow towards its top instead of
  35457. // its bottom.
  35458. var left = void 0,
  35459. top = void 0;
  35460. if (sideA === 'bottom') {
  35461. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35462. // and not the bottom of the html element
  35463. if (offsetParent.nodeName === 'HTML') {
  35464. top = -offsetParent.clientHeight + offsets.bottom;
  35465. } else {
  35466. top = -offsetParentRect.height + offsets.bottom;
  35467. }
  35468. } else {
  35469. top = offsets.top;
  35470. }
  35471. if (sideB === 'right') {
  35472. if (offsetParent.nodeName === 'HTML') {
  35473. left = -offsetParent.clientWidth + offsets.right;
  35474. } else {
  35475. left = -offsetParentRect.width + offsets.right;
  35476. }
  35477. } else {
  35478. left = offsets.left;
  35479. }
  35480. if (gpuAcceleration && prefixedProperty) {
  35481. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35482. styles[sideA] = 0;
  35483. styles[sideB] = 0;
  35484. styles.willChange = 'transform';
  35485. } else {
  35486. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35487. var invertTop = sideA === 'bottom' ? -1 : 1;
  35488. var invertLeft = sideB === 'right' ? -1 : 1;
  35489. styles[sideA] = top * invertTop;
  35490. styles[sideB] = left * invertLeft;
  35491. styles.willChange = sideA + ', ' + sideB;
  35492. }
  35493. // Attributes
  35494. var attributes = {
  35495. 'x-placement': data.placement
  35496. };
  35497. // Update `data` attributes, styles and arrowStyles
  35498. data.attributes = _extends({}, attributes, data.attributes);
  35499. data.styles = _extends({}, styles, data.styles);
  35500. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35501. return data;
  35502. }
  35503. /**
  35504. * Helper used to know if the given modifier depends from another one.<br />
  35505. * It checks if the needed modifier is listed and enabled.
  35506. * @method
  35507. * @memberof Popper.Utils
  35508. * @param {Array} modifiers - list of modifiers
  35509. * @param {String} requestingName - name of requesting modifier
  35510. * @param {String} requestedName - name of requested modifier
  35511. * @returns {Boolean}
  35512. */
  35513. function isModifierRequired(modifiers, requestingName, requestedName) {
  35514. var requesting = find(modifiers, function (_ref) {
  35515. var name = _ref.name;
  35516. return name === requestingName;
  35517. });
  35518. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35519. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35520. });
  35521. if (!isRequired) {
  35522. var _requesting = '`' + requestingName + '`';
  35523. var requested = '`' + requestedName + '`';
  35524. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35525. }
  35526. return isRequired;
  35527. }
  35528. /**
  35529. * @function
  35530. * @memberof Modifiers
  35531. * @argument {Object} data - The data object generated by update method
  35532. * @argument {Object} options - Modifiers configuration and options
  35533. * @returns {Object} The data object, properly modified
  35534. */
  35535. function arrow(data, options) {
  35536. var _data$offsets$arrow;
  35537. // arrow depends on keepTogether in order to work
  35538. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35539. return data;
  35540. }
  35541. var arrowElement = options.element;
  35542. // if arrowElement is a string, suppose it's a CSS selector
  35543. if (typeof arrowElement === 'string') {
  35544. arrowElement = data.instance.popper.querySelector(arrowElement);
  35545. // if arrowElement is not found, don't run the modifier
  35546. if (!arrowElement) {
  35547. return data;
  35548. }
  35549. } else {
  35550. // if the arrowElement isn't a query selector we must check that the
  35551. // provided DOM node is child of its popper node
  35552. if (!data.instance.popper.contains(arrowElement)) {
  35553. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35554. return data;
  35555. }
  35556. }
  35557. var placement = data.placement.split('-')[0];
  35558. var _data$offsets = data.offsets,
  35559. popper = _data$offsets.popper,
  35560. reference = _data$offsets.reference;
  35561. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35562. var len = isVertical ? 'height' : 'width';
  35563. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35564. var side = sideCapitalized.toLowerCase();
  35565. var altSide = isVertical ? 'left' : 'top';
  35566. var opSide = isVertical ? 'bottom' : 'right';
  35567. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35568. //
  35569. // extends keepTogether behavior making sure the popper and its
  35570. // reference have enough pixels in conjunction
  35571. //
  35572. // top/left side
  35573. if (reference[opSide] - arrowElementSize < popper[side]) {
  35574. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35575. }
  35576. // bottom/right side
  35577. if (reference[side] + arrowElementSize > popper[opSide]) {
  35578. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35579. }
  35580. data.offsets.popper = getClientRect(data.offsets.popper);
  35581. // compute center of the popper
  35582. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35583. // Compute the sideValue using the updated popper offsets
  35584. // take popper margin in account because we don't have this info available
  35585. var css = getStyleComputedProperty(data.instance.popper);
  35586. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35587. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35588. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35589. // prevent arrowElement from being placed not contiguously to its popper
  35590. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35591. data.arrowElement = arrowElement;
  35592. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35593. return data;
  35594. }
  35595. /**
  35596. * Get the opposite placement variation of the given one
  35597. * @method
  35598. * @memberof Popper.Utils
  35599. * @argument {String} placement variation
  35600. * @returns {String} flipped placement variation
  35601. */
  35602. function getOppositeVariation(variation) {
  35603. if (variation === 'end') {
  35604. return 'start';
  35605. } else if (variation === 'start') {
  35606. return 'end';
  35607. }
  35608. return variation;
  35609. }
  35610. /**
  35611. * List of accepted placements to use as values of the `placement` option.<br />
  35612. * Valid placements are:
  35613. * - `auto`
  35614. * - `top`
  35615. * - `right`
  35616. * - `bottom`
  35617. * - `left`
  35618. *
  35619. * Each placement can have a variation from this list:
  35620. * - `-start`
  35621. * - `-end`
  35622. *
  35623. * Variations are interpreted easily if you think of them as the left to right
  35624. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35625. * is right.<br />
  35626. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35627. *
  35628. * Some valid examples are:
  35629. * - `top-end` (on top of reference, right aligned)
  35630. * - `right-start` (on right of reference, top aligned)
  35631. * - `bottom` (on bottom, centered)
  35632. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35633. *
  35634. * @static
  35635. * @type {Array}
  35636. * @enum {String}
  35637. * @readonly
  35638. * @method placements
  35639. * @memberof Popper
  35640. */
  35641. 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'];
  35642. // Get rid of `auto` `auto-start` and `auto-end`
  35643. var validPlacements = placements.slice(3);
  35644. /**
  35645. * Given an initial placement, returns all the subsequent placements
  35646. * clockwise (or counter-clockwise).
  35647. *
  35648. * @method
  35649. * @memberof Popper.Utils
  35650. * @argument {String} placement - A valid placement (it accepts variations)
  35651. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35652. * @returns {Array} placements including their variations
  35653. */
  35654. function clockwise(placement) {
  35655. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35656. var index = validPlacements.indexOf(placement);
  35657. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35658. return counter ? arr.reverse() : arr;
  35659. }
  35660. var BEHAVIORS = {
  35661. FLIP: 'flip',
  35662. CLOCKWISE: 'clockwise',
  35663. COUNTERCLOCKWISE: 'counterclockwise'
  35664. };
  35665. /**
  35666. * @function
  35667. * @memberof Modifiers
  35668. * @argument {Object} data - The data object generated by update method
  35669. * @argument {Object} options - Modifiers configuration and options
  35670. * @returns {Object} The data object, properly modified
  35671. */
  35672. function flip(data, options) {
  35673. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35674. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35675. return data;
  35676. }
  35677. if (data.flipped && data.placement === data.originalPlacement) {
  35678. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35679. return data;
  35680. }
  35681. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35682. var placement = data.placement.split('-')[0];
  35683. var placementOpposite = getOppositePlacement(placement);
  35684. var variation = data.placement.split('-')[1] || '';
  35685. var flipOrder = [];
  35686. switch (options.behavior) {
  35687. case BEHAVIORS.FLIP:
  35688. flipOrder = [placement, placementOpposite];
  35689. break;
  35690. case BEHAVIORS.CLOCKWISE:
  35691. flipOrder = clockwise(placement);
  35692. break;
  35693. case BEHAVIORS.COUNTERCLOCKWISE:
  35694. flipOrder = clockwise(placement, true);
  35695. break;
  35696. default:
  35697. flipOrder = options.behavior;
  35698. }
  35699. flipOrder.forEach(function (step, index) {
  35700. if (placement !== step || flipOrder.length === index + 1) {
  35701. return data;
  35702. }
  35703. placement = data.placement.split('-')[0];
  35704. placementOpposite = getOppositePlacement(placement);
  35705. var popperOffsets = data.offsets.popper;
  35706. var refOffsets = data.offsets.reference;
  35707. // using floor because the reference offsets may contain decimals we are not going to consider here
  35708. var floor = Math.floor;
  35709. 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);
  35710. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35711. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35712. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35713. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35714. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35715. // flip the variation if required
  35716. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35717. // flips variation if reference element overflows boundaries
  35718. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35719. // flips variation if popper content overflows boundaries
  35720. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35721. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35722. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35723. // this boolean to detect any flip loop
  35724. data.flipped = true;
  35725. if (overlapsRef || overflowsBoundaries) {
  35726. placement = flipOrder[index + 1];
  35727. }
  35728. if (flippedVariation) {
  35729. variation = getOppositeVariation(variation);
  35730. }
  35731. data.placement = placement + (variation ? '-' + variation : '');
  35732. // this object contains `position`, we want to preserve it along with
  35733. // any additional property we may add in the future
  35734. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35735. data = runModifiers(data.instance.modifiers, data, 'flip');
  35736. }
  35737. });
  35738. return data;
  35739. }
  35740. /**
  35741. * @function
  35742. * @memberof Modifiers
  35743. * @argument {Object} data - The data object generated by update method
  35744. * @argument {Object} options - Modifiers configuration and options
  35745. * @returns {Object} The data object, properly modified
  35746. */
  35747. function keepTogether(data) {
  35748. var _data$offsets = data.offsets,
  35749. popper = _data$offsets.popper,
  35750. reference = _data$offsets.reference;
  35751. var placement = data.placement.split('-')[0];
  35752. var floor = Math.floor;
  35753. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35754. var side = isVertical ? 'right' : 'bottom';
  35755. var opSide = isVertical ? 'left' : 'top';
  35756. var measurement = isVertical ? 'width' : 'height';
  35757. if (popper[side] < floor(reference[opSide])) {
  35758. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35759. }
  35760. if (popper[opSide] > floor(reference[side])) {
  35761. data.offsets.popper[opSide] = floor(reference[side]);
  35762. }
  35763. return data;
  35764. }
  35765. /**
  35766. * Converts a string containing value + unit into a px value number
  35767. * @function
  35768. * @memberof {modifiers~offset}
  35769. * @private
  35770. * @argument {String} str - Value + unit string
  35771. * @argument {String} measurement - `height` or `width`
  35772. * @argument {Object} popperOffsets
  35773. * @argument {Object} referenceOffsets
  35774. * @returns {Number|String}
  35775. * Value in pixels, or original string if no values were extracted
  35776. */
  35777. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35778. // separate value from unit
  35779. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35780. var value = +split[1];
  35781. var unit = split[2];
  35782. // If it's not a number it's an operator, I guess
  35783. if (!value) {
  35784. return str;
  35785. }
  35786. if (unit.indexOf('%') === 0) {
  35787. var element = void 0;
  35788. switch (unit) {
  35789. case '%p':
  35790. element = popperOffsets;
  35791. break;
  35792. case '%':
  35793. case '%r':
  35794. default:
  35795. element = referenceOffsets;
  35796. }
  35797. var rect = getClientRect(element);
  35798. return rect[measurement] / 100 * value;
  35799. } else if (unit === 'vh' || unit === 'vw') {
  35800. // if is a vh or vw, we calculate the size based on the viewport
  35801. var size = void 0;
  35802. if (unit === 'vh') {
  35803. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35804. } else {
  35805. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35806. }
  35807. return size / 100 * value;
  35808. } else {
  35809. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35810. // if is an implicit unit, it's px, and we return just the value
  35811. return value;
  35812. }
  35813. }
  35814. /**
  35815. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35816. * @function
  35817. * @memberof {modifiers~offset}
  35818. * @private
  35819. * @argument {String} offset
  35820. * @argument {Object} popperOffsets
  35821. * @argument {Object} referenceOffsets
  35822. * @argument {String} basePlacement
  35823. * @returns {Array} a two cells array with x and y offsets in numbers
  35824. */
  35825. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35826. var offsets = [0, 0];
  35827. // Use height if placement is left or right and index is 0 otherwise use width
  35828. // in this way the first offset will use an axis and the second one
  35829. // will use the other one
  35830. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35831. // Split the offset string to obtain a list of values and operands
  35832. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35833. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35834. return frag.trim();
  35835. });
  35836. // Detect if the offset string contains a pair of values or a single one
  35837. // they could be separated by comma or space
  35838. var divider = fragments.indexOf(find(fragments, function (frag) {
  35839. return frag.search(/,|\s/) !== -1;
  35840. }));
  35841. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35842. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35843. }
  35844. // If divider is found, we divide the list of values and operands to divide
  35845. // them by ofset X and Y.
  35846. var splitRegex = /\s*,\s*|\s+/;
  35847. 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];
  35848. // Convert the values with units to absolute pixels to allow our computations
  35849. ops = ops.map(function (op, index) {
  35850. // Most of the units rely on the orientation of the popper
  35851. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35852. var mergeWithPrevious = false;
  35853. return op
  35854. // This aggregates any `+` or `-` sign that aren't considered operators
  35855. // e.g.: 10 + +5 => [10, +, +5]
  35856. .reduce(function (a, b) {
  35857. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35858. a[a.length - 1] = b;
  35859. mergeWithPrevious = true;
  35860. return a;
  35861. } else if (mergeWithPrevious) {
  35862. a[a.length - 1] += b;
  35863. mergeWithPrevious = false;
  35864. return a;
  35865. } else {
  35866. return a.concat(b);
  35867. }
  35868. }, [])
  35869. // Here we convert the string values into number values (in px)
  35870. .map(function (str) {
  35871. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35872. });
  35873. });
  35874. // Loop trough the offsets arrays and execute the operations
  35875. ops.forEach(function (op, index) {
  35876. op.forEach(function (frag, index2) {
  35877. if (isNumeric(frag)) {
  35878. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35879. }
  35880. });
  35881. });
  35882. return offsets;
  35883. }
  35884. /**
  35885. * @function
  35886. * @memberof Modifiers
  35887. * @argument {Object} data - The data object generated by update method
  35888. * @argument {Object} options - Modifiers configuration and options
  35889. * @argument {Number|String} options.offset=0
  35890. * The offset value as described in the modifier description
  35891. * @returns {Object} The data object, properly modified
  35892. */
  35893. function offset(data, _ref) {
  35894. var offset = _ref.offset;
  35895. var placement = data.placement,
  35896. _data$offsets = data.offsets,
  35897. popper = _data$offsets.popper,
  35898. reference = _data$offsets.reference;
  35899. var basePlacement = placement.split('-')[0];
  35900. var offsets = void 0;
  35901. if (isNumeric(+offset)) {
  35902. offsets = [+offset, 0];
  35903. } else {
  35904. offsets = parseOffset(offset, popper, reference, basePlacement);
  35905. }
  35906. if (basePlacement === 'left') {
  35907. popper.top += offsets[0];
  35908. popper.left -= offsets[1];
  35909. } else if (basePlacement === 'right') {
  35910. popper.top += offsets[0];
  35911. popper.left += offsets[1];
  35912. } else if (basePlacement === 'top') {
  35913. popper.left += offsets[0];
  35914. popper.top -= offsets[1];
  35915. } else if (basePlacement === 'bottom') {
  35916. popper.left += offsets[0];
  35917. popper.top += offsets[1];
  35918. }
  35919. data.popper = popper;
  35920. return data;
  35921. }
  35922. /**
  35923. * @function
  35924. * @memberof Modifiers
  35925. * @argument {Object} data - The data object generated by `update` method
  35926. * @argument {Object} options - Modifiers configuration and options
  35927. * @returns {Object} The data object, properly modified
  35928. */
  35929. function preventOverflow(data, options) {
  35930. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35931. // If offsetParent is the reference element, we really want to
  35932. // go one step up and use the next offsetParent as reference to
  35933. // avoid to make this modifier completely useless and look like broken
  35934. if (data.instance.reference === boundariesElement) {
  35935. boundariesElement = getOffsetParent(boundariesElement);
  35936. }
  35937. // NOTE: DOM access here
  35938. // resets the popper's position so that the document size can be calculated excluding
  35939. // the size of the popper element itself
  35940. var transformProp = getSupportedPropertyName('transform');
  35941. var popperStyles = data.instance.popper.style; // assignment to help minification
  35942. var top = popperStyles.top,
  35943. left = popperStyles.left,
  35944. transform = popperStyles[transformProp];
  35945. popperStyles.top = '';
  35946. popperStyles.left = '';
  35947. popperStyles[transformProp] = '';
  35948. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35949. // NOTE: DOM access here
  35950. // restores the original style properties after the offsets have been computed
  35951. popperStyles.top = top;
  35952. popperStyles.left = left;
  35953. popperStyles[transformProp] = transform;
  35954. options.boundaries = boundaries;
  35955. var order = options.priority;
  35956. var popper = data.offsets.popper;
  35957. var check = {
  35958. primary: function primary(placement) {
  35959. var value = popper[placement];
  35960. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35961. value = Math.max(popper[placement], boundaries[placement]);
  35962. }
  35963. return defineProperty({}, placement, value);
  35964. },
  35965. secondary: function secondary(placement) {
  35966. var mainSide = placement === 'right' ? 'left' : 'top';
  35967. var value = popper[mainSide];
  35968. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35969. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35970. }
  35971. return defineProperty({}, mainSide, value);
  35972. }
  35973. };
  35974. order.forEach(function (placement) {
  35975. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35976. popper = _extends({}, popper, check[side](placement));
  35977. });
  35978. data.offsets.popper = popper;
  35979. return data;
  35980. }
  35981. /**
  35982. * @function
  35983. * @memberof Modifiers
  35984. * @argument {Object} data - The data object generated by `update` method
  35985. * @argument {Object} options - Modifiers configuration and options
  35986. * @returns {Object} The data object, properly modified
  35987. */
  35988. function shift(data) {
  35989. var placement = data.placement;
  35990. var basePlacement = placement.split('-')[0];
  35991. var shiftvariation = placement.split('-')[1];
  35992. // if shift shiftvariation is specified, run the modifier
  35993. if (shiftvariation) {
  35994. var _data$offsets = data.offsets,
  35995. reference = _data$offsets.reference,
  35996. popper = _data$offsets.popper;
  35997. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35998. var side = isVertical ? 'left' : 'top';
  35999. var measurement = isVertical ? 'width' : 'height';
  36000. var shiftOffsets = {
  36001. start: defineProperty({}, side, reference[side]),
  36002. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36003. };
  36004. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36005. }
  36006. return data;
  36007. }
  36008. /**
  36009. * @function
  36010. * @memberof Modifiers
  36011. * @argument {Object} data - The data object generated by update method
  36012. * @argument {Object} options - Modifiers configuration and options
  36013. * @returns {Object} The data object, properly modified
  36014. */
  36015. function hide(data) {
  36016. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36017. return data;
  36018. }
  36019. var refRect = data.offsets.reference;
  36020. var bound = find(data.instance.modifiers, function (modifier) {
  36021. return modifier.name === 'preventOverflow';
  36022. }).boundaries;
  36023. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36024. // Avoid unnecessary DOM access if visibility hasn't changed
  36025. if (data.hide === true) {
  36026. return data;
  36027. }
  36028. data.hide = true;
  36029. data.attributes['x-out-of-boundaries'] = '';
  36030. } else {
  36031. // Avoid unnecessary DOM access if visibility hasn't changed
  36032. if (data.hide === false) {
  36033. return data;
  36034. }
  36035. data.hide = false;
  36036. data.attributes['x-out-of-boundaries'] = false;
  36037. }
  36038. return data;
  36039. }
  36040. /**
  36041. * @function
  36042. * @memberof Modifiers
  36043. * @argument {Object} data - The data object generated by `update` method
  36044. * @argument {Object} options - Modifiers configuration and options
  36045. * @returns {Object} The data object, properly modified
  36046. */
  36047. function inner(data) {
  36048. var placement = data.placement;
  36049. var basePlacement = placement.split('-')[0];
  36050. var _data$offsets = data.offsets,
  36051. popper = _data$offsets.popper,
  36052. reference = _data$offsets.reference;
  36053. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36054. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36055. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36056. data.placement = getOppositePlacement(placement);
  36057. data.offsets.popper = getClientRect(popper);
  36058. return data;
  36059. }
  36060. /**
  36061. * Modifier function, each modifier can have a function of this type assigned
  36062. * to its `fn` property.<br />
  36063. * These functions will be called on each update, this means that you must
  36064. * make sure they are performant enough to avoid performance bottlenecks.
  36065. *
  36066. * @function ModifierFn
  36067. * @argument {dataObject} data - The data object generated by `update` method
  36068. * @argument {Object} options - Modifiers configuration and options
  36069. * @returns {dataObject} The data object, properly modified
  36070. */
  36071. /**
  36072. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36073. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36074. * needed by the library.
  36075. *
  36076. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36077. * All the other properties are configurations that could be tweaked.
  36078. * @namespace modifiers
  36079. */
  36080. var modifiers = {
  36081. /**
  36082. * Modifier used to shift the popper on the start or end of its reference
  36083. * element.<br />
  36084. * It will read the variation of the `placement` property.<br />
  36085. * It can be one either `-end` or `-start`.
  36086. * @memberof modifiers
  36087. * @inner
  36088. */
  36089. shift: {
  36090. /** @prop {number} order=100 - Index used to define the order of execution */
  36091. order: 100,
  36092. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36093. enabled: true,
  36094. /** @prop {ModifierFn} */
  36095. fn: shift
  36096. },
  36097. /**
  36098. * The `offset` modifier can shift your popper on both its axis.
  36099. *
  36100. * It accepts the following units:
  36101. * - `px` or unit-less, interpreted as pixels
  36102. * - `%` or `%r`, percentage relative to the length of the reference element
  36103. * - `%p`, percentage relative to the length of the popper element
  36104. * - `vw`, CSS viewport width unit
  36105. * - `vh`, CSS viewport height unit
  36106. *
  36107. * For length is intended the main axis relative to the placement of the popper.<br />
  36108. * This means that if the placement is `top` or `bottom`, the length will be the
  36109. * `width`. In case of `left` or `right`, it will be the `height`.
  36110. *
  36111. * You can provide a single value (as `Number` or `String`), or a pair of values
  36112. * as `String` divided by a comma or one (or more) white spaces.<br />
  36113. * The latter is a deprecated method because it leads to confusion and will be
  36114. * removed in v2.<br />
  36115. * Additionally, it accepts additions and subtractions between different units.
  36116. * Note that multiplications and divisions aren't supported.
  36117. *
  36118. * Valid examples are:
  36119. * ```
  36120. * 10
  36121. * '10%'
  36122. * '10, 10'
  36123. * '10%, 10'
  36124. * '10 + 10%'
  36125. * '10 - 5vh + 3%'
  36126. * '-10px + 5vh, 5px - 6%'
  36127. * ```
  36128. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36129. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36130. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36131. *
  36132. * @memberof modifiers
  36133. * @inner
  36134. */
  36135. offset: {
  36136. /** @prop {number} order=200 - Index used to define the order of execution */
  36137. order: 200,
  36138. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36139. enabled: true,
  36140. /** @prop {ModifierFn} */
  36141. fn: offset,
  36142. /** @prop {Number|String} offset=0
  36143. * The offset value as described in the modifier description
  36144. */
  36145. offset: 0
  36146. },
  36147. /**
  36148. * Modifier used to prevent the popper from being positioned outside the boundary.
  36149. *
  36150. * A scenario exists where the reference itself is not within the boundaries.<br />
  36151. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36152. * In this case we need to decide whether the popper should either:
  36153. *
  36154. * - detach from the reference and remain "trapped" in the boundaries, or
  36155. * - if it should ignore the boundary and "escape with its reference"
  36156. *
  36157. * When `escapeWithReference` is set to`true` and reference is completely
  36158. * outside its boundaries, the popper will overflow (or completely leave)
  36159. * the boundaries in order to remain attached to the edge of the reference.
  36160. *
  36161. * @memberof modifiers
  36162. * @inner
  36163. */
  36164. preventOverflow: {
  36165. /** @prop {number} order=300 - Index used to define the order of execution */
  36166. order: 300,
  36167. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36168. enabled: true,
  36169. /** @prop {ModifierFn} */
  36170. fn: preventOverflow,
  36171. /**
  36172. * @prop {Array} [priority=['left','right','top','bottom']]
  36173. * Popper will try to prevent overflow following these priorities by default,
  36174. * then, it could overflow on the left and on top of the `boundariesElement`
  36175. */
  36176. priority: ['left', 'right', 'top', 'bottom'],
  36177. /**
  36178. * @prop {number} padding=5
  36179. * Amount of pixel used to define a minimum distance between the boundaries
  36180. * and the popper. This makes sure the popper always has a little padding
  36181. * between the edges of its container
  36182. */
  36183. padding: 5,
  36184. /**
  36185. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36186. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36187. * `viewport` or any DOM element.
  36188. */
  36189. boundariesElement: 'scrollParent'
  36190. },
  36191. /**
  36192. * Modifier used to make sure the reference and its popper stay near each other
  36193. * without leaving any gap between the two. Especially useful when the arrow is
  36194. * enabled and you want to ensure that it points to its reference element.
  36195. * It cares only about the first axis. You can still have poppers with margin
  36196. * between the popper and its reference element.
  36197. * @memberof modifiers
  36198. * @inner
  36199. */
  36200. keepTogether: {
  36201. /** @prop {number} order=400 - Index used to define the order of execution */
  36202. order: 400,
  36203. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36204. enabled: true,
  36205. /** @prop {ModifierFn} */
  36206. fn: keepTogether
  36207. },
  36208. /**
  36209. * This modifier is used to move the `arrowElement` of the popper to make
  36210. * sure it is positioned between the reference element and its popper element.
  36211. * It will read the outer size of the `arrowElement` node to detect how many
  36212. * pixels of conjunction are needed.
  36213. *
  36214. * It has no effect if no `arrowElement` is provided.
  36215. * @memberof modifiers
  36216. * @inner
  36217. */
  36218. arrow: {
  36219. /** @prop {number} order=500 - Index used to define the order of execution */
  36220. order: 500,
  36221. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36222. enabled: true,
  36223. /** @prop {ModifierFn} */
  36224. fn: arrow,
  36225. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36226. element: '[x-arrow]'
  36227. },
  36228. /**
  36229. * Modifier used to flip the popper's placement when it starts to overlap its
  36230. * reference element.
  36231. *
  36232. * Requires the `preventOverflow` modifier before it in order to work.
  36233. *
  36234. * **NOTE:** this modifier will interrupt the current update cycle and will
  36235. * restart it if it detects the need to flip the placement.
  36236. * @memberof modifiers
  36237. * @inner
  36238. */
  36239. flip: {
  36240. /** @prop {number} order=600 - Index used to define the order of execution */
  36241. order: 600,
  36242. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36243. enabled: true,
  36244. /** @prop {ModifierFn} */
  36245. fn: flip,
  36246. /**
  36247. * @prop {String|Array} behavior='flip'
  36248. * The behavior used to change the popper's placement. It can be one of
  36249. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36250. * placements (with optional variations)
  36251. */
  36252. behavior: 'flip',
  36253. /**
  36254. * @prop {number} padding=5
  36255. * The popper will flip if it hits the edges of the `boundariesElement`
  36256. */
  36257. padding: 5,
  36258. /**
  36259. * @prop {String|HTMLElement} boundariesElement='viewport'
  36260. * The element which will define the boundaries of the popper position.
  36261. * The popper will never be placed outside of the defined boundaries
  36262. * (except if `keepTogether` is enabled)
  36263. */
  36264. boundariesElement: 'viewport',
  36265. /**
  36266. * @prop {Boolean} flipVariations=false
  36267. * The popper will switch placement variation between `-start` and `-end` when
  36268. * the reference element overlaps its boundaries.
  36269. *
  36270. * The original placement should have a set variation.
  36271. */
  36272. flipVariations: false,
  36273. /**
  36274. * @prop {Boolean} flipVariationsByContent=false
  36275. * The popper will switch placement variation between `-start` and `-end` when
  36276. * the popper element overlaps its reference boundaries.
  36277. *
  36278. * The original placement should have a set variation.
  36279. */
  36280. flipVariationsByContent: false
  36281. },
  36282. /**
  36283. * Modifier used to make the popper flow toward the inner of the reference element.
  36284. * By default, when this modifier is disabled, the popper will be placed outside
  36285. * the reference element.
  36286. * @memberof modifiers
  36287. * @inner
  36288. */
  36289. inner: {
  36290. /** @prop {number} order=700 - Index used to define the order of execution */
  36291. order: 700,
  36292. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36293. enabled: false,
  36294. /** @prop {ModifierFn} */
  36295. fn: inner
  36296. },
  36297. /**
  36298. * Modifier used to hide the popper when its reference element is outside of the
  36299. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36300. * be used to hide with a CSS selector the popper when its reference is
  36301. * out of boundaries.
  36302. *
  36303. * Requires the `preventOverflow` modifier before it in order to work.
  36304. * @memberof modifiers
  36305. * @inner
  36306. */
  36307. hide: {
  36308. /** @prop {number} order=800 - Index used to define the order of execution */
  36309. order: 800,
  36310. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36311. enabled: true,
  36312. /** @prop {ModifierFn} */
  36313. fn: hide
  36314. },
  36315. /**
  36316. * Computes the style that will be applied to the popper element to gets
  36317. * properly positioned.
  36318. *
  36319. * Note that this modifier will not touch the DOM, it just prepares the styles
  36320. * so that `applyStyle` modifier can apply it. This separation is useful
  36321. * in case you need to replace `applyStyle` with a custom implementation.
  36322. *
  36323. * This modifier has `850` as `order` value to maintain backward compatibility
  36324. * with previous versions of Popper.js. Expect the modifiers ordering method
  36325. * to change in future major versions of the library.
  36326. *
  36327. * @memberof modifiers
  36328. * @inner
  36329. */
  36330. computeStyle: {
  36331. /** @prop {number} order=850 - Index used to define the order of execution */
  36332. order: 850,
  36333. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36334. enabled: true,
  36335. /** @prop {ModifierFn} */
  36336. fn: computeStyle,
  36337. /**
  36338. * @prop {Boolean} gpuAcceleration=true
  36339. * If true, it uses the CSS 3D transformation to position the popper.
  36340. * Otherwise, it will use the `top` and `left` properties
  36341. */
  36342. gpuAcceleration: true,
  36343. /**
  36344. * @prop {string} [x='bottom']
  36345. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36346. * Change this if your popper should grow in a direction different from `bottom`
  36347. */
  36348. x: 'bottom',
  36349. /**
  36350. * @prop {string} [x='left']
  36351. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36352. * Change this if your popper should grow in a direction different from `right`
  36353. */
  36354. y: 'right'
  36355. },
  36356. /**
  36357. * Applies the computed styles to the popper element.
  36358. *
  36359. * All the DOM manipulations are limited to this modifier. This is useful in case
  36360. * you want to integrate Popper.js inside a framework or view library and you
  36361. * want to delegate all the DOM manipulations to it.
  36362. *
  36363. * Note that if you disable this modifier, you must make sure the popper element
  36364. * has its position set to `absolute` before Popper.js can do its work!
  36365. *
  36366. * Just disable this modifier and define your own to achieve the desired effect.
  36367. *
  36368. * @memberof modifiers
  36369. * @inner
  36370. */
  36371. applyStyle: {
  36372. /** @prop {number} order=900 - Index used to define the order of execution */
  36373. order: 900,
  36374. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36375. enabled: true,
  36376. /** @prop {ModifierFn} */
  36377. fn: applyStyle,
  36378. /** @prop {Function} */
  36379. onLoad: applyStyleOnLoad,
  36380. /**
  36381. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36382. * @prop {Boolean} gpuAcceleration=true
  36383. * If true, it uses the CSS 3D transformation to position the popper.
  36384. * Otherwise, it will use the `top` and `left` properties
  36385. */
  36386. gpuAcceleration: undefined
  36387. }
  36388. };
  36389. /**
  36390. * The `dataObject` is an object containing all the information used by Popper.js.
  36391. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36392. * @name dataObject
  36393. * @property {Object} data.instance The Popper.js instance
  36394. * @property {String} data.placement Placement applied to popper
  36395. * @property {String} data.originalPlacement Placement originally defined on init
  36396. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36397. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36398. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36399. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36400. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36401. * @property {Object} data.boundaries Offsets of the popper boundaries
  36402. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36403. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36404. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36405. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36406. */
  36407. /**
  36408. * Default options provided to Popper.js constructor.<br />
  36409. * These can be overridden using the `options` argument of Popper.js.<br />
  36410. * To override an option, simply pass an object with the same
  36411. * structure of the `options` object, as the 3rd argument. For example:
  36412. * ```
  36413. * new Popper(ref, pop, {
  36414. * modifiers: {
  36415. * preventOverflow: { enabled: false }
  36416. * }
  36417. * })
  36418. * ```
  36419. * @type {Object}
  36420. * @static
  36421. * @memberof Popper
  36422. */
  36423. var Defaults = {
  36424. /**
  36425. * Popper's placement.
  36426. * @prop {Popper.placements} placement='bottom'
  36427. */
  36428. placement: 'bottom',
  36429. /**
  36430. * Set this to true if you want popper to position it self in 'fixed' mode
  36431. * @prop {Boolean} positionFixed=false
  36432. */
  36433. positionFixed: false,
  36434. /**
  36435. * Whether events (resize, scroll) are initially enabled.
  36436. * @prop {Boolean} eventsEnabled=true
  36437. */
  36438. eventsEnabled: true,
  36439. /**
  36440. * Set to true if you want to automatically remove the popper when
  36441. * you call the `destroy` method.
  36442. * @prop {Boolean} removeOnDestroy=false
  36443. */
  36444. removeOnDestroy: false,
  36445. /**
  36446. * Callback called when the popper is created.<br />
  36447. * By default, it is set to no-op.<br />
  36448. * Access Popper.js instance with `data.instance`.
  36449. * @prop {onCreate}
  36450. */
  36451. onCreate: function onCreate() {},
  36452. /**
  36453. * Callback called when the popper is updated. This callback is not called
  36454. * on the initialization/creation of the popper, but only on subsequent
  36455. * updates.<br />
  36456. * By default, it is set to no-op.<br />
  36457. * Access Popper.js instance with `data.instance`.
  36458. * @prop {onUpdate}
  36459. */
  36460. onUpdate: function onUpdate() {},
  36461. /**
  36462. * List of modifiers used to modify the offsets before they are applied to the popper.
  36463. * They provide most of the functionalities of Popper.js.
  36464. * @prop {modifiers}
  36465. */
  36466. modifiers: modifiers
  36467. };
  36468. /**
  36469. * @callback onCreate
  36470. * @param {dataObject} data
  36471. */
  36472. /**
  36473. * @callback onUpdate
  36474. * @param {dataObject} data
  36475. */
  36476. // Utils
  36477. // Methods
  36478. var Popper = function () {
  36479. /**
  36480. * Creates a new Popper.js instance.
  36481. * @class Popper
  36482. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36483. * @param {Element} popper - The HTML / XML element used as the popper
  36484. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36485. * @return {Object} instance - The generated Popper.js instance
  36486. */
  36487. function Popper(reference, popper) {
  36488. var _this = this;
  36489. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36490. classCallCheck(this, Popper);
  36491. this.scheduleUpdate = function () {
  36492. return requestAnimationFrame(_this.update);
  36493. };
  36494. // make update() debounced, so that it only runs at most once-per-tick
  36495. this.update = debounce(this.update.bind(this));
  36496. // with {} we create a new object with the options inside it
  36497. this.options = _extends({}, Popper.Defaults, options);
  36498. // init state
  36499. this.state = {
  36500. isDestroyed: false,
  36501. isCreated: false,
  36502. scrollParents: []
  36503. };
  36504. // get reference and popper elements (allow jQuery wrappers)
  36505. this.reference = reference && reference.jquery ? reference[0] : reference;
  36506. this.popper = popper && popper.jquery ? popper[0] : popper;
  36507. // Deep merge modifiers options
  36508. this.options.modifiers = {};
  36509. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36510. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36511. });
  36512. // Refactoring modifiers' list (Object => Array)
  36513. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36514. return _extends({
  36515. name: name
  36516. }, _this.options.modifiers[name]);
  36517. })
  36518. // sort the modifiers by order
  36519. .sort(function (a, b) {
  36520. return a.order - b.order;
  36521. });
  36522. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36523. // such code is executed in the same order of its modifier
  36524. // they could add new properties to their options configuration
  36525. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36526. this.modifiers.forEach(function (modifierOptions) {
  36527. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36528. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36529. }
  36530. });
  36531. // fire the first update to position the popper in the right place
  36532. this.update();
  36533. var eventsEnabled = this.options.eventsEnabled;
  36534. if (eventsEnabled) {
  36535. // setup event listeners, they will take care of update the position in specific situations
  36536. this.enableEventListeners();
  36537. }
  36538. this.state.eventsEnabled = eventsEnabled;
  36539. }
  36540. // We can't use class properties because they don't get listed in the
  36541. // class prototype and break stuff like Sinon stubs
  36542. createClass(Popper, [{
  36543. key: 'update',
  36544. value: function update$$1() {
  36545. return update.call(this);
  36546. }
  36547. }, {
  36548. key: 'destroy',
  36549. value: function destroy$$1() {
  36550. return destroy.call(this);
  36551. }
  36552. }, {
  36553. key: 'enableEventListeners',
  36554. value: function enableEventListeners$$1() {
  36555. return enableEventListeners.call(this);
  36556. }
  36557. }, {
  36558. key: 'disableEventListeners',
  36559. value: function disableEventListeners$$1() {
  36560. return disableEventListeners.call(this);
  36561. }
  36562. /**
  36563. * Schedules an update. It will run on the next UI update available.
  36564. * @method scheduleUpdate
  36565. * @memberof Popper
  36566. */
  36567. /**
  36568. * Collection of utilities useful when writing custom modifiers.
  36569. * Starting from version 1.7, this method is available only if you
  36570. * include `popper-utils.js` before `popper.js`.
  36571. *
  36572. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36573. * and will be removed in v2! Use the PopperUtils module directly instead.
  36574. * Due to the high instability of the methods contained in Utils, we can't
  36575. * guarantee them to follow semver. Use them at your own risk!
  36576. * @static
  36577. * @private
  36578. * @type {Object}
  36579. * @deprecated since version 1.8
  36580. * @member Utils
  36581. * @memberof Popper
  36582. */
  36583. }]);
  36584. return Popper;
  36585. }();
  36586. /**
  36587. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36588. * and lets you use it as replacement of a real DOM node.<br />
  36589. * You can use this method to position a popper relatively to a set of coordinates
  36590. * in case you don't have a DOM node to use as reference.
  36591. *
  36592. * ```
  36593. * new Popper(referenceObject, popperNode);
  36594. * ```
  36595. *
  36596. * NB: This feature isn't supported in Internet Explorer 10.
  36597. * @name referenceObject
  36598. * @property {Function} data.getBoundingClientRect
  36599. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36600. * @property {number} data.clientWidth
  36601. * An ES6 getter that will return the width of the virtual reference element.
  36602. * @property {number} data.clientHeight
  36603. * An ES6 getter that will return the height of the virtual reference element.
  36604. */
  36605. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36606. Popper.placements = placements;
  36607. Popper.Defaults = Defaults;
  36608. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36609. //# sourceMappingURL=popper.js.map
  36610. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36611. /***/ }),
  36612. /***/ "./node_modules/process/browser.js":
  36613. /*!*****************************************!*\
  36614. !*** ./node_modules/process/browser.js ***!
  36615. \*****************************************/
  36616. /*! no static exports found */
  36617. /***/ (function(module, exports) {
  36618. // shim for using process in browser
  36619. var process = module.exports = {};
  36620. // cached from whatever global is present so that test runners that stub it
  36621. // don't break things. But we need to wrap it in a try catch in case it is
  36622. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36623. // function because try/catches deoptimize in certain engines.
  36624. var cachedSetTimeout;
  36625. var cachedClearTimeout;
  36626. function defaultSetTimout() {
  36627. throw new Error('setTimeout has not been defined');
  36628. }
  36629. function defaultClearTimeout () {
  36630. throw new Error('clearTimeout has not been defined');
  36631. }
  36632. (function () {
  36633. try {
  36634. if (typeof setTimeout === 'function') {
  36635. cachedSetTimeout = setTimeout;
  36636. } else {
  36637. cachedSetTimeout = defaultSetTimout;
  36638. }
  36639. } catch (e) {
  36640. cachedSetTimeout = defaultSetTimout;
  36641. }
  36642. try {
  36643. if (typeof clearTimeout === 'function') {
  36644. cachedClearTimeout = clearTimeout;
  36645. } else {
  36646. cachedClearTimeout = defaultClearTimeout;
  36647. }
  36648. } catch (e) {
  36649. cachedClearTimeout = defaultClearTimeout;
  36650. }
  36651. } ())
  36652. function runTimeout(fun) {
  36653. if (cachedSetTimeout === setTimeout) {
  36654. //normal enviroments in sane situations
  36655. return setTimeout(fun, 0);
  36656. }
  36657. // if setTimeout wasn't available but was latter defined
  36658. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36659. cachedSetTimeout = setTimeout;
  36660. return setTimeout(fun, 0);
  36661. }
  36662. try {
  36663. // when when somebody has screwed with setTimeout but no I.E. maddness
  36664. return cachedSetTimeout(fun, 0);
  36665. } catch(e){
  36666. try {
  36667. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36668. return cachedSetTimeout.call(null, fun, 0);
  36669. } catch(e){
  36670. // 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
  36671. return cachedSetTimeout.call(this, fun, 0);
  36672. }
  36673. }
  36674. }
  36675. function runClearTimeout(marker) {
  36676. if (cachedClearTimeout === clearTimeout) {
  36677. //normal enviroments in sane situations
  36678. return clearTimeout(marker);
  36679. }
  36680. // if clearTimeout wasn't available but was latter defined
  36681. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36682. cachedClearTimeout = clearTimeout;
  36683. return clearTimeout(marker);
  36684. }
  36685. try {
  36686. // when when somebody has screwed with setTimeout but no I.E. maddness
  36687. return cachedClearTimeout(marker);
  36688. } catch (e){
  36689. try {
  36690. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36691. return cachedClearTimeout.call(null, marker);
  36692. } catch (e){
  36693. // 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.
  36694. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36695. return cachedClearTimeout.call(this, marker);
  36696. }
  36697. }
  36698. }
  36699. var queue = [];
  36700. var draining = false;
  36701. var currentQueue;
  36702. var queueIndex = -1;
  36703. function cleanUpNextTick() {
  36704. if (!draining || !currentQueue) {
  36705. return;
  36706. }
  36707. draining = false;
  36708. if (currentQueue.length) {
  36709. queue = currentQueue.concat(queue);
  36710. } else {
  36711. queueIndex = -1;
  36712. }
  36713. if (queue.length) {
  36714. drainQueue();
  36715. }
  36716. }
  36717. function drainQueue() {
  36718. if (draining) {
  36719. return;
  36720. }
  36721. var timeout = runTimeout(cleanUpNextTick);
  36722. draining = true;
  36723. var len = queue.length;
  36724. while(len) {
  36725. currentQueue = queue;
  36726. queue = [];
  36727. while (++queueIndex < len) {
  36728. if (currentQueue) {
  36729. currentQueue[queueIndex].run();
  36730. }
  36731. }
  36732. queueIndex = -1;
  36733. len = queue.length;
  36734. }
  36735. currentQueue = null;
  36736. draining = false;
  36737. runClearTimeout(timeout);
  36738. }
  36739. process.nextTick = function (fun) {
  36740. var args = new Array(arguments.length - 1);
  36741. if (arguments.length > 1) {
  36742. for (var i = 1; i < arguments.length; i++) {
  36743. args[i - 1] = arguments[i];
  36744. }
  36745. }
  36746. queue.push(new Item(fun, args));
  36747. if (queue.length === 1 && !draining) {
  36748. runTimeout(drainQueue);
  36749. }
  36750. };
  36751. // v8 likes predictible objects
  36752. function Item(fun, array) {
  36753. this.fun = fun;
  36754. this.array = array;
  36755. }
  36756. Item.prototype.run = function () {
  36757. this.fun.apply(null, this.array);
  36758. };
  36759. process.title = 'browser';
  36760. process.browser = true;
  36761. process.env = {};
  36762. process.argv = [];
  36763. process.version = ''; // empty string to avoid regexp issues
  36764. process.versions = {};
  36765. function noop() {}
  36766. process.on = noop;
  36767. process.addListener = noop;
  36768. process.once = noop;
  36769. process.off = noop;
  36770. process.removeListener = noop;
  36771. process.removeAllListeners = noop;
  36772. process.emit = noop;
  36773. process.prependListener = noop;
  36774. process.prependOnceListener = noop;
  36775. process.listeners = function (name) { return [] }
  36776. process.binding = function (name) {
  36777. throw new Error('process.binding is not supported');
  36778. };
  36779. process.cwd = function () { return '/' };
  36780. process.chdir = function (dir) {
  36781. throw new Error('process.chdir is not supported');
  36782. };
  36783. process.umask = function() { return 0; };
  36784. /***/ }),
  36785. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36786. /*!***************************************************!*\
  36787. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36788. \***************************************************/
  36789. /*! no static exports found */
  36790. /***/ (function(module, exports, __webpack_require__) {
  36791. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36792. * Pusher JavaScript Library v5.0.3
  36793. * https://pusher.com/
  36794. *
  36795. * Copyright 2017, Pusher
  36796. * Released under the MIT licence.
  36797. */
  36798. (function webpackUniversalModuleDefinition(root, factory) {
  36799. if(true)
  36800. module.exports = factory();
  36801. else {}
  36802. })(window, function() {
  36803. return /******/ (function(modules) { // webpackBootstrap
  36804. /******/ // The module cache
  36805. /******/ var installedModules = {};
  36806. /******/
  36807. /******/ // The require function
  36808. /******/ function __webpack_require__(moduleId) {
  36809. /******/
  36810. /******/ // Check if module is in cache
  36811. /******/ if(installedModules[moduleId]) {
  36812. /******/ return installedModules[moduleId].exports;
  36813. /******/ }
  36814. /******/ // Create a new module (and put it into the cache)
  36815. /******/ var module = installedModules[moduleId] = {
  36816. /******/ i: moduleId,
  36817. /******/ l: false,
  36818. /******/ exports: {}
  36819. /******/ };
  36820. /******/
  36821. /******/ // Execute the module function
  36822. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36823. /******/
  36824. /******/ // Flag the module as loaded
  36825. /******/ module.l = true;
  36826. /******/
  36827. /******/ // Return the exports of the module
  36828. /******/ return module.exports;
  36829. /******/ }
  36830. /******/
  36831. /******/
  36832. /******/ // expose the modules object (__webpack_modules__)
  36833. /******/ __webpack_require__.m = modules;
  36834. /******/
  36835. /******/ // expose the module cache
  36836. /******/ __webpack_require__.c = installedModules;
  36837. /******/
  36838. /******/ // define getter function for harmony exports
  36839. /******/ __webpack_require__.d = function(exports, name, getter) {
  36840. /******/ if(!__webpack_require__.o(exports, name)) {
  36841. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36842. /******/ }
  36843. /******/ };
  36844. /******/
  36845. /******/ // define __esModule on exports
  36846. /******/ __webpack_require__.r = function(exports) {
  36847. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36848. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36849. /******/ }
  36850. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36851. /******/ };
  36852. /******/
  36853. /******/ // create a fake namespace object
  36854. /******/ // mode & 1: value is a module id, require it
  36855. /******/ // mode & 2: merge all properties of value into the ns
  36856. /******/ // mode & 4: return value when already ns object
  36857. /******/ // mode & 8|1: behave like require
  36858. /******/ __webpack_require__.t = function(value, mode) {
  36859. /******/ if(mode & 1) value = __webpack_require__(value);
  36860. /******/ if(mode & 8) return value;
  36861. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36862. /******/ var ns = Object.create(null);
  36863. /******/ __webpack_require__.r(ns);
  36864. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36865. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36866. /******/ return ns;
  36867. /******/ };
  36868. /******/
  36869. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36870. /******/ __webpack_require__.n = function(module) {
  36871. /******/ var getter = module && module.__esModule ?
  36872. /******/ function getDefault() { return module['default']; } :
  36873. /******/ function getModuleExports() { return module; };
  36874. /******/ __webpack_require__.d(getter, 'a', getter);
  36875. /******/ return getter;
  36876. /******/ };
  36877. /******/
  36878. /******/ // Object.prototype.hasOwnProperty.call
  36879. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36880. /******/
  36881. /******/ // __webpack_public_path__
  36882. /******/ __webpack_require__.p = "";
  36883. /******/
  36884. /******/
  36885. /******/ // Load entry module and return exports
  36886. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36887. /******/ })
  36888. /************************************************************************/
  36889. /******/ ([
  36890. /* 0 */
  36891. /***/ (function(module, exports, __webpack_require__) {
  36892. (function(nacl) {
  36893. 'use strict';
  36894. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36895. // Public domain.
  36896. //
  36897. // Implementation derived from TweetNaCl version 20140427.
  36898. // See for details: http://tweetnacl.cr.yp.to/
  36899. var gf = function(init) {
  36900. var i, r = new Float64Array(16);
  36901. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36902. return r;
  36903. };
  36904. // Pluggable, initialized in high-level API below.
  36905. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36906. var _0 = new Uint8Array(16);
  36907. var _9 = new Uint8Array(32); _9[0] = 9;
  36908. var gf0 = gf(),
  36909. gf1 = gf([1]),
  36910. _121665 = gf([0xdb41, 1]),
  36911. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36912. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36913. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36914. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36915. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36916. function ts64(x, i, h, l) {
  36917. x[i] = (h >> 24) & 0xff;
  36918. x[i+1] = (h >> 16) & 0xff;
  36919. x[i+2] = (h >> 8) & 0xff;
  36920. x[i+3] = h & 0xff;
  36921. x[i+4] = (l >> 24) & 0xff;
  36922. x[i+5] = (l >> 16) & 0xff;
  36923. x[i+6] = (l >> 8) & 0xff;
  36924. x[i+7] = l & 0xff;
  36925. }
  36926. function vn(x, xi, y, yi, n) {
  36927. var i,d = 0;
  36928. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36929. return (1 & ((d - 1) >>> 8)) - 1;
  36930. }
  36931. function crypto_verify_16(x, xi, y, yi) {
  36932. return vn(x,xi,y,yi,16);
  36933. }
  36934. function crypto_verify_32(x, xi, y, yi) {
  36935. return vn(x,xi,y,yi,32);
  36936. }
  36937. function core_salsa20(o, p, k, c) {
  36938. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36939. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36940. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36941. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36942. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36943. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36944. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36945. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36946. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36947. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36948. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36949. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36950. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36951. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36952. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36953. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36954. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36955. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36956. x15 = j15, u;
  36957. for (var i = 0; i < 20; i += 2) {
  36958. u = x0 + x12 | 0;
  36959. x4 ^= u<<7 | u>>>(32-7);
  36960. u = x4 + x0 | 0;
  36961. x8 ^= u<<9 | u>>>(32-9);
  36962. u = x8 + x4 | 0;
  36963. x12 ^= u<<13 | u>>>(32-13);
  36964. u = x12 + x8 | 0;
  36965. x0 ^= u<<18 | u>>>(32-18);
  36966. u = x5 + x1 | 0;
  36967. x9 ^= u<<7 | u>>>(32-7);
  36968. u = x9 + x5 | 0;
  36969. x13 ^= u<<9 | u>>>(32-9);
  36970. u = x13 + x9 | 0;
  36971. x1 ^= u<<13 | u>>>(32-13);
  36972. u = x1 + x13 | 0;
  36973. x5 ^= u<<18 | u>>>(32-18);
  36974. u = x10 + x6 | 0;
  36975. x14 ^= u<<7 | u>>>(32-7);
  36976. u = x14 + x10 | 0;
  36977. x2 ^= u<<9 | u>>>(32-9);
  36978. u = x2 + x14 | 0;
  36979. x6 ^= u<<13 | u>>>(32-13);
  36980. u = x6 + x2 | 0;
  36981. x10 ^= u<<18 | u>>>(32-18);
  36982. u = x15 + x11 | 0;
  36983. x3 ^= u<<7 | u>>>(32-7);
  36984. u = x3 + x15 | 0;
  36985. x7 ^= u<<9 | u>>>(32-9);
  36986. u = x7 + x3 | 0;
  36987. x11 ^= u<<13 | u>>>(32-13);
  36988. u = x11 + x7 | 0;
  36989. x15 ^= u<<18 | u>>>(32-18);
  36990. u = x0 + x3 | 0;
  36991. x1 ^= u<<7 | u>>>(32-7);
  36992. u = x1 + x0 | 0;
  36993. x2 ^= u<<9 | u>>>(32-9);
  36994. u = x2 + x1 | 0;
  36995. x3 ^= u<<13 | u>>>(32-13);
  36996. u = x3 + x2 | 0;
  36997. x0 ^= u<<18 | u>>>(32-18);
  36998. u = x5 + x4 | 0;
  36999. x6 ^= u<<7 | u>>>(32-7);
  37000. u = x6 + x5 | 0;
  37001. x7 ^= u<<9 | u>>>(32-9);
  37002. u = x7 + x6 | 0;
  37003. x4 ^= u<<13 | u>>>(32-13);
  37004. u = x4 + x7 | 0;
  37005. x5 ^= u<<18 | u>>>(32-18);
  37006. u = x10 + x9 | 0;
  37007. x11 ^= u<<7 | u>>>(32-7);
  37008. u = x11 + x10 | 0;
  37009. x8 ^= u<<9 | u>>>(32-9);
  37010. u = x8 + x11 | 0;
  37011. x9 ^= u<<13 | u>>>(32-13);
  37012. u = x9 + x8 | 0;
  37013. x10 ^= u<<18 | u>>>(32-18);
  37014. u = x15 + x14 | 0;
  37015. x12 ^= u<<7 | u>>>(32-7);
  37016. u = x12 + x15 | 0;
  37017. x13 ^= u<<9 | u>>>(32-9);
  37018. u = x13 + x12 | 0;
  37019. x14 ^= u<<13 | u>>>(32-13);
  37020. u = x14 + x13 | 0;
  37021. x15 ^= u<<18 | u>>>(32-18);
  37022. }
  37023. x0 = x0 + j0 | 0;
  37024. x1 = x1 + j1 | 0;
  37025. x2 = x2 + j2 | 0;
  37026. x3 = x3 + j3 | 0;
  37027. x4 = x4 + j4 | 0;
  37028. x5 = x5 + j5 | 0;
  37029. x6 = x6 + j6 | 0;
  37030. x7 = x7 + j7 | 0;
  37031. x8 = x8 + j8 | 0;
  37032. x9 = x9 + j9 | 0;
  37033. x10 = x10 + j10 | 0;
  37034. x11 = x11 + j11 | 0;
  37035. x12 = x12 + j12 | 0;
  37036. x13 = x13 + j13 | 0;
  37037. x14 = x14 + j14 | 0;
  37038. x15 = x15 + j15 | 0;
  37039. o[ 0] = x0 >>> 0 & 0xff;
  37040. o[ 1] = x0 >>> 8 & 0xff;
  37041. o[ 2] = x0 >>> 16 & 0xff;
  37042. o[ 3] = x0 >>> 24 & 0xff;
  37043. o[ 4] = x1 >>> 0 & 0xff;
  37044. o[ 5] = x1 >>> 8 & 0xff;
  37045. o[ 6] = x1 >>> 16 & 0xff;
  37046. o[ 7] = x1 >>> 24 & 0xff;
  37047. o[ 8] = x2 >>> 0 & 0xff;
  37048. o[ 9] = x2 >>> 8 & 0xff;
  37049. o[10] = x2 >>> 16 & 0xff;
  37050. o[11] = x2 >>> 24 & 0xff;
  37051. o[12] = x3 >>> 0 & 0xff;
  37052. o[13] = x3 >>> 8 & 0xff;
  37053. o[14] = x3 >>> 16 & 0xff;
  37054. o[15] = x3 >>> 24 & 0xff;
  37055. o[16] = x4 >>> 0 & 0xff;
  37056. o[17] = x4 >>> 8 & 0xff;
  37057. o[18] = x4 >>> 16 & 0xff;
  37058. o[19] = x4 >>> 24 & 0xff;
  37059. o[20] = x5 >>> 0 & 0xff;
  37060. o[21] = x5 >>> 8 & 0xff;
  37061. o[22] = x5 >>> 16 & 0xff;
  37062. o[23] = x5 >>> 24 & 0xff;
  37063. o[24] = x6 >>> 0 & 0xff;
  37064. o[25] = x6 >>> 8 & 0xff;
  37065. o[26] = x6 >>> 16 & 0xff;
  37066. o[27] = x6 >>> 24 & 0xff;
  37067. o[28] = x7 >>> 0 & 0xff;
  37068. o[29] = x7 >>> 8 & 0xff;
  37069. o[30] = x7 >>> 16 & 0xff;
  37070. o[31] = x7 >>> 24 & 0xff;
  37071. o[32] = x8 >>> 0 & 0xff;
  37072. o[33] = x8 >>> 8 & 0xff;
  37073. o[34] = x8 >>> 16 & 0xff;
  37074. o[35] = x8 >>> 24 & 0xff;
  37075. o[36] = x9 >>> 0 & 0xff;
  37076. o[37] = x9 >>> 8 & 0xff;
  37077. o[38] = x9 >>> 16 & 0xff;
  37078. o[39] = x9 >>> 24 & 0xff;
  37079. o[40] = x10 >>> 0 & 0xff;
  37080. o[41] = x10 >>> 8 & 0xff;
  37081. o[42] = x10 >>> 16 & 0xff;
  37082. o[43] = x10 >>> 24 & 0xff;
  37083. o[44] = x11 >>> 0 & 0xff;
  37084. o[45] = x11 >>> 8 & 0xff;
  37085. o[46] = x11 >>> 16 & 0xff;
  37086. o[47] = x11 >>> 24 & 0xff;
  37087. o[48] = x12 >>> 0 & 0xff;
  37088. o[49] = x12 >>> 8 & 0xff;
  37089. o[50] = x12 >>> 16 & 0xff;
  37090. o[51] = x12 >>> 24 & 0xff;
  37091. o[52] = x13 >>> 0 & 0xff;
  37092. o[53] = x13 >>> 8 & 0xff;
  37093. o[54] = x13 >>> 16 & 0xff;
  37094. o[55] = x13 >>> 24 & 0xff;
  37095. o[56] = x14 >>> 0 & 0xff;
  37096. o[57] = x14 >>> 8 & 0xff;
  37097. o[58] = x14 >>> 16 & 0xff;
  37098. o[59] = x14 >>> 24 & 0xff;
  37099. o[60] = x15 >>> 0 & 0xff;
  37100. o[61] = x15 >>> 8 & 0xff;
  37101. o[62] = x15 >>> 16 & 0xff;
  37102. o[63] = x15 >>> 24 & 0xff;
  37103. }
  37104. function core_hsalsa20(o,p,k,c) {
  37105. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37106. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37107. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37108. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37109. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37110. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37111. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37112. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37113. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37114. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37115. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37116. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37117. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37118. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37119. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37120. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37121. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37122. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37123. x15 = j15, u;
  37124. for (var i = 0; i < 20; i += 2) {
  37125. u = x0 + x12 | 0;
  37126. x4 ^= u<<7 | u>>>(32-7);
  37127. u = x4 + x0 | 0;
  37128. x8 ^= u<<9 | u>>>(32-9);
  37129. u = x8 + x4 | 0;
  37130. x12 ^= u<<13 | u>>>(32-13);
  37131. u = x12 + x8 | 0;
  37132. x0 ^= u<<18 | u>>>(32-18);
  37133. u = x5 + x1 | 0;
  37134. x9 ^= u<<7 | u>>>(32-7);
  37135. u = x9 + x5 | 0;
  37136. x13 ^= u<<9 | u>>>(32-9);
  37137. u = x13 + x9 | 0;
  37138. x1 ^= u<<13 | u>>>(32-13);
  37139. u = x1 + x13 | 0;
  37140. x5 ^= u<<18 | u>>>(32-18);
  37141. u = x10 + x6 | 0;
  37142. x14 ^= u<<7 | u>>>(32-7);
  37143. u = x14 + x10 | 0;
  37144. x2 ^= u<<9 | u>>>(32-9);
  37145. u = x2 + x14 | 0;
  37146. x6 ^= u<<13 | u>>>(32-13);
  37147. u = x6 + x2 | 0;
  37148. x10 ^= u<<18 | u>>>(32-18);
  37149. u = x15 + x11 | 0;
  37150. x3 ^= u<<7 | u>>>(32-7);
  37151. u = x3 + x15 | 0;
  37152. x7 ^= u<<9 | u>>>(32-9);
  37153. u = x7 + x3 | 0;
  37154. x11 ^= u<<13 | u>>>(32-13);
  37155. u = x11 + x7 | 0;
  37156. x15 ^= u<<18 | u>>>(32-18);
  37157. u = x0 + x3 | 0;
  37158. x1 ^= u<<7 | u>>>(32-7);
  37159. u = x1 + x0 | 0;
  37160. x2 ^= u<<9 | u>>>(32-9);
  37161. u = x2 + x1 | 0;
  37162. x3 ^= u<<13 | u>>>(32-13);
  37163. u = x3 + x2 | 0;
  37164. x0 ^= u<<18 | u>>>(32-18);
  37165. u = x5 + x4 | 0;
  37166. x6 ^= u<<7 | u>>>(32-7);
  37167. u = x6 + x5 | 0;
  37168. x7 ^= u<<9 | u>>>(32-9);
  37169. u = x7 + x6 | 0;
  37170. x4 ^= u<<13 | u>>>(32-13);
  37171. u = x4 + x7 | 0;
  37172. x5 ^= u<<18 | u>>>(32-18);
  37173. u = x10 + x9 | 0;
  37174. x11 ^= u<<7 | u>>>(32-7);
  37175. u = x11 + x10 | 0;
  37176. x8 ^= u<<9 | u>>>(32-9);
  37177. u = x8 + x11 | 0;
  37178. x9 ^= u<<13 | u>>>(32-13);
  37179. u = x9 + x8 | 0;
  37180. x10 ^= u<<18 | u>>>(32-18);
  37181. u = x15 + x14 | 0;
  37182. x12 ^= u<<7 | u>>>(32-7);
  37183. u = x12 + x15 | 0;
  37184. x13 ^= u<<9 | u>>>(32-9);
  37185. u = x13 + x12 | 0;
  37186. x14 ^= u<<13 | u>>>(32-13);
  37187. u = x14 + x13 | 0;
  37188. x15 ^= u<<18 | u>>>(32-18);
  37189. }
  37190. o[ 0] = x0 >>> 0 & 0xff;
  37191. o[ 1] = x0 >>> 8 & 0xff;
  37192. o[ 2] = x0 >>> 16 & 0xff;
  37193. o[ 3] = x0 >>> 24 & 0xff;
  37194. o[ 4] = x5 >>> 0 & 0xff;
  37195. o[ 5] = x5 >>> 8 & 0xff;
  37196. o[ 6] = x5 >>> 16 & 0xff;
  37197. o[ 7] = x5 >>> 24 & 0xff;
  37198. o[ 8] = x10 >>> 0 & 0xff;
  37199. o[ 9] = x10 >>> 8 & 0xff;
  37200. o[10] = x10 >>> 16 & 0xff;
  37201. o[11] = x10 >>> 24 & 0xff;
  37202. o[12] = x15 >>> 0 & 0xff;
  37203. o[13] = x15 >>> 8 & 0xff;
  37204. o[14] = x15 >>> 16 & 0xff;
  37205. o[15] = x15 >>> 24 & 0xff;
  37206. o[16] = x6 >>> 0 & 0xff;
  37207. o[17] = x6 >>> 8 & 0xff;
  37208. o[18] = x6 >>> 16 & 0xff;
  37209. o[19] = x6 >>> 24 & 0xff;
  37210. o[20] = x7 >>> 0 & 0xff;
  37211. o[21] = x7 >>> 8 & 0xff;
  37212. o[22] = x7 >>> 16 & 0xff;
  37213. o[23] = x7 >>> 24 & 0xff;
  37214. o[24] = x8 >>> 0 & 0xff;
  37215. o[25] = x8 >>> 8 & 0xff;
  37216. o[26] = x8 >>> 16 & 0xff;
  37217. o[27] = x8 >>> 24 & 0xff;
  37218. o[28] = x9 >>> 0 & 0xff;
  37219. o[29] = x9 >>> 8 & 0xff;
  37220. o[30] = x9 >>> 16 & 0xff;
  37221. o[31] = x9 >>> 24 & 0xff;
  37222. }
  37223. function crypto_core_salsa20(out,inp,k,c) {
  37224. core_salsa20(out,inp,k,c);
  37225. }
  37226. function crypto_core_hsalsa20(out,inp,k,c) {
  37227. core_hsalsa20(out,inp,k,c);
  37228. }
  37229. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37230. // "expand 32-byte k"
  37231. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37232. var z = new Uint8Array(16), x = new Uint8Array(64);
  37233. var u, i;
  37234. for (i = 0; i < 16; i++) z[i] = 0;
  37235. for (i = 0; i < 8; i++) z[i] = n[i];
  37236. while (b >= 64) {
  37237. crypto_core_salsa20(x,z,k,sigma);
  37238. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37239. u = 1;
  37240. for (i = 8; i < 16; i++) {
  37241. u = u + (z[i] & 0xff) | 0;
  37242. z[i] = u & 0xff;
  37243. u >>>= 8;
  37244. }
  37245. b -= 64;
  37246. cpos += 64;
  37247. mpos += 64;
  37248. }
  37249. if (b > 0) {
  37250. crypto_core_salsa20(x,z,k,sigma);
  37251. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37252. }
  37253. return 0;
  37254. }
  37255. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37256. var z = new Uint8Array(16), x = new Uint8Array(64);
  37257. var u, i;
  37258. for (i = 0; i < 16; i++) z[i] = 0;
  37259. for (i = 0; i < 8; i++) z[i] = n[i];
  37260. while (b >= 64) {
  37261. crypto_core_salsa20(x,z,k,sigma);
  37262. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37263. u = 1;
  37264. for (i = 8; i < 16; i++) {
  37265. u = u + (z[i] & 0xff) | 0;
  37266. z[i] = u & 0xff;
  37267. u >>>= 8;
  37268. }
  37269. b -= 64;
  37270. cpos += 64;
  37271. }
  37272. if (b > 0) {
  37273. crypto_core_salsa20(x,z,k,sigma);
  37274. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37275. }
  37276. return 0;
  37277. }
  37278. function crypto_stream(c,cpos,d,n,k) {
  37279. var s = new Uint8Array(32);
  37280. crypto_core_hsalsa20(s,n,k,sigma);
  37281. var sn = new Uint8Array(8);
  37282. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37283. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37284. }
  37285. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37286. var s = new Uint8Array(32);
  37287. crypto_core_hsalsa20(s,n,k,sigma);
  37288. var sn = new Uint8Array(8);
  37289. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37290. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37291. }
  37292. /*
  37293. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37294. * https://github.com/floodyberry/poly1305-donna
  37295. */
  37296. var poly1305 = function(key) {
  37297. this.buffer = new Uint8Array(16);
  37298. this.r = new Uint16Array(10);
  37299. this.h = new Uint16Array(10);
  37300. this.pad = new Uint16Array(8);
  37301. this.leftover = 0;
  37302. this.fin = 0;
  37303. var t0, t1, t2, t3, t4, t5, t6, t7;
  37304. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37305. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37306. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37307. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37308. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37309. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37310. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37311. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37312. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37313. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37314. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37315. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37316. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37317. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37318. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37319. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37320. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37321. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37322. };
  37323. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37324. var hibit = this.fin ? 0 : (1 << 11);
  37325. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37326. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37327. var h0 = this.h[0],
  37328. h1 = this.h[1],
  37329. h2 = this.h[2],
  37330. h3 = this.h[3],
  37331. h4 = this.h[4],
  37332. h5 = this.h[5],
  37333. h6 = this.h[6],
  37334. h7 = this.h[7],
  37335. h8 = this.h[8],
  37336. h9 = this.h[9];
  37337. var r0 = this.r[0],
  37338. r1 = this.r[1],
  37339. r2 = this.r[2],
  37340. r3 = this.r[3],
  37341. r4 = this.r[4],
  37342. r5 = this.r[5],
  37343. r6 = this.r[6],
  37344. r7 = this.r[7],
  37345. r8 = this.r[8],
  37346. r9 = this.r[9];
  37347. while (bytes >= 16) {
  37348. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37349. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37350. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37351. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37352. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37353. h5 += ((t4 >>> 1)) & 0x1fff;
  37354. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37355. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37356. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37357. h9 += ((t7 >>> 5)) | hibit;
  37358. c = 0;
  37359. d0 = c;
  37360. d0 += h0 * r0;
  37361. d0 += h1 * (5 * r9);
  37362. d0 += h2 * (5 * r8);
  37363. d0 += h3 * (5 * r7);
  37364. d0 += h4 * (5 * r6);
  37365. c = (d0 >>> 13); d0 &= 0x1fff;
  37366. d0 += h5 * (5 * r5);
  37367. d0 += h6 * (5 * r4);
  37368. d0 += h7 * (5 * r3);
  37369. d0 += h8 * (5 * r2);
  37370. d0 += h9 * (5 * r1);
  37371. c += (d0 >>> 13); d0 &= 0x1fff;
  37372. d1 = c;
  37373. d1 += h0 * r1;
  37374. d1 += h1 * r0;
  37375. d1 += h2 * (5 * r9);
  37376. d1 += h3 * (5 * r8);
  37377. d1 += h4 * (5 * r7);
  37378. c = (d1 >>> 13); d1 &= 0x1fff;
  37379. d1 += h5 * (5 * r6);
  37380. d1 += h6 * (5 * r5);
  37381. d1 += h7 * (5 * r4);
  37382. d1 += h8 * (5 * r3);
  37383. d1 += h9 * (5 * r2);
  37384. c += (d1 >>> 13); d1 &= 0x1fff;
  37385. d2 = c;
  37386. d2 += h0 * r2;
  37387. d2 += h1 * r1;
  37388. d2 += h2 * r0;
  37389. d2 += h3 * (5 * r9);
  37390. d2 += h4 * (5 * r8);
  37391. c = (d2 >>> 13); d2 &= 0x1fff;
  37392. d2 += h5 * (5 * r7);
  37393. d2 += h6 * (5 * r6);
  37394. d2 += h7 * (5 * r5);
  37395. d2 += h8 * (5 * r4);
  37396. d2 += h9 * (5 * r3);
  37397. c += (d2 >>> 13); d2 &= 0x1fff;
  37398. d3 = c;
  37399. d3 += h0 * r3;
  37400. d3 += h1 * r2;
  37401. d3 += h2 * r1;
  37402. d3 += h3 * r0;
  37403. d3 += h4 * (5 * r9);
  37404. c = (d3 >>> 13); d3 &= 0x1fff;
  37405. d3 += h5 * (5 * r8);
  37406. d3 += h6 * (5 * r7);
  37407. d3 += h7 * (5 * r6);
  37408. d3 += h8 * (5 * r5);
  37409. d3 += h9 * (5 * r4);
  37410. c += (d3 >>> 13); d3 &= 0x1fff;
  37411. d4 = c;
  37412. d4 += h0 * r4;
  37413. d4 += h1 * r3;
  37414. d4 += h2 * r2;
  37415. d4 += h3 * r1;
  37416. d4 += h4 * r0;
  37417. c = (d4 >>> 13); d4 &= 0x1fff;
  37418. d4 += h5 * (5 * r9);
  37419. d4 += h6 * (5 * r8);
  37420. d4 += h7 * (5 * r7);
  37421. d4 += h8 * (5 * r6);
  37422. d4 += h9 * (5 * r5);
  37423. c += (d4 >>> 13); d4 &= 0x1fff;
  37424. d5 = c;
  37425. d5 += h0 * r5;
  37426. d5 += h1 * r4;
  37427. d5 += h2 * r3;
  37428. d5 += h3 * r2;
  37429. d5 += h4 * r1;
  37430. c = (d5 >>> 13); d5 &= 0x1fff;
  37431. d5 += h5 * r0;
  37432. d5 += h6 * (5 * r9);
  37433. d5 += h7 * (5 * r8);
  37434. d5 += h8 * (5 * r7);
  37435. d5 += h9 * (5 * r6);
  37436. c += (d5 >>> 13); d5 &= 0x1fff;
  37437. d6 = c;
  37438. d6 += h0 * r6;
  37439. d6 += h1 * r5;
  37440. d6 += h2 * r4;
  37441. d6 += h3 * r3;
  37442. d6 += h4 * r2;
  37443. c = (d6 >>> 13); d6 &= 0x1fff;
  37444. d6 += h5 * r1;
  37445. d6 += h6 * r0;
  37446. d6 += h7 * (5 * r9);
  37447. d6 += h8 * (5 * r8);
  37448. d6 += h9 * (5 * r7);
  37449. c += (d6 >>> 13); d6 &= 0x1fff;
  37450. d7 = c;
  37451. d7 += h0 * r7;
  37452. d7 += h1 * r6;
  37453. d7 += h2 * r5;
  37454. d7 += h3 * r4;
  37455. d7 += h4 * r3;
  37456. c = (d7 >>> 13); d7 &= 0x1fff;
  37457. d7 += h5 * r2;
  37458. d7 += h6 * r1;
  37459. d7 += h7 * r0;
  37460. d7 += h8 * (5 * r9);
  37461. d7 += h9 * (5 * r8);
  37462. c += (d7 >>> 13); d7 &= 0x1fff;
  37463. d8 = c;
  37464. d8 += h0 * r8;
  37465. d8 += h1 * r7;
  37466. d8 += h2 * r6;
  37467. d8 += h3 * r5;
  37468. d8 += h4 * r4;
  37469. c = (d8 >>> 13); d8 &= 0x1fff;
  37470. d8 += h5 * r3;
  37471. d8 += h6 * r2;
  37472. d8 += h7 * r1;
  37473. d8 += h8 * r0;
  37474. d8 += h9 * (5 * r9);
  37475. c += (d8 >>> 13); d8 &= 0x1fff;
  37476. d9 = c;
  37477. d9 += h0 * r9;
  37478. d9 += h1 * r8;
  37479. d9 += h2 * r7;
  37480. d9 += h3 * r6;
  37481. d9 += h4 * r5;
  37482. c = (d9 >>> 13); d9 &= 0x1fff;
  37483. d9 += h5 * r4;
  37484. d9 += h6 * r3;
  37485. d9 += h7 * r2;
  37486. d9 += h8 * r1;
  37487. d9 += h9 * r0;
  37488. c += (d9 >>> 13); d9 &= 0x1fff;
  37489. c = (((c << 2) + c)) | 0;
  37490. c = (c + d0) | 0;
  37491. d0 = c & 0x1fff;
  37492. c = (c >>> 13);
  37493. d1 += c;
  37494. h0 = d0;
  37495. h1 = d1;
  37496. h2 = d2;
  37497. h3 = d3;
  37498. h4 = d4;
  37499. h5 = d5;
  37500. h6 = d6;
  37501. h7 = d7;
  37502. h8 = d8;
  37503. h9 = d9;
  37504. mpos += 16;
  37505. bytes -= 16;
  37506. }
  37507. this.h[0] = h0;
  37508. this.h[1] = h1;
  37509. this.h[2] = h2;
  37510. this.h[3] = h3;
  37511. this.h[4] = h4;
  37512. this.h[5] = h5;
  37513. this.h[6] = h6;
  37514. this.h[7] = h7;
  37515. this.h[8] = h8;
  37516. this.h[9] = h9;
  37517. };
  37518. poly1305.prototype.finish = function(mac, macpos) {
  37519. var g = new Uint16Array(10);
  37520. var c, mask, f, i;
  37521. if (this.leftover) {
  37522. i = this.leftover;
  37523. this.buffer[i++] = 1;
  37524. for (; i < 16; i++) this.buffer[i] = 0;
  37525. this.fin = 1;
  37526. this.blocks(this.buffer, 0, 16);
  37527. }
  37528. c = this.h[1] >>> 13;
  37529. this.h[1] &= 0x1fff;
  37530. for (i = 2; i < 10; i++) {
  37531. this.h[i] += c;
  37532. c = this.h[i] >>> 13;
  37533. this.h[i] &= 0x1fff;
  37534. }
  37535. this.h[0] += (c * 5);
  37536. c = this.h[0] >>> 13;
  37537. this.h[0] &= 0x1fff;
  37538. this.h[1] += c;
  37539. c = this.h[1] >>> 13;
  37540. this.h[1] &= 0x1fff;
  37541. this.h[2] += c;
  37542. g[0] = this.h[0] + 5;
  37543. c = g[0] >>> 13;
  37544. g[0] &= 0x1fff;
  37545. for (i = 1; i < 10; i++) {
  37546. g[i] = this.h[i] + c;
  37547. c = g[i] >>> 13;
  37548. g[i] &= 0x1fff;
  37549. }
  37550. g[9] -= (1 << 13);
  37551. mask = (c ^ 1) - 1;
  37552. for (i = 0; i < 10; i++) g[i] &= mask;
  37553. mask = ~mask;
  37554. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37555. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37556. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37557. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37558. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37559. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37560. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37561. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37562. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37563. f = this.h[0] + this.pad[0];
  37564. this.h[0] = f & 0xffff;
  37565. for (i = 1; i < 8; i++) {
  37566. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37567. this.h[i] = f & 0xffff;
  37568. }
  37569. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37570. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37571. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37572. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37573. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37574. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37575. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37576. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37577. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37578. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37579. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37580. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37581. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37582. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37583. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37584. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37585. };
  37586. poly1305.prototype.update = function(m, mpos, bytes) {
  37587. var i, want;
  37588. if (this.leftover) {
  37589. want = (16 - this.leftover);
  37590. if (want > bytes)
  37591. want = bytes;
  37592. for (i = 0; i < want; i++)
  37593. this.buffer[this.leftover + i] = m[mpos+i];
  37594. bytes -= want;
  37595. mpos += want;
  37596. this.leftover += want;
  37597. if (this.leftover < 16)
  37598. return;
  37599. this.blocks(this.buffer, 0, 16);
  37600. this.leftover = 0;
  37601. }
  37602. if (bytes >= 16) {
  37603. want = bytes - (bytes % 16);
  37604. this.blocks(m, mpos, want);
  37605. mpos += want;
  37606. bytes -= want;
  37607. }
  37608. if (bytes) {
  37609. for (i = 0; i < bytes; i++)
  37610. this.buffer[this.leftover + i] = m[mpos+i];
  37611. this.leftover += bytes;
  37612. }
  37613. };
  37614. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37615. var s = new poly1305(k);
  37616. s.update(m, mpos, n);
  37617. s.finish(out, outpos);
  37618. return 0;
  37619. }
  37620. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37621. var x = new Uint8Array(16);
  37622. crypto_onetimeauth(x,0,m,mpos,n,k);
  37623. return crypto_verify_16(h,hpos,x,0);
  37624. }
  37625. function crypto_secretbox(c,m,d,n,k) {
  37626. var i;
  37627. if (d < 32) return -1;
  37628. crypto_stream_xor(c,0,m,0,d,n,k);
  37629. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37630. for (i = 0; i < 16; i++) c[i] = 0;
  37631. return 0;
  37632. }
  37633. function crypto_secretbox_open(m,c,d,n,k) {
  37634. var i;
  37635. var x = new Uint8Array(32);
  37636. if (d < 32) return -1;
  37637. crypto_stream(x,0,32,n,k);
  37638. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37639. crypto_stream_xor(m,0,c,0,d,n,k);
  37640. for (i = 0; i < 32; i++) m[i] = 0;
  37641. return 0;
  37642. }
  37643. function set25519(r, a) {
  37644. var i;
  37645. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37646. }
  37647. function car25519(o) {
  37648. var i, v, c = 1;
  37649. for (i = 0; i < 16; i++) {
  37650. v = o[i] + c + 65535;
  37651. c = Math.floor(v / 65536);
  37652. o[i] = v - c * 65536;
  37653. }
  37654. o[0] += c-1 + 37 * (c-1);
  37655. }
  37656. function sel25519(p, q, b) {
  37657. var t, c = ~(b-1);
  37658. for (var i = 0; i < 16; i++) {
  37659. t = c & (p[i] ^ q[i]);
  37660. p[i] ^= t;
  37661. q[i] ^= t;
  37662. }
  37663. }
  37664. function pack25519(o, n) {
  37665. var i, j, b;
  37666. var m = gf(), t = gf();
  37667. for (i = 0; i < 16; i++) t[i] = n[i];
  37668. car25519(t);
  37669. car25519(t);
  37670. car25519(t);
  37671. for (j = 0; j < 2; j++) {
  37672. m[0] = t[0] - 0xffed;
  37673. for (i = 1; i < 15; i++) {
  37674. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37675. m[i-1] &= 0xffff;
  37676. }
  37677. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37678. b = (m[15]>>16) & 1;
  37679. m[14] &= 0xffff;
  37680. sel25519(t, m, 1-b);
  37681. }
  37682. for (i = 0; i < 16; i++) {
  37683. o[2*i] = t[i] & 0xff;
  37684. o[2*i+1] = t[i]>>8;
  37685. }
  37686. }
  37687. function neq25519(a, b) {
  37688. var c = new Uint8Array(32), d = new Uint8Array(32);
  37689. pack25519(c, a);
  37690. pack25519(d, b);
  37691. return crypto_verify_32(c, 0, d, 0);
  37692. }
  37693. function par25519(a) {
  37694. var d = new Uint8Array(32);
  37695. pack25519(d, a);
  37696. return d[0] & 1;
  37697. }
  37698. function unpack25519(o, n) {
  37699. var i;
  37700. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37701. o[15] &= 0x7fff;
  37702. }
  37703. function A(o, a, b) {
  37704. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37705. }
  37706. function Z(o, a, b) {
  37707. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37708. }
  37709. function M(o, a, b) {
  37710. var v, c,
  37711. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37712. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37713. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37714. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37715. b0 = b[0],
  37716. b1 = b[1],
  37717. b2 = b[2],
  37718. b3 = b[3],
  37719. b4 = b[4],
  37720. b5 = b[5],
  37721. b6 = b[6],
  37722. b7 = b[7],
  37723. b8 = b[8],
  37724. b9 = b[9],
  37725. b10 = b[10],
  37726. b11 = b[11],
  37727. b12 = b[12],
  37728. b13 = b[13],
  37729. b14 = b[14],
  37730. b15 = b[15];
  37731. v = a[0];
  37732. t0 += v * b0;
  37733. t1 += v * b1;
  37734. t2 += v * b2;
  37735. t3 += v * b3;
  37736. t4 += v * b4;
  37737. t5 += v * b5;
  37738. t6 += v * b6;
  37739. t7 += v * b7;
  37740. t8 += v * b8;
  37741. t9 += v * b9;
  37742. t10 += v * b10;
  37743. t11 += v * b11;
  37744. t12 += v * b12;
  37745. t13 += v * b13;
  37746. t14 += v * b14;
  37747. t15 += v * b15;
  37748. v = a[1];
  37749. t1 += v * b0;
  37750. t2 += v * b1;
  37751. t3 += v * b2;
  37752. t4 += v * b3;
  37753. t5 += v * b4;
  37754. t6 += v * b5;
  37755. t7 += v * b6;
  37756. t8 += v * b7;
  37757. t9 += v * b8;
  37758. t10 += v * b9;
  37759. t11 += v * b10;
  37760. t12 += v * b11;
  37761. t13 += v * b12;
  37762. t14 += v * b13;
  37763. t15 += v * b14;
  37764. t16 += v * b15;
  37765. v = a[2];
  37766. t2 += v * b0;
  37767. t3 += v * b1;
  37768. t4 += v * b2;
  37769. t5 += v * b3;
  37770. t6 += v * b4;
  37771. t7 += v * b5;
  37772. t8 += v * b6;
  37773. t9 += v * b7;
  37774. t10 += v * b8;
  37775. t11 += v * b9;
  37776. t12 += v * b10;
  37777. t13 += v * b11;
  37778. t14 += v * b12;
  37779. t15 += v * b13;
  37780. t16 += v * b14;
  37781. t17 += v * b15;
  37782. v = a[3];
  37783. t3 += v * b0;
  37784. t4 += v * b1;
  37785. t5 += v * b2;
  37786. t6 += v * b3;
  37787. t7 += v * b4;
  37788. t8 += v * b5;
  37789. t9 += v * b6;
  37790. t10 += v * b7;
  37791. t11 += v * b8;
  37792. t12 += v * b9;
  37793. t13 += v * b10;
  37794. t14 += v * b11;
  37795. t15 += v * b12;
  37796. t16 += v * b13;
  37797. t17 += v * b14;
  37798. t18 += v * b15;
  37799. v = a[4];
  37800. t4 += v * b0;
  37801. t5 += v * b1;
  37802. t6 += v * b2;
  37803. t7 += v * b3;
  37804. t8 += v * b4;
  37805. t9 += v * b5;
  37806. t10 += v * b6;
  37807. t11 += v * b7;
  37808. t12 += v * b8;
  37809. t13 += v * b9;
  37810. t14 += v * b10;
  37811. t15 += v * b11;
  37812. t16 += v * b12;
  37813. t17 += v * b13;
  37814. t18 += v * b14;
  37815. t19 += v * b15;
  37816. v = a[5];
  37817. t5 += v * b0;
  37818. t6 += v * b1;
  37819. t7 += v * b2;
  37820. t8 += v * b3;
  37821. t9 += v * b4;
  37822. t10 += v * b5;
  37823. t11 += v * b6;
  37824. t12 += v * b7;
  37825. t13 += v * b8;
  37826. t14 += v * b9;
  37827. t15 += v * b10;
  37828. t16 += v * b11;
  37829. t17 += v * b12;
  37830. t18 += v * b13;
  37831. t19 += v * b14;
  37832. t20 += v * b15;
  37833. v = a[6];
  37834. t6 += v * b0;
  37835. t7 += v * b1;
  37836. t8 += v * b2;
  37837. t9 += v * b3;
  37838. t10 += v * b4;
  37839. t11 += v * b5;
  37840. t12 += v * b6;
  37841. t13 += v * b7;
  37842. t14 += v * b8;
  37843. t15 += v * b9;
  37844. t16 += v * b10;
  37845. t17 += v * b11;
  37846. t18 += v * b12;
  37847. t19 += v * b13;
  37848. t20 += v * b14;
  37849. t21 += v * b15;
  37850. v = a[7];
  37851. t7 += v * b0;
  37852. t8 += v * b1;
  37853. t9 += v * b2;
  37854. t10 += v * b3;
  37855. t11 += v * b4;
  37856. t12 += v * b5;
  37857. t13 += v * b6;
  37858. t14 += v * b7;
  37859. t15 += v * b8;
  37860. t16 += v * b9;
  37861. t17 += v * b10;
  37862. t18 += v * b11;
  37863. t19 += v * b12;
  37864. t20 += v * b13;
  37865. t21 += v * b14;
  37866. t22 += v * b15;
  37867. v = a[8];
  37868. t8 += v * b0;
  37869. t9 += v * b1;
  37870. t10 += v * b2;
  37871. t11 += v * b3;
  37872. t12 += v * b4;
  37873. t13 += v * b5;
  37874. t14 += v * b6;
  37875. t15 += v * b7;
  37876. t16 += v * b8;
  37877. t17 += v * b9;
  37878. t18 += v * b10;
  37879. t19 += v * b11;
  37880. t20 += v * b12;
  37881. t21 += v * b13;
  37882. t22 += v * b14;
  37883. t23 += v * b15;
  37884. v = a[9];
  37885. t9 += v * b0;
  37886. t10 += v * b1;
  37887. t11 += v * b2;
  37888. t12 += v * b3;
  37889. t13 += v * b4;
  37890. t14 += v * b5;
  37891. t15 += v * b6;
  37892. t16 += v * b7;
  37893. t17 += v * b8;
  37894. t18 += v * b9;
  37895. t19 += v * b10;
  37896. t20 += v * b11;
  37897. t21 += v * b12;
  37898. t22 += v * b13;
  37899. t23 += v * b14;
  37900. t24 += v * b15;
  37901. v = a[10];
  37902. t10 += v * b0;
  37903. t11 += v * b1;
  37904. t12 += v * b2;
  37905. t13 += v * b3;
  37906. t14 += v * b4;
  37907. t15 += v * b5;
  37908. t16 += v * b6;
  37909. t17 += v * b7;
  37910. t18 += v * b8;
  37911. t19 += v * b9;
  37912. t20 += v * b10;
  37913. t21 += v * b11;
  37914. t22 += v * b12;
  37915. t23 += v * b13;
  37916. t24 += v * b14;
  37917. t25 += v * b15;
  37918. v = a[11];
  37919. t11 += v * b0;
  37920. t12 += v * b1;
  37921. t13 += v * b2;
  37922. t14 += v * b3;
  37923. t15 += v * b4;
  37924. t16 += v * b5;
  37925. t17 += v * b6;
  37926. t18 += v * b7;
  37927. t19 += v * b8;
  37928. t20 += v * b9;
  37929. t21 += v * b10;
  37930. t22 += v * b11;
  37931. t23 += v * b12;
  37932. t24 += v * b13;
  37933. t25 += v * b14;
  37934. t26 += v * b15;
  37935. v = a[12];
  37936. t12 += v * b0;
  37937. t13 += v * b1;
  37938. t14 += v * b2;
  37939. t15 += v * b3;
  37940. t16 += v * b4;
  37941. t17 += v * b5;
  37942. t18 += v * b6;
  37943. t19 += v * b7;
  37944. t20 += v * b8;
  37945. t21 += v * b9;
  37946. t22 += v * b10;
  37947. t23 += v * b11;
  37948. t24 += v * b12;
  37949. t25 += v * b13;
  37950. t26 += v * b14;
  37951. t27 += v * b15;
  37952. v = a[13];
  37953. t13 += v * b0;
  37954. t14 += v * b1;
  37955. t15 += v * b2;
  37956. t16 += v * b3;
  37957. t17 += v * b4;
  37958. t18 += v * b5;
  37959. t19 += v * b6;
  37960. t20 += v * b7;
  37961. t21 += v * b8;
  37962. t22 += v * b9;
  37963. t23 += v * b10;
  37964. t24 += v * b11;
  37965. t25 += v * b12;
  37966. t26 += v * b13;
  37967. t27 += v * b14;
  37968. t28 += v * b15;
  37969. v = a[14];
  37970. t14 += v * b0;
  37971. t15 += v * b1;
  37972. t16 += v * b2;
  37973. t17 += v * b3;
  37974. t18 += v * b4;
  37975. t19 += v * b5;
  37976. t20 += v * b6;
  37977. t21 += v * b7;
  37978. t22 += v * b8;
  37979. t23 += v * b9;
  37980. t24 += v * b10;
  37981. t25 += v * b11;
  37982. t26 += v * b12;
  37983. t27 += v * b13;
  37984. t28 += v * b14;
  37985. t29 += v * b15;
  37986. v = a[15];
  37987. t15 += v * b0;
  37988. t16 += v * b1;
  37989. t17 += v * b2;
  37990. t18 += v * b3;
  37991. t19 += v * b4;
  37992. t20 += v * b5;
  37993. t21 += v * b6;
  37994. t22 += v * b7;
  37995. t23 += v * b8;
  37996. t24 += v * b9;
  37997. t25 += v * b10;
  37998. t26 += v * b11;
  37999. t27 += v * b12;
  38000. t28 += v * b13;
  38001. t29 += v * b14;
  38002. t30 += v * b15;
  38003. t0 += 38 * t16;
  38004. t1 += 38 * t17;
  38005. t2 += 38 * t18;
  38006. t3 += 38 * t19;
  38007. t4 += 38 * t20;
  38008. t5 += 38 * t21;
  38009. t6 += 38 * t22;
  38010. t7 += 38 * t23;
  38011. t8 += 38 * t24;
  38012. t9 += 38 * t25;
  38013. t10 += 38 * t26;
  38014. t11 += 38 * t27;
  38015. t12 += 38 * t28;
  38016. t13 += 38 * t29;
  38017. t14 += 38 * t30;
  38018. // t15 left as is
  38019. // first car
  38020. c = 1;
  38021. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38022. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38023. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38024. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38025. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38026. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38027. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38028. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38029. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38030. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38031. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38032. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38033. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38034. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38035. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38036. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38037. t0 += c-1 + 37 * (c-1);
  38038. // second car
  38039. c = 1;
  38040. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38041. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38042. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38043. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38044. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38045. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38046. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38047. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38048. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38049. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38050. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38051. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38052. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38053. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38054. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38055. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38056. t0 += c-1 + 37 * (c-1);
  38057. o[ 0] = t0;
  38058. o[ 1] = t1;
  38059. o[ 2] = t2;
  38060. o[ 3] = t3;
  38061. o[ 4] = t4;
  38062. o[ 5] = t5;
  38063. o[ 6] = t6;
  38064. o[ 7] = t7;
  38065. o[ 8] = t8;
  38066. o[ 9] = t9;
  38067. o[10] = t10;
  38068. o[11] = t11;
  38069. o[12] = t12;
  38070. o[13] = t13;
  38071. o[14] = t14;
  38072. o[15] = t15;
  38073. }
  38074. function S(o, a) {
  38075. M(o, a, a);
  38076. }
  38077. function inv25519(o, i) {
  38078. var c = gf();
  38079. var a;
  38080. for (a = 0; a < 16; a++) c[a] = i[a];
  38081. for (a = 253; a >= 0; a--) {
  38082. S(c, c);
  38083. if(a !== 2 && a !== 4) M(c, c, i);
  38084. }
  38085. for (a = 0; a < 16; a++) o[a] = c[a];
  38086. }
  38087. function pow2523(o, i) {
  38088. var c = gf();
  38089. var a;
  38090. for (a = 0; a < 16; a++) c[a] = i[a];
  38091. for (a = 250; a >= 0; a--) {
  38092. S(c, c);
  38093. if(a !== 1) M(c, c, i);
  38094. }
  38095. for (a = 0; a < 16; a++) o[a] = c[a];
  38096. }
  38097. function crypto_scalarmult(q, n, p) {
  38098. var z = new Uint8Array(32);
  38099. var x = new Float64Array(80), r, i;
  38100. var a = gf(), b = gf(), c = gf(),
  38101. d = gf(), e = gf(), f = gf();
  38102. for (i = 0; i < 31; i++) z[i] = n[i];
  38103. z[31]=(n[31]&127)|64;
  38104. z[0]&=248;
  38105. unpack25519(x,p);
  38106. for (i = 0; i < 16; i++) {
  38107. b[i]=x[i];
  38108. d[i]=a[i]=c[i]=0;
  38109. }
  38110. a[0]=d[0]=1;
  38111. for (i=254; i>=0; --i) {
  38112. r=(z[i>>>3]>>>(i&7))&1;
  38113. sel25519(a,b,r);
  38114. sel25519(c,d,r);
  38115. A(e,a,c);
  38116. Z(a,a,c);
  38117. A(c,b,d);
  38118. Z(b,b,d);
  38119. S(d,e);
  38120. S(f,a);
  38121. M(a,c,a);
  38122. M(c,b,e);
  38123. A(e,a,c);
  38124. Z(a,a,c);
  38125. S(b,a);
  38126. Z(c,d,f);
  38127. M(a,c,_121665);
  38128. A(a,a,d);
  38129. M(c,c,a);
  38130. M(a,d,f);
  38131. M(d,b,x);
  38132. S(b,e);
  38133. sel25519(a,b,r);
  38134. sel25519(c,d,r);
  38135. }
  38136. for (i = 0; i < 16; i++) {
  38137. x[i+16]=a[i];
  38138. x[i+32]=c[i];
  38139. x[i+48]=b[i];
  38140. x[i+64]=d[i];
  38141. }
  38142. var x32 = x.subarray(32);
  38143. var x16 = x.subarray(16);
  38144. inv25519(x32,x32);
  38145. M(x16,x16,x32);
  38146. pack25519(q,x16);
  38147. return 0;
  38148. }
  38149. function crypto_scalarmult_base(q, n) {
  38150. return crypto_scalarmult(q, n, _9);
  38151. }
  38152. function crypto_box_keypair(y, x) {
  38153. randombytes(x, 32);
  38154. return crypto_scalarmult_base(y, x);
  38155. }
  38156. function crypto_box_beforenm(k, y, x) {
  38157. var s = new Uint8Array(32);
  38158. crypto_scalarmult(s, x, y);
  38159. return crypto_core_hsalsa20(k, _0, s, sigma);
  38160. }
  38161. var crypto_box_afternm = crypto_secretbox;
  38162. var crypto_box_open_afternm = crypto_secretbox_open;
  38163. function crypto_box(c, m, d, n, y, x) {
  38164. var k = new Uint8Array(32);
  38165. crypto_box_beforenm(k, y, x);
  38166. return crypto_box_afternm(c, m, d, n, k);
  38167. }
  38168. function crypto_box_open(m, c, d, n, y, x) {
  38169. var k = new Uint8Array(32);
  38170. crypto_box_beforenm(k, y, x);
  38171. return crypto_box_open_afternm(m, c, d, n, k);
  38172. }
  38173. var K = [
  38174. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38175. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38176. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38177. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38178. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38179. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38180. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38181. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38182. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38183. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38184. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38185. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38186. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38187. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38188. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38189. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38190. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38191. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38192. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38193. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38194. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38195. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38196. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38197. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38198. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38199. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38200. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38201. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38202. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38203. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38204. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38205. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38206. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38207. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38208. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38209. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38210. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38211. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38212. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38213. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38214. ];
  38215. function crypto_hashblocks_hl(hh, hl, m, n) {
  38216. var wh = new Int32Array(16), wl = new Int32Array(16),
  38217. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38218. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38219. th, tl, i, j, h, l, a, b, c, d;
  38220. var ah0 = hh[0],
  38221. ah1 = hh[1],
  38222. ah2 = hh[2],
  38223. ah3 = hh[3],
  38224. ah4 = hh[4],
  38225. ah5 = hh[5],
  38226. ah6 = hh[6],
  38227. ah7 = hh[7],
  38228. al0 = hl[0],
  38229. al1 = hl[1],
  38230. al2 = hl[2],
  38231. al3 = hl[3],
  38232. al4 = hl[4],
  38233. al5 = hl[5],
  38234. al6 = hl[6],
  38235. al7 = hl[7];
  38236. var pos = 0;
  38237. while (n >= 128) {
  38238. for (i = 0; i < 16; i++) {
  38239. j = 8 * i + pos;
  38240. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38241. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38242. }
  38243. for (i = 0; i < 80; i++) {
  38244. bh0 = ah0;
  38245. bh1 = ah1;
  38246. bh2 = ah2;
  38247. bh3 = ah3;
  38248. bh4 = ah4;
  38249. bh5 = ah5;
  38250. bh6 = ah6;
  38251. bh7 = ah7;
  38252. bl0 = al0;
  38253. bl1 = al1;
  38254. bl2 = al2;
  38255. bl3 = al3;
  38256. bl4 = al4;
  38257. bl5 = al5;
  38258. bl6 = al6;
  38259. bl7 = al7;
  38260. // add
  38261. h = ah7;
  38262. l = al7;
  38263. a = l & 0xffff; b = l >>> 16;
  38264. c = h & 0xffff; d = h >>> 16;
  38265. // Sigma1
  38266. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38267. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38268. a += l & 0xffff; b += l >>> 16;
  38269. c += h & 0xffff; d += h >>> 16;
  38270. // Ch
  38271. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38272. l = (al4 & al5) ^ (~al4 & al6);
  38273. a += l & 0xffff; b += l >>> 16;
  38274. c += h & 0xffff; d += h >>> 16;
  38275. // K
  38276. h = K[i*2];
  38277. l = K[i*2+1];
  38278. a += l & 0xffff; b += l >>> 16;
  38279. c += h & 0xffff; d += h >>> 16;
  38280. // w
  38281. h = wh[i%16];
  38282. l = wl[i%16];
  38283. a += l & 0xffff; b += l >>> 16;
  38284. c += h & 0xffff; d += h >>> 16;
  38285. b += a >>> 16;
  38286. c += b >>> 16;
  38287. d += c >>> 16;
  38288. th = c & 0xffff | d << 16;
  38289. tl = a & 0xffff | b << 16;
  38290. // add
  38291. h = th;
  38292. l = tl;
  38293. a = l & 0xffff; b = l >>> 16;
  38294. c = h & 0xffff; d = h >>> 16;
  38295. // Sigma0
  38296. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38297. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38298. a += l & 0xffff; b += l >>> 16;
  38299. c += h & 0xffff; d += h >>> 16;
  38300. // Maj
  38301. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38302. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38303. a += l & 0xffff; b += l >>> 16;
  38304. c += h & 0xffff; d += h >>> 16;
  38305. b += a >>> 16;
  38306. c += b >>> 16;
  38307. d += c >>> 16;
  38308. bh7 = (c & 0xffff) | (d << 16);
  38309. bl7 = (a & 0xffff) | (b << 16);
  38310. // add
  38311. h = bh3;
  38312. l = bl3;
  38313. a = l & 0xffff; b = l >>> 16;
  38314. c = h & 0xffff; d = h >>> 16;
  38315. h = th;
  38316. l = tl;
  38317. a += l & 0xffff; b += l >>> 16;
  38318. c += h & 0xffff; d += h >>> 16;
  38319. b += a >>> 16;
  38320. c += b >>> 16;
  38321. d += c >>> 16;
  38322. bh3 = (c & 0xffff) | (d << 16);
  38323. bl3 = (a & 0xffff) | (b << 16);
  38324. ah1 = bh0;
  38325. ah2 = bh1;
  38326. ah3 = bh2;
  38327. ah4 = bh3;
  38328. ah5 = bh4;
  38329. ah6 = bh5;
  38330. ah7 = bh6;
  38331. ah0 = bh7;
  38332. al1 = bl0;
  38333. al2 = bl1;
  38334. al3 = bl2;
  38335. al4 = bl3;
  38336. al5 = bl4;
  38337. al6 = bl5;
  38338. al7 = bl6;
  38339. al0 = bl7;
  38340. if (i%16 === 15) {
  38341. for (j = 0; j < 16; j++) {
  38342. // add
  38343. h = wh[j];
  38344. l = wl[j];
  38345. a = l & 0xffff; b = l >>> 16;
  38346. c = h & 0xffff; d = h >>> 16;
  38347. h = wh[(j+9)%16];
  38348. l = wl[(j+9)%16];
  38349. a += l & 0xffff; b += l >>> 16;
  38350. c += h & 0xffff; d += h >>> 16;
  38351. // sigma0
  38352. th = wh[(j+1)%16];
  38353. tl = wl[(j+1)%16];
  38354. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38355. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38356. a += l & 0xffff; b += l >>> 16;
  38357. c += h & 0xffff; d += h >>> 16;
  38358. // sigma1
  38359. th = wh[(j+14)%16];
  38360. tl = wl[(j+14)%16];
  38361. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38362. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38363. a += l & 0xffff; b += l >>> 16;
  38364. c += h & 0xffff; d += h >>> 16;
  38365. b += a >>> 16;
  38366. c += b >>> 16;
  38367. d += c >>> 16;
  38368. wh[j] = (c & 0xffff) | (d << 16);
  38369. wl[j] = (a & 0xffff) | (b << 16);
  38370. }
  38371. }
  38372. }
  38373. // add
  38374. h = ah0;
  38375. l = al0;
  38376. a = l & 0xffff; b = l >>> 16;
  38377. c = h & 0xffff; d = h >>> 16;
  38378. h = hh[0];
  38379. l = hl[0];
  38380. a += l & 0xffff; b += l >>> 16;
  38381. c += h & 0xffff; d += h >>> 16;
  38382. b += a >>> 16;
  38383. c += b >>> 16;
  38384. d += c >>> 16;
  38385. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38386. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38387. h = ah1;
  38388. l = al1;
  38389. a = l & 0xffff; b = l >>> 16;
  38390. c = h & 0xffff; d = h >>> 16;
  38391. h = hh[1];
  38392. l = hl[1];
  38393. a += l & 0xffff; b += l >>> 16;
  38394. c += h & 0xffff; d += h >>> 16;
  38395. b += a >>> 16;
  38396. c += b >>> 16;
  38397. d += c >>> 16;
  38398. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38399. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38400. h = ah2;
  38401. l = al2;
  38402. a = l & 0xffff; b = l >>> 16;
  38403. c = h & 0xffff; d = h >>> 16;
  38404. h = hh[2];
  38405. l = hl[2];
  38406. a += l & 0xffff; b += l >>> 16;
  38407. c += h & 0xffff; d += h >>> 16;
  38408. b += a >>> 16;
  38409. c += b >>> 16;
  38410. d += c >>> 16;
  38411. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38412. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38413. h = ah3;
  38414. l = al3;
  38415. a = l & 0xffff; b = l >>> 16;
  38416. c = h & 0xffff; d = h >>> 16;
  38417. h = hh[3];
  38418. l = hl[3];
  38419. a += l & 0xffff; b += l >>> 16;
  38420. c += h & 0xffff; d += h >>> 16;
  38421. b += a >>> 16;
  38422. c += b >>> 16;
  38423. d += c >>> 16;
  38424. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38425. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38426. h = ah4;
  38427. l = al4;
  38428. a = l & 0xffff; b = l >>> 16;
  38429. c = h & 0xffff; d = h >>> 16;
  38430. h = hh[4];
  38431. l = hl[4];
  38432. a += l & 0xffff; b += l >>> 16;
  38433. c += h & 0xffff; d += h >>> 16;
  38434. b += a >>> 16;
  38435. c += b >>> 16;
  38436. d += c >>> 16;
  38437. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38438. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38439. h = ah5;
  38440. l = al5;
  38441. a = l & 0xffff; b = l >>> 16;
  38442. c = h & 0xffff; d = h >>> 16;
  38443. h = hh[5];
  38444. l = hl[5];
  38445. a += l & 0xffff; b += l >>> 16;
  38446. c += h & 0xffff; d += h >>> 16;
  38447. b += a >>> 16;
  38448. c += b >>> 16;
  38449. d += c >>> 16;
  38450. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38451. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38452. h = ah6;
  38453. l = al6;
  38454. a = l & 0xffff; b = l >>> 16;
  38455. c = h & 0xffff; d = h >>> 16;
  38456. h = hh[6];
  38457. l = hl[6];
  38458. a += l & 0xffff; b += l >>> 16;
  38459. c += h & 0xffff; d += h >>> 16;
  38460. b += a >>> 16;
  38461. c += b >>> 16;
  38462. d += c >>> 16;
  38463. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38464. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38465. h = ah7;
  38466. l = al7;
  38467. a = l & 0xffff; b = l >>> 16;
  38468. c = h & 0xffff; d = h >>> 16;
  38469. h = hh[7];
  38470. l = hl[7];
  38471. a += l & 0xffff; b += l >>> 16;
  38472. c += h & 0xffff; d += h >>> 16;
  38473. b += a >>> 16;
  38474. c += b >>> 16;
  38475. d += c >>> 16;
  38476. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38477. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38478. pos += 128;
  38479. n -= 128;
  38480. }
  38481. return n;
  38482. }
  38483. function crypto_hash(out, m, n) {
  38484. var hh = new Int32Array(8),
  38485. hl = new Int32Array(8),
  38486. x = new Uint8Array(256),
  38487. i, b = n;
  38488. hh[0] = 0x6a09e667;
  38489. hh[1] = 0xbb67ae85;
  38490. hh[2] = 0x3c6ef372;
  38491. hh[3] = 0xa54ff53a;
  38492. hh[4] = 0x510e527f;
  38493. hh[5] = 0x9b05688c;
  38494. hh[6] = 0x1f83d9ab;
  38495. hh[7] = 0x5be0cd19;
  38496. hl[0] = 0xf3bcc908;
  38497. hl[1] = 0x84caa73b;
  38498. hl[2] = 0xfe94f82b;
  38499. hl[3] = 0x5f1d36f1;
  38500. hl[4] = 0xade682d1;
  38501. hl[5] = 0x2b3e6c1f;
  38502. hl[6] = 0xfb41bd6b;
  38503. hl[7] = 0x137e2179;
  38504. crypto_hashblocks_hl(hh, hl, m, n);
  38505. n %= 128;
  38506. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38507. x[n] = 128;
  38508. n = 256-128*(n<112?1:0);
  38509. x[n-9] = 0;
  38510. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38511. crypto_hashblocks_hl(hh, hl, x, n);
  38512. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38513. return 0;
  38514. }
  38515. function add(p, q) {
  38516. var a = gf(), b = gf(), c = gf(),
  38517. d = gf(), e = gf(), f = gf(),
  38518. g = gf(), h = gf(), t = gf();
  38519. Z(a, p[1], p[0]);
  38520. Z(t, q[1], q[0]);
  38521. M(a, a, t);
  38522. A(b, p[0], p[1]);
  38523. A(t, q[0], q[1]);
  38524. M(b, b, t);
  38525. M(c, p[3], q[3]);
  38526. M(c, c, D2);
  38527. M(d, p[2], q[2]);
  38528. A(d, d, d);
  38529. Z(e, b, a);
  38530. Z(f, d, c);
  38531. A(g, d, c);
  38532. A(h, b, a);
  38533. M(p[0], e, f);
  38534. M(p[1], h, g);
  38535. M(p[2], g, f);
  38536. M(p[3], e, h);
  38537. }
  38538. function cswap(p, q, b) {
  38539. var i;
  38540. for (i = 0; i < 4; i++) {
  38541. sel25519(p[i], q[i], b);
  38542. }
  38543. }
  38544. function pack(r, p) {
  38545. var tx = gf(), ty = gf(), zi = gf();
  38546. inv25519(zi, p[2]);
  38547. M(tx, p[0], zi);
  38548. M(ty, p[1], zi);
  38549. pack25519(r, ty);
  38550. r[31] ^= par25519(tx) << 7;
  38551. }
  38552. function scalarmult(p, q, s) {
  38553. var b, i;
  38554. set25519(p[0], gf0);
  38555. set25519(p[1], gf1);
  38556. set25519(p[2], gf1);
  38557. set25519(p[3], gf0);
  38558. for (i = 255; i >= 0; --i) {
  38559. b = (s[(i/8)|0] >> (i&7)) & 1;
  38560. cswap(p, q, b);
  38561. add(q, p);
  38562. add(p, p);
  38563. cswap(p, q, b);
  38564. }
  38565. }
  38566. function scalarbase(p, s) {
  38567. var q = [gf(), gf(), gf(), gf()];
  38568. set25519(q[0], X);
  38569. set25519(q[1], Y);
  38570. set25519(q[2], gf1);
  38571. M(q[3], X, Y);
  38572. scalarmult(p, q, s);
  38573. }
  38574. function crypto_sign_keypair(pk, sk, seeded) {
  38575. var d = new Uint8Array(64);
  38576. var p = [gf(), gf(), gf(), gf()];
  38577. var i;
  38578. if (!seeded) randombytes(sk, 32);
  38579. crypto_hash(d, sk, 32);
  38580. d[0] &= 248;
  38581. d[31] &= 127;
  38582. d[31] |= 64;
  38583. scalarbase(p, d);
  38584. pack(pk, p);
  38585. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38586. return 0;
  38587. }
  38588. 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]);
  38589. function modL(r, x) {
  38590. var carry, i, j, k;
  38591. for (i = 63; i >= 32; --i) {
  38592. carry = 0;
  38593. for (j = i - 32, k = i - 12; j < k; ++j) {
  38594. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38595. carry = (x[j] + 128) >> 8;
  38596. x[j] -= carry * 256;
  38597. }
  38598. x[j] += carry;
  38599. x[i] = 0;
  38600. }
  38601. carry = 0;
  38602. for (j = 0; j < 32; j++) {
  38603. x[j] += carry - (x[31] >> 4) * L[j];
  38604. carry = x[j] >> 8;
  38605. x[j] &= 255;
  38606. }
  38607. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38608. for (i = 0; i < 32; i++) {
  38609. x[i+1] += x[i] >> 8;
  38610. r[i] = x[i] & 255;
  38611. }
  38612. }
  38613. function reduce(r) {
  38614. var x = new Float64Array(64), i;
  38615. for (i = 0; i < 64; i++) x[i] = r[i];
  38616. for (i = 0; i < 64; i++) r[i] = 0;
  38617. modL(r, x);
  38618. }
  38619. // Note: difference from C - smlen returned, not passed as argument.
  38620. function crypto_sign(sm, m, n, sk) {
  38621. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38622. var i, j, x = new Float64Array(64);
  38623. var p = [gf(), gf(), gf(), gf()];
  38624. crypto_hash(d, sk, 32);
  38625. d[0] &= 248;
  38626. d[31] &= 127;
  38627. d[31] |= 64;
  38628. var smlen = n + 64;
  38629. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38630. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38631. crypto_hash(r, sm.subarray(32), n+32);
  38632. reduce(r);
  38633. scalarbase(p, r);
  38634. pack(sm, p);
  38635. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38636. crypto_hash(h, sm, n + 64);
  38637. reduce(h);
  38638. for (i = 0; i < 64; i++) x[i] = 0;
  38639. for (i = 0; i < 32; i++) x[i] = r[i];
  38640. for (i = 0; i < 32; i++) {
  38641. for (j = 0; j < 32; j++) {
  38642. x[i+j] += h[i] * d[j];
  38643. }
  38644. }
  38645. modL(sm.subarray(32), x);
  38646. return smlen;
  38647. }
  38648. function unpackneg(r, p) {
  38649. var t = gf(), chk = gf(), num = gf(),
  38650. den = gf(), den2 = gf(), den4 = gf(),
  38651. den6 = gf();
  38652. set25519(r[2], gf1);
  38653. unpack25519(r[1], p);
  38654. S(num, r[1]);
  38655. M(den, num, D);
  38656. Z(num, num, r[2]);
  38657. A(den, r[2], den);
  38658. S(den2, den);
  38659. S(den4, den2);
  38660. M(den6, den4, den2);
  38661. M(t, den6, num);
  38662. M(t, t, den);
  38663. pow2523(t, t);
  38664. M(t, t, num);
  38665. M(t, t, den);
  38666. M(t, t, den);
  38667. M(r[0], t, den);
  38668. S(chk, r[0]);
  38669. M(chk, chk, den);
  38670. if (neq25519(chk, num)) M(r[0], r[0], I);
  38671. S(chk, r[0]);
  38672. M(chk, chk, den);
  38673. if (neq25519(chk, num)) return -1;
  38674. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38675. M(r[3], r[0], r[1]);
  38676. return 0;
  38677. }
  38678. function crypto_sign_open(m, sm, n, pk) {
  38679. var i, mlen;
  38680. var t = new Uint8Array(32), h = new Uint8Array(64);
  38681. var p = [gf(), gf(), gf(), gf()],
  38682. q = [gf(), gf(), gf(), gf()];
  38683. mlen = -1;
  38684. if (n < 64) return -1;
  38685. if (unpackneg(q, pk)) return -1;
  38686. for (i = 0; i < n; i++) m[i] = sm[i];
  38687. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38688. crypto_hash(h, m, n);
  38689. reduce(h);
  38690. scalarmult(p, q, h);
  38691. scalarbase(q, sm.subarray(32));
  38692. add(p, q);
  38693. pack(t, p);
  38694. n -= 64;
  38695. if (crypto_verify_32(sm, 0, t, 0)) {
  38696. for (i = 0; i < n; i++) m[i] = 0;
  38697. return -1;
  38698. }
  38699. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38700. mlen = n;
  38701. return mlen;
  38702. }
  38703. var crypto_secretbox_KEYBYTES = 32,
  38704. crypto_secretbox_NONCEBYTES = 24,
  38705. crypto_secretbox_ZEROBYTES = 32,
  38706. crypto_secretbox_BOXZEROBYTES = 16,
  38707. crypto_scalarmult_BYTES = 32,
  38708. crypto_scalarmult_SCALARBYTES = 32,
  38709. crypto_box_PUBLICKEYBYTES = 32,
  38710. crypto_box_SECRETKEYBYTES = 32,
  38711. crypto_box_BEFORENMBYTES = 32,
  38712. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38713. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38714. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38715. crypto_sign_BYTES = 64,
  38716. crypto_sign_PUBLICKEYBYTES = 32,
  38717. crypto_sign_SECRETKEYBYTES = 64,
  38718. crypto_sign_SEEDBYTES = 32,
  38719. crypto_hash_BYTES = 64;
  38720. nacl.lowlevel = {
  38721. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38722. crypto_stream_xor: crypto_stream_xor,
  38723. crypto_stream: crypto_stream,
  38724. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38725. crypto_stream_salsa20: crypto_stream_salsa20,
  38726. crypto_onetimeauth: crypto_onetimeauth,
  38727. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38728. crypto_verify_16: crypto_verify_16,
  38729. crypto_verify_32: crypto_verify_32,
  38730. crypto_secretbox: crypto_secretbox,
  38731. crypto_secretbox_open: crypto_secretbox_open,
  38732. crypto_scalarmult: crypto_scalarmult,
  38733. crypto_scalarmult_base: crypto_scalarmult_base,
  38734. crypto_box_beforenm: crypto_box_beforenm,
  38735. crypto_box_afternm: crypto_box_afternm,
  38736. crypto_box: crypto_box,
  38737. crypto_box_open: crypto_box_open,
  38738. crypto_box_keypair: crypto_box_keypair,
  38739. crypto_hash: crypto_hash,
  38740. crypto_sign: crypto_sign,
  38741. crypto_sign_keypair: crypto_sign_keypair,
  38742. crypto_sign_open: crypto_sign_open,
  38743. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38744. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38745. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38746. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38747. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38748. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38749. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38750. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38751. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38752. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38753. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38754. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38755. crypto_sign_BYTES: crypto_sign_BYTES,
  38756. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38757. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38758. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38759. crypto_hash_BYTES: crypto_hash_BYTES
  38760. };
  38761. /* High-level API */
  38762. function checkLengths(k, n) {
  38763. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38764. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38765. }
  38766. function checkBoxLengths(pk, sk) {
  38767. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38768. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38769. }
  38770. function checkArrayTypes() {
  38771. for (var i = 0; i < arguments.length; i++) {
  38772. if (!(arguments[i] instanceof Uint8Array))
  38773. throw new TypeError('unexpected type, use Uint8Array');
  38774. }
  38775. }
  38776. function cleanup(arr) {
  38777. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38778. }
  38779. nacl.randomBytes = function(n) {
  38780. var b = new Uint8Array(n);
  38781. randombytes(b, n);
  38782. return b;
  38783. };
  38784. nacl.secretbox = function(msg, nonce, key) {
  38785. checkArrayTypes(msg, nonce, key);
  38786. checkLengths(key, nonce);
  38787. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38788. var c = new Uint8Array(m.length);
  38789. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38790. crypto_secretbox(c, m, m.length, nonce, key);
  38791. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38792. };
  38793. nacl.secretbox.open = function(box, nonce, key) {
  38794. checkArrayTypes(box, nonce, key);
  38795. checkLengths(key, nonce);
  38796. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38797. var m = new Uint8Array(c.length);
  38798. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38799. if (c.length < 32) return null;
  38800. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38801. return m.subarray(crypto_secretbox_ZEROBYTES);
  38802. };
  38803. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38804. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38805. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38806. nacl.scalarMult = function(n, p) {
  38807. checkArrayTypes(n, p);
  38808. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38809. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38810. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38811. crypto_scalarmult(q, n, p);
  38812. return q;
  38813. };
  38814. nacl.scalarMult.base = function(n) {
  38815. checkArrayTypes(n);
  38816. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38817. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38818. crypto_scalarmult_base(q, n);
  38819. return q;
  38820. };
  38821. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38822. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38823. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38824. var k = nacl.box.before(publicKey, secretKey);
  38825. return nacl.secretbox(msg, nonce, k);
  38826. };
  38827. nacl.box.before = function(publicKey, secretKey) {
  38828. checkArrayTypes(publicKey, secretKey);
  38829. checkBoxLengths(publicKey, secretKey);
  38830. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38831. crypto_box_beforenm(k, publicKey, secretKey);
  38832. return k;
  38833. };
  38834. nacl.box.after = nacl.secretbox;
  38835. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38836. var k = nacl.box.before(publicKey, secretKey);
  38837. return nacl.secretbox.open(msg, nonce, k);
  38838. };
  38839. nacl.box.open.after = nacl.secretbox.open;
  38840. nacl.box.keyPair = function() {
  38841. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38842. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38843. crypto_box_keypair(pk, sk);
  38844. return {publicKey: pk, secretKey: sk};
  38845. };
  38846. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38847. checkArrayTypes(secretKey);
  38848. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38849. throw new Error('bad secret key size');
  38850. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38851. crypto_scalarmult_base(pk, secretKey);
  38852. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38853. };
  38854. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38855. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38856. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38857. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38858. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38859. nacl.sign = function(msg, secretKey) {
  38860. checkArrayTypes(msg, secretKey);
  38861. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38862. throw new Error('bad secret key size');
  38863. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38864. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38865. return signedMsg;
  38866. };
  38867. nacl.sign.open = function(signedMsg, publicKey) {
  38868. checkArrayTypes(signedMsg, publicKey);
  38869. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38870. throw new Error('bad public key size');
  38871. var tmp = new Uint8Array(signedMsg.length);
  38872. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38873. if (mlen < 0) return null;
  38874. var m = new Uint8Array(mlen);
  38875. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38876. return m;
  38877. };
  38878. nacl.sign.detached = function(msg, secretKey) {
  38879. var signedMsg = nacl.sign(msg, secretKey);
  38880. var sig = new Uint8Array(crypto_sign_BYTES);
  38881. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38882. return sig;
  38883. };
  38884. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38885. checkArrayTypes(msg, sig, publicKey);
  38886. if (sig.length !== crypto_sign_BYTES)
  38887. throw new Error('bad signature size');
  38888. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38889. throw new Error('bad public key size');
  38890. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38891. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38892. var i;
  38893. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38894. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38895. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38896. };
  38897. nacl.sign.keyPair = function() {
  38898. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38899. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38900. crypto_sign_keypair(pk, sk);
  38901. return {publicKey: pk, secretKey: sk};
  38902. };
  38903. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38904. checkArrayTypes(secretKey);
  38905. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38906. throw new Error('bad secret key size');
  38907. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38908. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38909. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38910. };
  38911. nacl.sign.keyPair.fromSeed = function(seed) {
  38912. checkArrayTypes(seed);
  38913. if (seed.length !== crypto_sign_SEEDBYTES)
  38914. throw new Error('bad seed size');
  38915. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38916. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38917. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38918. crypto_sign_keypair(pk, sk, true);
  38919. return {publicKey: pk, secretKey: sk};
  38920. };
  38921. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38922. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38923. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38924. nacl.sign.signatureLength = crypto_sign_BYTES;
  38925. nacl.hash = function(msg) {
  38926. checkArrayTypes(msg);
  38927. var h = new Uint8Array(crypto_hash_BYTES);
  38928. crypto_hash(h, msg, msg.length);
  38929. return h;
  38930. };
  38931. nacl.hash.hashLength = crypto_hash_BYTES;
  38932. nacl.verify = function(x, y) {
  38933. checkArrayTypes(x, y);
  38934. // Zero length arguments are considered not equal.
  38935. if (x.length === 0 || y.length === 0) return false;
  38936. if (x.length !== y.length) return false;
  38937. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38938. };
  38939. nacl.setPRNG = function(fn) {
  38940. randombytes = fn;
  38941. };
  38942. (function() {
  38943. // Initialize PRNG if environment provides CSPRNG.
  38944. // If not, methods calling randombytes will throw.
  38945. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38946. if (crypto && crypto.getRandomValues) {
  38947. // Browsers.
  38948. var QUOTA = 65536;
  38949. nacl.setPRNG(function(x, n) {
  38950. var i, v = new Uint8Array(n);
  38951. for (i = 0; i < n; i += QUOTA) {
  38952. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38953. }
  38954. for (i = 0; i < n; i++) x[i] = v[i];
  38955. cleanup(v);
  38956. });
  38957. } else if (true) {
  38958. // Node.js.
  38959. crypto = __webpack_require__(3);
  38960. if (crypto && crypto.randomBytes) {
  38961. nacl.setPRNG(function(x, n) {
  38962. var i, v = crypto.randomBytes(n);
  38963. for (i = 0; i < n; i++) x[i] = v[i];
  38964. cleanup(v);
  38965. });
  38966. }
  38967. }
  38968. })();
  38969. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38970. /***/ }),
  38971. /* 1 */
  38972. /***/ (function(module, exports, __webpack_require__) {
  38973. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38974. // Public domain.
  38975. (function(root, f) {
  38976. 'use strict';
  38977. if ( true && module.exports) module.exports = f();
  38978. else if (root.nacl) root.nacl.util = f();
  38979. else {
  38980. root.nacl = {};
  38981. root.nacl.util = f();
  38982. }
  38983. }(this, function() {
  38984. 'use strict';
  38985. var util = {};
  38986. function validateBase64(s) {
  38987. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38988. throw new TypeError('invalid encoding');
  38989. }
  38990. }
  38991. util.decodeUTF8 = function(s) {
  38992. if (typeof s !== 'string') throw new TypeError('expected string');
  38993. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38994. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38995. return b;
  38996. };
  38997. util.encodeUTF8 = function(arr) {
  38998. var i, s = [];
  38999. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39000. return decodeURIComponent(escape(s.join('')));
  39001. };
  39002. if (typeof atob === 'undefined') {
  39003. // Node.js
  39004. if (typeof Buffer.from !== 'undefined') {
  39005. // Node v6 and later
  39006. util.encodeBase64 = function (arr) { // v6 and later
  39007. return Buffer.from(arr).toString('base64');
  39008. };
  39009. util.decodeBase64 = function (s) {
  39010. validateBase64(s);
  39011. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39012. };
  39013. } else {
  39014. // Node earlier than v6
  39015. util.encodeBase64 = function (arr) { // v6 and later
  39016. return (new Buffer(arr)).toString('base64');
  39017. };
  39018. util.decodeBase64 = function(s) {
  39019. validateBase64(s);
  39020. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39021. };
  39022. }
  39023. } else {
  39024. // Browsers
  39025. util.encodeBase64 = function(arr) {
  39026. var i, s = [], len = arr.length;
  39027. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39028. return btoa(s.join(''));
  39029. };
  39030. util.decodeBase64 = function(s) {
  39031. validateBase64(s);
  39032. var i, d = atob(s), b = new Uint8Array(d.length);
  39033. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39034. return b;
  39035. };
  39036. }
  39037. return util;
  39038. }));
  39039. /***/ }),
  39040. /* 2 */
  39041. /***/ (function(module, exports, __webpack_require__) {
  39042. // required so we don't have to do require('pusher').default etc.
  39043. module.exports = __webpack_require__(4).default;
  39044. /***/ }),
  39045. /* 3 */
  39046. /***/ (function(module, exports) {
  39047. /* (ignored) */
  39048. /***/ }),
  39049. /* 4 */
  39050. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39051. "use strict";
  39052. __webpack_require__.r(__webpack_exports__);
  39053. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39054. var ScriptReceiverFactory = (function () {
  39055. function ScriptReceiverFactory(prefix, name) {
  39056. this.lastId = 0;
  39057. this.prefix = prefix;
  39058. this.name = name;
  39059. }
  39060. ScriptReceiverFactory.prototype.create = function (callback) {
  39061. this.lastId++;
  39062. var number = this.lastId;
  39063. var id = this.prefix + number;
  39064. var name = this.name + "[" + number + "]";
  39065. var called = false;
  39066. var callbackWrapper = function () {
  39067. if (!called) {
  39068. callback.apply(null, arguments);
  39069. called = true;
  39070. }
  39071. };
  39072. this[number] = callbackWrapper;
  39073. return { number: number, id: id, name: name, callback: callbackWrapper };
  39074. };
  39075. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39076. delete this[receiver.number];
  39077. };
  39078. return ScriptReceiverFactory;
  39079. }());
  39080. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39081. // CONCATENATED MODULE: ./src/core/defaults.ts
  39082. var Defaults = {
  39083. VERSION: "5.0.3",
  39084. PROTOCOL: 7,
  39085. host: 'ws.pusherapp.com',
  39086. ws_port: 80,
  39087. wss_port: 443,
  39088. ws_path: '',
  39089. sockjs_host: 'sockjs.pusher.com',
  39090. sockjs_http_port: 80,
  39091. sockjs_https_port: 443,
  39092. sockjs_path: '/pusher',
  39093. stats_host: 'stats.pusher.com',
  39094. channel_auth_endpoint: '/pusher/auth',
  39095. channel_auth_transport: 'ajax',
  39096. activity_timeout: 120000,
  39097. pong_timeout: 30000,
  39098. unavailable_timeout: 10000,
  39099. cdn_http: "http://js.pusher.com",
  39100. cdn_https: "https://js.pusher.com",
  39101. dependency_suffix: ""
  39102. };
  39103. /* harmony default export */ var defaults = (Defaults);
  39104. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39105. var dependency_loader_DependencyLoader = (function () {
  39106. function DependencyLoader(options) {
  39107. this.options = options;
  39108. this.receivers = options.receivers || ScriptReceivers;
  39109. this.loading = {};
  39110. }
  39111. DependencyLoader.prototype.load = function (name, options, callback) {
  39112. var self = this;
  39113. if (self.loading[name] && self.loading[name].length > 0) {
  39114. self.loading[name].push(callback);
  39115. }
  39116. else {
  39117. self.loading[name] = [callback];
  39118. var request = runtime.createScriptRequest(self.getPath(name, options));
  39119. var receiver = self.receivers.create(function (error) {
  39120. self.receivers.remove(receiver);
  39121. if (self.loading[name]) {
  39122. var callbacks = self.loading[name];
  39123. delete self.loading[name];
  39124. var successCallback = function (wasSuccessful) {
  39125. if (!wasSuccessful) {
  39126. request.cleanup();
  39127. }
  39128. };
  39129. for (var i = 0; i < callbacks.length; i++) {
  39130. callbacks[i](error, successCallback);
  39131. }
  39132. }
  39133. });
  39134. request.send(receiver);
  39135. }
  39136. };
  39137. DependencyLoader.prototype.getRoot = function (options) {
  39138. var cdn;
  39139. var protocol = runtime.getDocument().location.protocol;
  39140. if ((options && options.useTLS) || protocol === "https:") {
  39141. cdn = this.options.cdn_https;
  39142. }
  39143. else {
  39144. cdn = this.options.cdn_http;
  39145. }
  39146. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39147. };
  39148. DependencyLoader.prototype.getPath = function (name, options) {
  39149. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39150. };
  39151. ;
  39152. return DependencyLoader;
  39153. }());
  39154. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39155. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39156. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39157. var Dependencies = new dependency_loader({
  39158. cdn_http: defaults.cdn_http,
  39159. cdn_https: defaults.cdn_https,
  39160. version: defaults.VERSION,
  39161. suffix: defaults.dependency_suffix,
  39162. receivers: DependenciesReceivers
  39163. });
  39164. // CONCATENATED MODULE: ./src/core/base64.ts
  39165. function encode(s) {
  39166. return btoa(utob(s));
  39167. }
  39168. var fromCharCode = String.fromCharCode;
  39169. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39170. var b64tab = {};
  39171. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39172. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39173. }
  39174. var cb_utob = function (c) {
  39175. var cc = c.charCodeAt(0);
  39176. return cc < 0x80
  39177. ? c
  39178. : cc < 0x800
  39179. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39180. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39181. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39182. fromCharCode(0x80 | (cc & 0x3f));
  39183. };
  39184. var utob = function (u) {
  39185. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39186. };
  39187. var cb_encode = function (ccc) {
  39188. var padlen = [0, 2, 1][ccc.length % 3];
  39189. var ord = (ccc.charCodeAt(0) << 16) |
  39190. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39191. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39192. var chars = [
  39193. b64chars.charAt(ord >>> 18),
  39194. b64chars.charAt((ord >>> 12) & 63),
  39195. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39196. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39197. ];
  39198. return chars.join('');
  39199. };
  39200. var btoa = window.btoa ||
  39201. function (b) {
  39202. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39203. };
  39204. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39205. var Timer = (function () {
  39206. function Timer(set, clear, delay, callback) {
  39207. var _this = this;
  39208. this.clear = clear;
  39209. this.timer = set(function () {
  39210. if (_this.timer) {
  39211. _this.timer = callback(_this.timer);
  39212. }
  39213. }, delay);
  39214. }
  39215. Timer.prototype.isRunning = function () {
  39216. return this.timer !== null;
  39217. };
  39218. Timer.prototype.ensureAborted = function () {
  39219. if (this.timer) {
  39220. this.clear(this.timer);
  39221. this.timer = null;
  39222. }
  39223. };
  39224. return Timer;
  39225. }());
  39226. /* harmony default export */ var abstract_timer = (Timer);
  39227. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39228. var __extends = (undefined && undefined.__extends) || (function () {
  39229. var extendStatics = function (d, b) {
  39230. extendStatics = Object.setPrototypeOf ||
  39231. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39232. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39233. return extendStatics(d, b);
  39234. };
  39235. return function (d, b) {
  39236. extendStatics(d, b);
  39237. function __() { this.constructor = d; }
  39238. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39239. };
  39240. })();
  39241. function timers_clearTimeout(timer) {
  39242. window.clearTimeout(timer);
  39243. }
  39244. function timers_clearInterval(timer) {
  39245. window.clearInterval(timer);
  39246. }
  39247. var OneOffTimer = (function (_super) {
  39248. __extends(OneOffTimer, _super);
  39249. function OneOffTimer(delay, callback) {
  39250. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39251. callback();
  39252. return null;
  39253. }) || this;
  39254. }
  39255. return OneOffTimer;
  39256. }(abstract_timer));
  39257. var PeriodicTimer = (function (_super) {
  39258. __extends(PeriodicTimer, _super);
  39259. function PeriodicTimer(delay, callback) {
  39260. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39261. callback();
  39262. return timer;
  39263. }) || this;
  39264. }
  39265. return PeriodicTimer;
  39266. }(abstract_timer));
  39267. // CONCATENATED MODULE: ./src/core/util.ts
  39268. var Util = {
  39269. now: function () {
  39270. if (Date.now) {
  39271. return Date.now();
  39272. }
  39273. else {
  39274. return new Date().valueOf();
  39275. }
  39276. },
  39277. defer: function (callback) {
  39278. return new OneOffTimer(0, callback);
  39279. },
  39280. method: function (name) {
  39281. var args = [];
  39282. for (var _i = 1; _i < arguments.length; _i++) {
  39283. args[_i - 1] = arguments[_i];
  39284. }
  39285. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39286. return function (object) {
  39287. return object[name].apply(object, boundArguments.concat(arguments));
  39288. };
  39289. }
  39290. };
  39291. /* harmony default export */ var util = (Util);
  39292. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39293. function extend(target) {
  39294. var sources = [];
  39295. for (var _i = 1; _i < arguments.length; _i++) {
  39296. sources[_i - 1] = arguments[_i];
  39297. }
  39298. for (var i = 0; i < sources.length; i++) {
  39299. var extensions = sources[i];
  39300. for (var property in extensions) {
  39301. if (extensions[property] && extensions[property].constructor &&
  39302. extensions[property].constructor === Object) {
  39303. target[property] = extend(target[property] || {}, extensions[property]);
  39304. }
  39305. else {
  39306. target[property] = extensions[property];
  39307. }
  39308. }
  39309. }
  39310. return target;
  39311. }
  39312. function stringify() {
  39313. var m = ["Pusher"];
  39314. for (var i = 0; i < arguments.length; i++) {
  39315. if (typeof arguments[i] === "string") {
  39316. m.push(arguments[i]);
  39317. }
  39318. else {
  39319. m.push(safeJSONStringify(arguments[i]));
  39320. }
  39321. }
  39322. return m.join(" : ");
  39323. }
  39324. function arrayIndexOf(array, item) {
  39325. var nativeIndexOf = Array.prototype.indexOf;
  39326. if (array === null) {
  39327. return -1;
  39328. }
  39329. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39330. return array.indexOf(item);
  39331. }
  39332. for (var i = 0, l = array.length; i < l; i++) {
  39333. if (array[i] === item) {
  39334. return i;
  39335. }
  39336. }
  39337. return -1;
  39338. }
  39339. function objectApply(object, f) {
  39340. for (var key in object) {
  39341. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39342. f(object[key], key, object);
  39343. }
  39344. }
  39345. }
  39346. function keys(object) {
  39347. var keys = [];
  39348. objectApply(object, function (_, key) {
  39349. keys.push(key);
  39350. });
  39351. return keys;
  39352. }
  39353. function values(object) {
  39354. var values = [];
  39355. objectApply(object, function (value) {
  39356. values.push(value);
  39357. });
  39358. return values;
  39359. }
  39360. function apply(array, f, context) {
  39361. for (var i = 0; i < array.length; i++) {
  39362. f.call(context || window, array[i], i, array);
  39363. }
  39364. }
  39365. function map(array, f) {
  39366. var result = [];
  39367. for (var i = 0; i < array.length; i++) {
  39368. result.push(f(array[i], i, array, result));
  39369. }
  39370. return result;
  39371. }
  39372. function mapObject(object, f) {
  39373. var result = {};
  39374. objectApply(object, function (value, key) {
  39375. result[key] = f(value);
  39376. });
  39377. return result;
  39378. }
  39379. function filter(array, test) {
  39380. test = test || function (value) { return !!value; };
  39381. var result = [];
  39382. for (var i = 0; i < array.length; i++) {
  39383. if (test(array[i], i, array, result)) {
  39384. result.push(array[i]);
  39385. }
  39386. }
  39387. return result;
  39388. }
  39389. function filterObject(object, test) {
  39390. var result = {};
  39391. objectApply(object, function (value, key) {
  39392. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39393. result[key] = value;
  39394. }
  39395. });
  39396. return result;
  39397. }
  39398. function flatten(object) {
  39399. var result = [];
  39400. objectApply(object, function (value, key) {
  39401. result.push([key, value]);
  39402. });
  39403. return result;
  39404. }
  39405. function any(array, test) {
  39406. for (var i = 0; i < array.length; i++) {
  39407. if (test(array[i], i, array)) {
  39408. return true;
  39409. }
  39410. }
  39411. return false;
  39412. }
  39413. function collections_all(array, test) {
  39414. for (var i = 0; i < array.length; i++) {
  39415. if (!test(array[i], i, array)) {
  39416. return false;
  39417. }
  39418. }
  39419. return true;
  39420. }
  39421. function encodeParamsObject(data) {
  39422. return mapObject(data, function (value) {
  39423. if (typeof value === "object") {
  39424. value = safeJSONStringify(value);
  39425. }
  39426. return encodeURIComponent(encode(value.toString()));
  39427. });
  39428. }
  39429. function buildQueryString(data) {
  39430. var params = filterObject(data, function (value) {
  39431. return value !== undefined;
  39432. });
  39433. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39434. return query;
  39435. }
  39436. function decycleObject(object) {
  39437. var objects = [], paths = [];
  39438. return (function derez(value, path) {
  39439. var i, name, nu;
  39440. switch (typeof value) {
  39441. case 'object':
  39442. if (!value) {
  39443. return null;
  39444. }
  39445. for (i = 0; i < objects.length; i += 1) {
  39446. if (objects[i] === value) {
  39447. return { $ref: paths[i] };
  39448. }
  39449. }
  39450. objects.push(value);
  39451. paths.push(path);
  39452. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39453. nu = [];
  39454. for (i = 0; i < value.length; i += 1) {
  39455. nu[i] = derez(value[i], path + '[' + i + ']');
  39456. }
  39457. }
  39458. else {
  39459. nu = {};
  39460. for (name in value) {
  39461. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39462. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39463. }
  39464. }
  39465. }
  39466. return nu;
  39467. case 'number':
  39468. case 'string':
  39469. case 'boolean':
  39470. return value;
  39471. }
  39472. }(object, '$'));
  39473. }
  39474. function safeJSONStringify(source) {
  39475. try {
  39476. return JSON.stringify(source);
  39477. }
  39478. catch (e) {
  39479. return JSON.stringify(decycleObject(source));
  39480. }
  39481. }
  39482. // CONCATENATED MODULE: ./src/core/logger.ts
  39483. var logger_Logger = (function () {
  39484. function Logger() {
  39485. this.globalLog = function (message) {
  39486. if (window.console && window.console.log) {
  39487. window.console.log(message);
  39488. }
  39489. };
  39490. }
  39491. Logger.prototype.debug = function () {
  39492. var args = [];
  39493. for (var _i = 0; _i < arguments.length; _i++) {
  39494. args[_i] = arguments[_i];
  39495. }
  39496. this.log(this.globalLog, args);
  39497. };
  39498. Logger.prototype.warn = function () {
  39499. var args = [];
  39500. for (var _i = 0; _i < arguments.length; _i++) {
  39501. args[_i] = arguments[_i];
  39502. }
  39503. this.log(this.globalLogWarn, args);
  39504. };
  39505. Logger.prototype.error = function () {
  39506. var args = [];
  39507. for (var _i = 0; _i < arguments.length; _i++) {
  39508. args[_i] = arguments[_i];
  39509. }
  39510. this.log(this.globalLogError, args);
  39511. };
  39512. Logger.prototype.globalLogWarn = function (message) {
  39513. if (window.console && window.console.warn) {
  39514. window.console.warn(message);
  39515. }
  39516. else {
  39517. this.globalLog(message);
  39518. }
  39519. };
  39520. Logger.prototype.globalLogError = function (message) {
  39521. if (window.console && window.console.error) {
  39522. window.console.error(message);
  39523. }
  39524. else {
  39525. this.globalLogWarn(message);
  39526. }
  39527. };
  39528. Logger.prototype.log = function (defaultLoggingFunction) {
  39529. var args = [];
  39530. for (var _i = 1; _i < arguments.length; _i++) {
  39531. args[_i - 1] = arguments[_i];
  39532. }
  39533. var message = stringify.apply(this, arguments);
  39534. if (core_pusher.log) {
  39535. core_pusher.log(message);
  39536. }
  39537. else if (core_pusher.logToConsole) {
  39538. var log = defaultLoggingFunction.bind(this);
  39539. log(message);
  39540. }
  39541. };
  39542. return Logger;
  39543. }());
  39544. /* harmony default export */ var logger = (new logger_Logger());
  39545. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39546. var urlStore = {
  39547. baseUrl: "https://pusher.com",
  39548. urls: {
  39549. authenticationEndpoint: {
  39550. path: "/docs/authenticating_users",
  39551. },
  39552. javascriptQuickStart: {
  39553. path: "/docs/javascript_quick_start"
  39554. },
  39555. triggeringClientEvents: {
  39556. path: "/docs/client_api_guide/client_events#trigger-events"
  39557. }
  39558. }
  39559. };
  39560. var buildLogSuffix = function (key) {
  39561. var urlPrefix = "See:";
  39562. var urlObj = urlStore.urls[key];
  39563. if (!urlObj)
  39564. return "";
  39565. var url;
  39566. if (urlObj.fullUrl) {
  39567. url = urlObj.fullUrl;
  39568. }
  39569. else if (urlObj.path) {
  39570. url = urlStore.baseUrl + urlObj.path;
  39571. }
  39572. if (!url)
  39573. return "";
  39574. return urlPrefix + " " + url;
  39575. };
  39576. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39577. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39578. var ajax = function (context, socketId, callback) {
  39579. var self = this, xhr;
  39580. xhr = runtime.createXHR();
  39581. xhr.open("POST", self.options.authEndpoint, true);
  39582. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39583. for (var headerName in this.authOptions.headers) {
  39584. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39585. }
  39586. xhr.onreadystatechange = function () {
  39587. if (xhr.readyState === 4) {
  39588. if (xhr.status === 200) {
  39589. var data, parsed = false;
  39590. try {
  39591. data = JSON.parse(xhr.responseText);
  39592. parsed = true;
  39593. }
  39594. catch (e) {
  39595. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39596. }
  39597. if (parsed) {
  39598. callback(false, data);
  39599. }
  39600. }
  39601. else {
  39602. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39603. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39604. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39605. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39606. callback(true, xhr.status);
  39607. }
  39608. }
  39609. };
  39610. xhr.send(this.composeQuery(socketId));
  39611. return xhr;
  39612. };
  39613. /* harmony default export */ var xhr_auth = (ajax);
  39614. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39615. var jsonp = function (context, socketId, callback) {
  39616. if (this.authOptions.headers !== undefined) {
  39617. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39618. }
  39619. var callbackName = context.nextAuthCallbackID.toString();
  39620. context.nextAuthCallbackID++;
  39621. var document = context.getDocument();
  39622. var script = document.createElement("script");
  39623. context.auth_callbacks[callbackName] = function (data) {
  39624. callback(false, data);
  39625. };
  39626. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39627. script.src = this.options.authEndpoint +
  39628. '?callback=' +
  39629. encodeURIComponent(callback_name) +
  39630. '&' +
  39631. this.composeQuery(socketId);
  39632. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39633. head.insertBefore(script, head.firstChild);
  39634. };
  39635. /* harmony default export */ var jsonp_auth = (jsonp);
  39636. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39637. var ScriptRequest = (function () {
  39638. function ScriptRequest(src) {
  39639. this.src = src;
  39640. }
  39641. ScriptRequest.prototype.send = function (receiver) {
  39642. var self = this;
  39643. var errorString = "Error loading " + self.src;
  39644. self.script = document.createElement("script");
  39645. self.script.id = receiver.id;
  39646. self.script.src = self.src;
  39647. self.script.type = "text/javascript";
  39648. self.script.charset = "UTF-8";
  39649. if (self.script.addEventListener) {
  39650. self.script.onerror = function () {
  39651. receiver.callback(errorString);
  39652. };
  39653. self.script.onload = function () {
  39654. receiver.callback(null);
  39655. };
  39656. }
  39657. else {
  39658. self.script.onreadystatechange = function () {
  39659. if (self.script.readyState === 'loaded' ||
  39660. self.script.readyState === 'complete') {
  39661. receiver.callback(null);
  39662. }
  39663. };
  39664. }
  39665. if (self.script.async === undefined && document.attachEvent &&
  39666. /opera/i.test(navigator.userAgent)) {
  39667. self.errorScript = document.createElement("script");
  39668. self.errorScript.id = receiver.id + "_error";
  39669. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39670. self.script.async = self.errorScript.async = false;
  39671. }
  39672. else {
  39673. self.script.async = true;
  39674. }
  39675. var head = document.getElementsByTagName('head')[0];
  39676. head.insertBefore(self.script, head.firstChild);
  39677. if (self.errorScript) {
  39678. head.insertBefore(self.errorScript, self.script.nextSibling);
  39679. }
  39680. };
  39681. ScriptRequest.prototype.cleanup = function () {
  39682. if (this.script) {
  39683. this.script.onload = this.script.onerror = null;
  39684. this.script.onreadystatechange = null;
  39685. }
  39686. if (this.script && this.script.parentNode) {
  39687. this.script.parentNode.removeChild(this.script);
  39688. }
  39689. if (this.errorScript && this.errorScript.parentNode) {
  39690. this.errorScript.parentNode.removeChild(this.errorScript);
  39691. }
  39692. this.script = null;
  39693. this.errorScript = null;
  39694. };
  39695. return ScriptRequest;
  39696. }());
  39697. /* harmony default export */ var script_request = (ScriptRequest);
  39698. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39699. var jsonp_request_JSONPRequest = (function () {
  39700. function JSONPRequest(url, data) {
  39701. this.url = url;
  39702. this.data = data;
  39703. }
  39704. JSONPRequest.prototype.send = function (receiver) {
  39705. if (this.request) {
  39706. return;
  39707. }
  39708. var query = buildQueryString(this.data);
  39709. var url = this.url + "/" + receiver.number + "?" + query;
  39710. this.request = runtime.createScriptRequest(url);
  39711. this.request.send(receiver);
  39712. };
  39713. JSONPRequest.prototype.cleanup = function () {
  39714. if (this.request) {
  39715. this.request.cleanup();
  39716. }
  39717. };
  39718. return JSONPRequest;
  39719. }());
  39720. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39721. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39722. var getAgent = function (sender, useTLS) {
  39723. return function (data, callback) {
  39724. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39725. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39726. var request = runtime.createJSONPRequest(url, data);
  39727. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39728. ScriptReceivers.remove(receiver);
  39729. request.cleanup();
  39730. if (result && result.host) {
  39731. sender.host = result.host;
  39732. }
  39733. if (callback) {
  39734. callback(error, result);
  39735. }
  39736. });
  39737. request.send(receiver);
  39738. };
  39739. };
  39740. var jsonp_timeline_jsonp = {
  39741. name: 'jsonp',
  39742. getAgent: getAgent
  39743. };
  39744. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39745. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39746. function getGenericURL(baseScheme, params, path) {
  39747. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39748. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39749. return scheme + "://" + host + path;
  39750. }
  39751. function getGenericPath(key, queryString) {
  39752. var path = "/app/" + key;
  39753. var query = "?protocol=" + defaults.PROTOCOL +
  39754. "&client=js" +
  39755. "&version=" + defaults.VERSION +
  39756. (queryString ? ("&" + queryString) : "");
  39757. return path + query;
  39758. }
  39759. var ws = {
  39760. getInitial: function (key, params) {
  39761. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39762. return getGenericURL("ws", params, path);
  39763. }
  39764. };
  39765. var http = {
  39766. getInitial: function (key, params) {
  39767. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39768. return getGenericURL("http", params, path);
  39769. }
  39770. };
  39771. var sockjs = {
  39772. getInitial: function (key, params) {
  39773. return getGenericURL("http", params, params.httpPath || "/pusher");
  39774. },
  39775. getPath: function (key, params) {
  39776. return getGenericPath(key);
  39777. }
  39778. };
  39779. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39780. var callback_registry_CallbackRegistry = (function () {
  39781. function CallbackRegistry() {
  39782. this._callbacks = {};
  39783. }
  39784. CallbackRegistry.prototype.get = function (name) {
  39785. return this._callbacks[prefix(name)];
  39786. };
  39787. CallbackRegistry.prototype.add = function (name, callback, context) {
  39788. var prefixedEventName = prefix(name);
  39789. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39790. this._callbacks[prefixedEventName].push({
  39791. fn: callback,
  39792. context: context
  39793. });
  39794. };
  39795. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39796. if (!name && !callback && !context) {
  39797. this._callbacks = {};
  39798. return;
  39799. }
  39800. var names = name ? [prefix(name)] : keys(this._callbacks);
  39801. if (callback || context) {
  39802. this.removeCallback(names, callback, context);
  39803. }
  39804. else {
  39805. this.removeAllCallbacks(names);
  39806. }
  39807. };
  39808. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39809. apply(names, function (name) {
  39810. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39811. return (callback && callback !== binding.fn) ||
  39812. (context && context !== binding.context);
  39813. });
  39814. if (this._callbacks[name].length === 0) {
  39815. delete this._callbacks[name];
  39816. }
  39817. }, this);
  39818. };
  39819. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39820. apply(names, function (name) {
  39821. delete this._callbacks[name];
  39822. }, this);
  39823. };
  39824. return CallbackRegistry;
  39825. }());
  39826. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39827. function prefix(name) {
  39828. return "_" + name;
  39829. }
  39830. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39831. var dispatcher_Dispatcher = (function () {
  39832. function Dispatcher(failThrough) {
  39833. this.callbacks = new callback_registry();
  39834. this.global_callbacks = [];
  39835. this.failThrough = failThrough;
  39836. }
  39837. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39838. this.callbacks.add(eventName, callback, context);
  39839. return this;
  39840. };
  39841. Dispatcher.prototype.bind_global = function (callback) {
  39842. this.global_callbacks.push(callback);
  39843. return this;
  39844. };
  39845. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39846. this.callbacks.remove(eventName, callback, context);
  39847. return this;
  39848. };
  39849. Dispatcher.prototype.unbind_global = function (callback) {
  39850. if (!callback) {
  39851. this.global_callbacks = [];
  39852. return this;
  39853. }
  39854. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39855. return this;
  39856. };
  39857. Dispatcher.prototype.unbind_all = function () {
  39858. this.unbind();
  39859. this.unbind_global();
  39860. return this;
  39861. };
  39862. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39863. for (var i = 0; i < this.global_callbacks.length; i++) {
  39864. this.global_callbacks[i](eventName, data);
  39865. }
  39866. var callbacks = this.callbacks.get(eventName);
  39867. var args = [];
  39868. if (metadata) {
  39869. args.push(data, metadata);
  39870. }
  39871. else if (data) {
  39872. args.push(data);
  39873. }
  39874. if (callbacks && callbacks.length > 0) {
  39875. for (var i = 0; i < callbacks.length; i++) {
  39876. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39877. }
  39878. }
  39879. else if (this.failThrough) {
  39880. this.failThrough(eventName, data);
  39881. }
  39882. return this;
  39883. };
  39884. return Dispatcher;
  39885. }());
  39886. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39887. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39888. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39889. var extendStatics = function (d, b) {
  39890. extendStatics = Object.setPrototypeOf ||
  39891. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39892. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39893. return extendStatics(d, b);
  39894. };
  39895. return function (d, b) {
  39896. extendStatics(d, b);
  39897. function __() { this.constructor = d; }
  39898. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39899. };
  39900. })();
  39901. var transport_connection_TransportConnection = (function (_super) {
  39902. transport_connection_extends(TransportConnection, _super);
  39903. function TransportConnection(hooks, name, priority, key, options) {
  39904. var _this = _super.call(this) || this;
  39905. _this.initialize = runtime.transportConnectionInitializer;
  39906. _this.hooks = hooks;
  39907. _this.name = name;
  39908. _this.priority = priority;
  39909. _this.key = key;
  39910. _this.options = options;
  39911. _this.state = "new";
  39912. _this.timeline = options.timeline;
  39913. _this.activityTimeout = options.activityTimeout;
  39914. _this.id = _this.timeline.generateUniqueID();
  39915. return _this;
  39916. }
  39917. TransportConnection.prototype.handlesActivityChecks = function () {
  39918. return Boolean(this.hooks.handlesActivityChecks);
  39919. };
  39920. TransportConnection.prototype.supportsPing = function () {
  39921. return Boolean(this.hooks.supportsPing);
  39922. };
  39923. TransportConnection.prototype.connect = function () {
  39924. var _this = this;
  39925. if (this.socket || this.state !== "initialized") {
  39926. return false;
  39927. }
  39928. var url = this.hooks.urls.getInitial(this.key, this.options);
  39929. try {
  39930. this.socket = this.hooks.getSocket(url, this.options);
  39931. }
  39932. catch (e) {
  39933. util.defer(function () {
  39934. _this.onError(e);
  39935. _this.changeState("closed");
  39936. });
  39937. return false;
  39938. }
  39939. this.bindListeners();
  39940. logger.debug("Connecting", { transport: this.name, url: url });
  39941. this.changeState("connecting");
  39942. return true;
  39943. };
  39944. TransportConnection.prototype.close = function () {
  39945. if (this.socket) {
  39946. this.socket.close();
  39947. return true;
  39948. }
  39949. else {
  39950. return false;
  39951. }
  39952. };
  39953. TransportConnection.prototype.send = function (data) {
  39954. var _this = this;
  39955. if (this.state === "open") {
  39956. util.defer(function () {
  39957. if (_this.socket) {
  39958. _this.socket.send(data);
  39959. }
  39960. });
  39961. return true;
  39962. }
  39963. else {
  39964. return false;
  39965. }
  39966. };
  39967. TransportConnection.prototype.ping = function () {
  39968. if (this.state === "open" && this.supportsPing()) {
  39969. this.socket.ping();
  39970. }
  39971. };
  39972. TransportConnection.prototype.onOpen = function () {
  39973. if (this.hooks.beforeOpen) {
  39974. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39975. }
  39976. this.changeState("open");
  39977. this.socket.onopen = undefined;
  39978. };
  39979. TransportConnection.prototype.onError = function (error) {
  39980. this.emit("error", { type: 'WebSocketError', error: error });
  39981. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39982. };
  39983. TransportConnection.prototype.onClose = function (closeEvent) {
  39984. if (closeEvent) {
  39985. this.changeState("closed", {
  39986. code: closeEvent.code,
  39987. reason: closeEvent.reason,
  39988. wasClean: closeEvent.wasClean
  39989. });
  39990. }
  39991. else {
  39992. this.changeState("closed");
  39993. }
  39994. this.unbindListeners();
  39995. this.socket = undefined;
  39996. };
  39997. TransportConnection.prototype.onMessage = function (message) {
  39998. this.emit("message", message);
  39999. };
  40000. TransportConnection.prototype.onActivity = function () {
  40001. this.emit("activity");
  40002. };
  40003. TransportConnection.prototype.bindListeners = function () {
  40004. var _this = this;
  40005. this.socket.onopen = function () {
  40006. _this.onOpen();
  40007. };
  40008. this.socket.onerror = function (error) {
  40009. _this.onError(error);
  40010. };
  40011. this.socket.onclose = function (closeEvent) {
  40012. _this.onClose(closeEvent);
  40013. };
  40014. this.socket.onmessage = function (message) {
  40015. _this.onMessage(message);
  40016. };
  40017. if (this.supportsPing()) {
  40018. this.socket.onactivity = function () { _this.onActivity(); };
  40019. }
  40020. };
  40021. TransportConnection.prototype.unbindListeners = function () {
  40022. if (this.socket) {
  40023. this.socket.onopen = undefined;
  40024. this.socket.onerror = undefined;
  40025. this.socket.onclose = undefined;
  40026. this.socket.onmessage = undefined;
  40027. if (this.supportsPing()) {
  40028. this.socket.onactivity = undefined;
  40029. }
  40030. }
  40031. };
  40032. TransportConnection.prototype.changeState = function (state, params) {
  40033. this.state = state;
  40034. this.timeline.info(this.buildTimelineMessage({
  40035. state: state,
  40036. params: params
  40037. }));
  40038. this.emit(state, params);
  40039. };
  40040. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40041. return extend({ cid: this.id }, message);
  40042. };
  40043. return TransportConnection;
  40044. }(dispatcher));
  40045. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40046. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40047. var transport_Transport = (function () {
  40048. function Transport(hooks) {
  40049. this.hooks = hooks;
  40050. }
  40051. Transport.prototype.isSupported = function (environment) {
  40052. return this.hooks.isSupported(environment);
  40053. };
  40054. Transport.prototype.createConnection = function (name, priority, key, options) {
  40055. return new transport_connection(this.hooks, name, priority, key, options);
  40056. };
  40057. return Transport;
  40058. }());
  40059. /* harmony default export */ var transports_transport = (transport_Transport);
  40060. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40061. var WSTransport = new transports_transport({
  40062. urls: ws,
  40063. handlesActivityChecks: false,
  40064. supportsPing: false,
  40065. isInitialized: function () {
  40066. return Boolean(runtime.getWebSocketAPI());
  40067. },
  40068. isSupported: function () {
  40069. return Boolean(runtime.getWebSocketAPI());
  40070. },
  40071. getSocket: function (url) {
  40072. return runtime.createWebSocket(url);
  40073. }
  40074. });
  40075. var httpConfiguration = {
  40076. urls: http,
  40077. handlesActivityChecks: false,
  40078. supportsPing: true,
  40079. isInitialized: function () {
  40080. return true;
  40081. }
  40082. };
  40083. var streamingConfiguration = extend({ getSocket: function (url) {
  40084. return runtime.HTTPFactory.createStreamingSocket(url);
  40085. }
  40086. }, httpConfiguration);
  40087. var pollingConfiguration = extend({ getSocket: function (url) {
  40088. return runtime.HTTPFactory.createPollingSocket(url);
  40089. }
  40090. }, httpConfiguration);
  40091. var xhrConfiguration = {
  40092. isSupported: function () {
  40093. return runtime.isXHRSupported();
  40094. }
  40095. };
  40096. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40097. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40098. var Transports = {
  40099. ws: WSTransport,
  40100. xhr_streaming: XHRStreamingTransport,
  40101. xhr_polling: XHRPollingTransport
  40102. };
  40103. /* harmony default export */ var transports = (Transports);
  40104. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40105. var SockJSTransport = new transports_transport({
  40106. file: "sockjs",
  40107. urls: sockjs,
  40108. handlesActivityChecks: true,
  40109. supportsPing: false,
  40110. isSupported: function () {
  40111. return true;
  40112. },
  40113. isInitialized: function () {
  40114. return window.SockJS !== undefined;
  40115. },
  40116. getSocket: function (url, options) {
  40117. return new window.SockJS(url, null, {
  40118. js_path: Dependencies.getPath("sockjs", {
  40119. useTLS: options.useTLS
  40120. }),
  40121. ignore_null_origin: options.ignoreNullOrigin
  40122. });
  40123. },
  40124. beforeOpen: function (socket, path) {
  40125. socket.send(JSON.stringify({
  40126. path: path
  40127. }));
  40128. }
  40129. });
  40130. var xdrConfiguration = {
  40131. isSupported: function (environment) {
  40132. var yes = runtime.isXDRSupported(environment.useTLS);
  40133. return yes;
  40134. }
  40135. };
  40136. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40137. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40138. transports.xdr_streaming = XDRStreamingTransport;
  40139. transports.xdr_polling = XDRPollingTransport;
  40140. transports.sockjs = SockJSTransport;
  40141. /* harmony default export */ var transports_transports = (transports);
  40142. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40143. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40144. var extendStatics = function (d, b) {
  40145. extendStatics = Object.setPrototypeOf ||
  40146. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40147. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40148. return extendStatics(d, b);
  40149. };
  40150. return function (d, b) {
  40151. extendStatics(d, b);
  40152. function __() { this.constructor = d; }
  40153. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40154. };
  40155. })();
  40156. var NetInfo = (function (_super) {
  40157. net_info_extends(NetInfo, _super);
  40158. function NetInfo() {
  40159. var _this = _super.call(this) || this;
  40160. var self = _this;
  40161. if (window.addEventListener !== undefined) {
  40162. window.addEventListener("online", function () {
  40163. self.emit('online');
  40164. }, false);
  40165. window.addEventListener("offline", function () {
  40166. self.emit('offline');
  40167. }, false);
  40168. }
  40169. return _this;
  40170. }
  40171. NetInfo.prototype.isOnline = function () {
  40172. if (window.navigator.onLine === undefined) {
  40173. return true;
  40174. }
  40175. else {
  40176. return window.navigator.onLine;
  40177. }
  40178. };
  40179. return NetInfo;
  40180. }(dispatcher));
  40181. var net_info_Network = new NetInfo();
  40182. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40183. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40184. function AssistantToTheTransportManager(manager, transport, options) {
  40185. this.manager = manager;
  40186. this.transport = transport;
  40187. this.minPingDelay = options.minPingDelay;
  40188. this.maxPingDelay = options.maxPingDelay;
  40189. this.pingDelay = undefined;
  40190. }
  40191. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40192. var _this = this;
  40193. options = extend({}, options, {
  40194. activityTimeout: this.pingDelay
  40195. });
  40196. var connection = this.transport.createConnection(name, priority, key, options);
  40197. var openTimestamp = null;
  40198. var onOpen = function () {
  40199. connection.unbind("open", onOpen);
  40200. connection.bind("closed", onClosed);
  40201. openTimestamp = util.now();
  40202. };
  40203. var onClosed = function (closeEvent) {
  40204. connection.unbind("closed", onClosed);
  40205. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40206. _this.manager.reportDeath();
  40207. }
  40208. else if (!closeEvent.wasClean && openTimestamp) {
  40209. var lifespan = util.now() - openTimestamp;
  40210. if (lifespan < 2 * _this.maxPingDelay) {
  40211. _this.manager.reportDeath();
  40212. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40213. }
  40214. }
  40215. };
  40216. connection.bind("open", onOpen);
  40217. return connection;
  40218. };
  40219. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40220. return this.manager.isAlive() && this.transport.isSupported(environment);
  40221. };
  40222. return AssistantToTheTransportManager;
  40223. }());
  40224. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40225. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40226. var Protocol = {
  40227. decodeMessage: function (messageEvent) {
  40228. try {
  40229. var messageData = JSON.parse(messageEvent.data);
  40230. var pusherEventData = messageData.data;
  40231. if (typeof pusherEventData === 'string') {
  40232. try {
  40233. pusherEventData = JSON.parse(messageData.data);
  40234. }
  40235. catch (e) { }
  40236. }
  40237. var pusherEvent = {
  40238. event: messageData.event,
  40239. channel: messageData.channel,
  40240. data: pusherEventData,
  40241. };
  40242. if (messageData.user_id) {
  40243. pusherEvent.user_id = messageData.user_id;
  40244. }
  40245. return pusherEvent;
  40246. }
  40247. catch (e) {
  40248. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40249. }
  40250. },
  40251. encodeMessage: function (event) {
  40252. return JSON.stringify(event);
  40253. },
  40254. processHandshake: function (messageEvent) {
  40255. var message = Protocol.decodeMessage(messageEvent);
  40256. if (message.event === "pusher:connection_established") {
  40257. if (!message.data.activity_timeout) {
  40258. throw "No activity timeout specified in handshake";
  40259. }
  40260. return {
  40261. action: "connected",
  40262. id: message.data.socket_id,
  40263. activityTimeout: message.data.activity_timeout * 1000
  40264. };
  40265. }
  40266. else if (message.event === "pusher:error") {
  40267. return {
  40268. action: this.getCloseAction(message.data),
  40269. error: this.getCloseError(message.data)
  40270. };
  40271. }
  40272. else {
  40273. throw "Invalid handshake";
  40274. }
  40275. },
  40276. getCloseAction: function (closeEvent) {
  40277. if (closeEvent.code < 4000) {
  40278. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40279. return "backoff";
  40280. }
  40281. else {
  40282. return null;
  40283. }
  40284. }
  40285. else if (closeEvent.code === 4000) {
  40286. return "tls_only";
  40287. }
  40288. else if (closeEvent.code < 4100) {
  40289. return "refused";
  40290. }
  40291. else if (closeEvent.code < 4200) {
  40292. return "backoff";
  40293. }
  40294. else if (closeEvent.code < 4300) {
  40295. return "retry";
  40296. }
  40297. else {
  40298. return "refused";
  40299. }
  40300. },
  40301. getCloseError: function (closeEvent) {
  40302. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40303. return {
  40304. type: 'PusherError',
  40305. data: {
  40306. code: closeEvent.code,
  40307. message: closeEvent.reason || closeEvent.message
  40308. }
  40309. };
  40310. }
  40311. else {
  40312. return null;
  40313. }
  40314. }
  40315. };
  40316. /* harmony default export */ var protocol_protocol = (Protocol);
  40317. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40318. var connection_extends = (undefined && undefined.__extends) || (function () {
  40319. var extendStatics = function (d, b) {
  40320. extendStatics = Object.setPrototypeOf ||
  40321. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40322. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40323. return extendStatics(d, b);
  40324. };
  40325. return function (d, b) {
  40326. extendStatics(d, b);
  40327. function __() { this.constructor = d; }
  40328. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40329. };
  40330. })();
  40331. var connection_Connection = (function (_super) {
  40332. connection_extends(Connection, _super);
  40333. function Connection(id, transport) {
  40334. var _this = _super.call(this) || this;
  40335. _this.id = id;
  40336. _this.transport = transport;
  40337. _this.activityTimeout = transport.activityTimeout;
  40338. _this.bindListeners();
  40339. return _this;
  40340. }
  40341. Connection.prototype.handlesActivityChecks = function () {
  40342. return this.transport.handlesActivityChecks();
  40343. };
  40344. Connection.prototype.send = function (data) {
  40345. return this.transport.send(data);
  40346. };
  40347. Connection.prototype.send_event = function (name, data, channel) {
  40348. var event = { event: name, data: data };
  40349. if (channel) {
  40350. event.channel = channel;
  40351. }
  40352. logger.debug('Event sent', event);
  40353. return this.send(protocol_protocol.encodeMessage(event));
  40354. };
  40355. Connection.prototype.ping = function () {
  40356. if (this.transport.supportsPing()) {
  40357. this.transport.ping();
  40358. }
  40359. else {
  40360. this.send_event('pusher:ping', {});
  40361. }
  40362. };
  40363. Connection.prototype.close = function () {
  40364. this.transport.close();
  40365. };
  40366. Connection.prototype.bindListeners = function () {
  40367. var _this = this;
  40368. var listeners = {
  40369. message: function (messageEvent) {
  40370. var pusherEvent;
  40371. try {
  40372. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40373. }
  40374. catch (e) {
  40375. _this.emit('error', {
  40376. type: 'MessageParseError',
  40377. error: e,
  40378. data: messageEvent.data
  40379. });
  40380. }
  40381. if (pusherEvent !== undefined) {
  40382. logger.debug('Event recd', pusherEvent);
  40383. switch (pusherEvent.event) {
  40384. case 'pusher:error':
  40385. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40386. break;
  40387. case 'pusher:ping':
  40388. _this.emit("ping");
  40389. break;
  40390. case 'pusher:pong':
  40391. _this.emit("pong");
  40392. break;
  40393. }
  40394. _this.emit('message', pusherEvent);
  40395. }
  40396. },
  40397. activity: function () {
  40398. _this.emit("activity");
  40399. },
  40400. error: function (error) {
  40401. _this.emit("error", { type: "WebSocketError", error: error });
  40402. },
  40403. closed: function (closeEvent) {
  40404. unbindListeners();
  40405. if (closeEvent && closeEvent.code) {
  40406. _this.handleCloseEvent(closeEvent);
  40407. }
  40408. _this.transport = null;
  40409. _this.emit("closed");
  40410. }
  40411. };
  40412. var unbindListeners = function () {
  40413. objectApply(listeners, function (listener, event) {
  40414. _this.transport.unbind(event, listener);
  40415. });
  40416. };
  40417. objectApply(listeners, function (listener, event) {
  40418. _this.transport.bind(event, listener);
  40419. });
  40420. };
  40421. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40422. var action = protocol_protocol.getCloseAction(closeEvent);
  40423. var error = protocol_protocol.getCloseError(closeEvent);
  40424. if (error) {
  40425. this.emit('error', error);
  40426. }
  40427. if (action) {
  40428. this.emit(action, { action: action, error: error });
  40429. }
  40430. };
  40431. return Connection;
  40432. }(dispatcher));
  40433. /* harmony default export */ var connection_connection = (connection_Connection);
  40434. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40435. var handshake_Handshake = (function () {
  40436. function Handshake(transport, callback) {
  40437. this.transport = transport;
  40438. this.callback = callback;
  40439. this.bindListeners();
  40440. }
  40441. Handshake.prototype.close = function () {
  40442. this.unbindListeners();
  40443. this.transport.close();
  40444. };
  40445. Handshake.prototype.bindListeners = function () {
  40446. var _this = this;
  40447. this.onMessage = function (m) {
  40448. _this.unbindListeners();
  40449. var result;
  40450. try {
  40451. result = protocol_protocol.processHandshake(m);
  40452. }
  40453. catch (e) {
  40454. _this.finish("error", { error: e });
  40455. _this.transport.close();
  40456. return;
  40457. }
  40458. if (result.action === "connected") {
  40459. _this.finish("connected", {
  40460. connection: new connection_connection(result.id, _this.transport),
  40461. activityTimeout: result.activityTimeout
  40462. });
  40463. }
  40464. else {
  40465. _this.finish(result.action, { error: result.error });
  40466. _this.transport.close();
  40467. }
  40468. };
  40469. this.onClosed = function (closeEvent) {
  40470. _this.unbindListeners();
  40471. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40472. var error = protocol_protocol.getCloseError(closeEvent);
  40473. _this.finish(action, { error: error });
  40474. };
  40475. this.transport.bind("message", this.onMessage);
  40476. this.transport.bind("closed", this.onClosed);
  40477. };
  40478. Handshake.prototype.unbindListeners = function () {
  40479. this.transport.unbind("message", this.onMessage);
  40480. this.transport.unbind("closed", this.onClosed);
  40481. };
  40482. Handshake.prototype.finish = function (action, params) {
  40483. this.callback(extend({ transport: this.transport, action: action }, params));
  40484. };
  40485. return Handshake;
  40486. }());
  40487. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40488. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40489. var pusher_authorizer_PusherAuthorizer = (function () {
  40490. function PusherAuthorizer(channel, options) {
  40491. this.channel = channel;
  40492. var authTransport = options.authTransport;
  40493. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40494. throw "'" + authTransport + "' is not a recognized auth transport";
  40495. }
  40496. this.type = authTransport;
  40497. this.options = options;
  40498. this.authOptions = (options || {}).auth || {};
  40499. }
  40500. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40501. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40502. '&channel_name=' + encodeURIComponent(this.channel.name);
  40503. for (var i in this.authOptions.params) {
  40504. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40505. }
  40506. return query;
  40507. };
  40508. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40509. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40510. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40511. };
  40512. return PusherAuthorizer;
  40513. }());
  40514. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40515. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40516. var timeline_sender_TimelineSender = (function () {
  40517. function TimelineSender(timeline, options) {
  40518. this.timeline = timeline;
  40519. this.options = options || {};
  40520. }
  40521. TimelineSender.prototype.send = function (useTLS, callback) {
  40522. if (this.timeline.isEmpty()) {
  40523. return;
  40524. }
  40525. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40526. };
  40527. return TimelineSender;
  40528. }());
  40529. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40530. // CONCATENATED MODULE: ./src/core/errors.ts
  40531. var errors_extends = (undefined && undefined.__extends) || (function () {
  40532. var extendStatics = function (d, b) {
  40533. extendStatics = Object.setPrototypeOf ||
  40534. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40535. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40536. return extendStatics(d, b);
  40537. };
  40538. return function (d, b) {
  40539. extendStatics(d, b);
  40540. function __() { this.constructor = d; }
  40541. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40542. };
  40543. })();
  40544. var BadEventName = (function (_super) {
  40545. errors_extends(BadEventName, _super);
  40546. function BadEventName(msg) {
  40547. var _newTarget = this.constructor;
  40548. var _this = _super.call(this, msg) || this;
  40549. Object.setPrototypeOf(_this, _newTarget.prototype);
  40550. return _this;
  40551. }
  40552. return BadEventName;
  40553. }(Error));
  40554. var RequestTimedOut = (function (_super) {
  40555. errors_extends(RequestTimedOut, _super);
  40556. function RequestTimedOut(msg) {
  40557. var _newTarget = this.constructor;
  40558. var _this = _super.call(this, msg) || this;
  40559. Object.setPrototypeOf(_this, _newTarget.prototype);
  40560. return _this;
  40561. }
  40562. return RequestTimedOut;
  40563. }(Error));
  40564. var TransportPriorityTooLow = (function (_super) {
  40565. errors_extends(TransportPriorityTooLow, _super);
  40566. function TransportPriorityTooLow(msg) {
  40567. var _newTarget = this.constructor;
  40568. var _this = _super.call(this, msg) || this;
  40569. Object.setPrototypeOf(_this, _newTarget.prototype);
  40570. return _this;
  40571. }
  40572. return TransportPriorityTooLow;
  40573. }(Error));
  40574. var TransportClosed = (function (_super) {
  40575. errors_extends(TransportClosed, _super);
  40576. function TransportClosed(msg) {
  40577. var _newTarget = this.constructor;
  40578. var _this = _super.call(this, msg) || this;
  40579. Object.setPrototypeOf(_this, _newTarget.prototype);
  40580. return _this;
  40581. }
  40582. return TransportClosed;
  40583. }(Error));
  40584. var UnsupportedFeature = (function (_super) {
  40585. errors_extends(UnsupportedFeature, _super);
  40586. function UnsupportedFeature(msg) {
  40587. var _newTarget = this.constructor;
  40588. var _this = _super.call(this, msg) || this;
  40589. Object.setPrototypeOf(_this, _newTarget.prototype);
  40590. return _this;
  40591. }
  40592. return UnsupportedFeature;
  40593. }(Error));
  40594. var UnsupportedTransport = (function (_super) {
  40595. errors_extends(UnsupportedTransport, _super);
  40596. function UnsupportedTransport(msg) {
  40597. var _newTarget = this.constructor;
  40598. var _this = _super.call(this, msg) || this;
  40599. Object.setPrototypeOf(_this, _newTarget.prototype);
  40600. return _this;
  40601. }
  40602. return UnsupportedTransport;
  40603. }(Error));
  40604. var UnsupportedStrategy = (function (_super) {
  40605. errors_extends(UnsupportedStrategy, _super);
  40606. function UnsupportedStrategy(msg) {
  40607. var _newTarget = this.constructor;
  40608. var _this = _super.call(this, msg) || this;
  40609. Object.setPrototypeOf(_this, _newTarget.prototype);
  40610. return _this;
  40611. }
  40612. return UnsupportedStrategy;
  40613. }(Error));
  40614. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40615. var channel_extends = (undefined && undefined.__extends) || (function () {
  40616. var extendStatics = function (d, b) {
  40617. extendStatics = Object.setPrototypeOf ||
  40618. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40619. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40620. return extendStatics(d, b);
  40621. };
  40622. return function (d, b) {
  40623. extendStatics(d, b);
  40624. function __() { this.constructor = d; }
  40625. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40626. };
  40627. })();
  40628. var channel_Channel = (function (_super) {
  40629. channel_extends(Channel, _super);
  40630. function Channel(name, pusher) {
  40631. var _this = _super.call(this, function (event, data) {
  40632. logger.debug('No callbacks on ' + name + ' for ' + event);
  40633. }) || this;
  40634. _this.name = name;
  40635. _this.pusher = pusher;
  40636. _this.subscribed = false;
  40637. _this.subscriptionPending = false;
  40638. _this.subscriptionCancelled = false;
  40639. return _this;
  40640. }
  40641. Channel.prototype.authorize = function (socketId, callback) {
  40642. return callback(false, {});
  40643. };
  40644. Channel.prototype.trigger = function (event, data) {
  40645. if (event.indexOf("client-") !== 0) {
  40646. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40647. }
  40648. if (!this.subscribed) {
  40649. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40650. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40651. }
  40652. return this.pusher.send_event(event, data, this.name);
  40653. };
  40654. Channel.prototype.disconnect = function () {
  40655. this.subscribed = false;
  40656. this.subscriptionPending = false;
  40657. };
  40658. Channel.prototype.handleEvent = function (event) {
  40659. var eventName = event.event;
  40660. var data = event.data;
  40661. if (eventName === "pusher_internal:subscription_succeeded") {
  40662. this.handleSubscriptionSucceededEvent(event);
  40663. }
  40664. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40665. var metadata = {};
  40666. this.emit(eventName, data, metadata);
  40667. }
  40668. };
  40669. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40670. this.subscriptionPending = false;
  40671. this.subscribed = true;
  40672. if (this.subscriptionCancelled) {
  40673. this.pusher.unsubscribe(this.name);
  40674. }
  40675. else {
  40676. this.emit("pusher:subscription_succeeded", event.data);
  40677. }
  40678. };
  40679. Channel.prototype.subscribe = function () {
  40680. var _this = this;
  40681. if (this.subscribed) {
  40682. return;
  40683. }
  40684. this.subscriptionPending = true;
  40685. this.subscriptionCancelled = false;
  40686. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40687. if (error) {
  40688. logger.error(data);
  40689. _this.emit('pusher:subscription_error', data);
  40690. }
  40691. else {
  40692. _this.pusher.send_event('pusher:subscribe', {
  40693. auth: data.auth,
  40694. channel_data: data.channel_data,
  40695. channel: _this.name
  40696. });
  40697. }
  40698. });
  40699. };
  40700. Channel.prototype.unsubscribe = function () {
  40701. this.subscribed = false;
  40702. this.pusher.send_event('pusher:unsubscribe', {
  40703. channel: this.name
  40704. });
  40705. };
  40706. Channel.prototype.cancelSubscription = function () {
  40707. this.subscriptionCancelled = true;
  40708. };
  40709. Channel.prototype.reinstateSubscription = function () {
  40710. this.subscriptionCancelled = false;
  40711. };
  40712. return Channel;
  40713. }(dispatcher));
  40714. /* harmony default export */ var channels_channel = (channel_Channel);
  40715. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40716. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40717. var extendStatics = function (d, b) {
  40718. extendStatics = Object.setPrototypeOf ||
  40719. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40720. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40721. return extendStatics(d, b);
  40722. };
  40723. return function (d, b) {
  40724. extendStatics(d, b);
  40725. function __() { this.constructor = d; }
  40726. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40727. };
  40728. })();
  40729. var private_channel_PrivateChannel = (function (_super) {
  40730. private_channel_extends(PrivateChannel, _super);
  40731. function PrivateChannel() {
  40732. return _super !== null && _super.apply(this, arguments) || this;
  40733. }
  40734. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40735. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40736. return authorizer.authorize(socketId, callback);
  40737. };
  40738. return PrivateChannel;
  40739. }(channels_channel));
  40740. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40741. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40742. var members_Members = (function () {
  40743. function Members() {
  40744. this.reset();
  40745. }
  40746. Members.prototype.get = function (id) {
  40747. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40748. return {
  40749. id: id,
  40750. info: this.members[id]
  40751. };
  40752. }
  40753. else {
  40754. return null;
  40755. }
  40756. };
  40757. Members.prototype.each = function (callback) {
  40758. var _this = this;
  40759. objectApply(this.members, function (member, id) {
  40760. callback(_this.get(id));
  40761. });
  40762. };
  40763. Members.prototype.setMyID = function (id) {
  40764. this.myID = id;
  40765. };
  40766. Members.prototype.onSubscription = function (subscriptionData) {
  40767. this.members = subscriptionData.presence.hash;
  40768. this.count = subscriptionData.presence.count;
  40769. this.me = this.get(this.myID);
  40770. };
  40771. Members.prototype.addMember = function (memberData) {
  40772. if (this.get(memberData.user_id) === null) {
  40773. this.count++;
  40774. }
  40775. this.members[memberData.user_id] = memberData.user_info;
  40776. return this.get(memberData.user_id);
  40777. };
  40778. Members.prototype.removeMember = function (memberData) {
  40779. var member = this.get(memberData.user_id);
  40780. if (member) {
  40781. delete this.members[memberData.user_id];
  40782. this.count--;
  40783. }
  40784. return member;
  40785. };
  40786. Members.prototype.reset = function () {
  40787. this.members = {};
  40788. this.count = 0;
  40789. this.myID = null;
  40790. this.me = null;
  40791. };
  40792. return Members;
  40793. }());
  40794. /* harmony default export */ var members = (members_Members);
  40795. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40796. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40797. var extendStatics = function (d, b) {
  40798. extendStatics = Object.setPrototypeOf ||
  40799. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40800. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40801. return extendStatics(d, b);
  40802. };
  40803. return function (d, b) {
  40804. extendStatics(d, b);
  40805. function __() { this.constructor = d; }
  40806. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40807. };
  40808. })();
  40809. var presence_channel_PresenceChannel = (function (_super) {
  40810. presence_channel_extends(PresenceChannel, _super);
  40811. function PresenceChannel(name, pusher) {
  40812. var _this = _super.call(this, name, pusher) || this;
  40813. _this.members = new members();
  40814. return _this;
  40815. }
  40816. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40817. var _this = this;
  40818. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40819. if (!error) {
  40820. if (authData.channel_data === undefined) {
  40821. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40822. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40823. ("expected 'channel_data' field. " + suffix));
  40824. callback("Invalid auth response");
  40825. return;
  40826. }
  40827. var channelData = JSON.parse(authData.channel_data);
  40828. _this.members.setMyID(channelData.user_id);
  40829. }
  40830. callback(error, authData);
  40831. });
  40832. };
  40833. PresenceChannel.prototype.handleEvent = function (event) {
  40834. var eventName = event.event;
  40835. if (eventName.indexOf("pusher_internal:") === 0) {
  40836. this.handleInternalEvent(event);
  40837. }
  40838. else {
  40839. var data = event.data;
  40840. var metadata = {};
  40841. if (event.user_id) {
  40842. metadata.user_id = event.user_id;
  40843. }
  40844. this.emit(eventName, data, metadata);
  40845. }
  40846. };
  40847. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40848. var eventName = event.event;
  40849. var data = event.data;
  40850. switch (eventName) {
  40851. case "pusher_internal:subscription_succeeded":
  40852. this.handleSubscriptionSucceededEvent(event);
  40853. break;
  40854. case "pusher_internal:member_added":
  40855. var addedMember = this.members.addMember(data);
  40856. this.emit('pusher:member_added', addedMember);
  40857. break;
  40858. case "pusher_internal:member_removed":
  40859. var removedMember = this.members.removeMember(data);
  40860. if (removedMember) {
  40861. this.emit('pusher:member_removed', removedMember);
  40862. }
  40863. break;
  40864. }
  40865. };
  40866. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40867. this.subscriptionPending = false;
  40868. this.subscribed = true;
  40869. if (this.subscriptionCancelled) {
  40870. this.pusher.unsubscribe(this.name);
  40871. }
  40872. else {
  40873. this.members.onSubscription(event.data);
  40874. this.emit("pusher:subscription_succeeded", this.members);
  40875. }
  40876. };
  40877. PresenceChannel.prototype.disconnect = function () {
  40878. this.members.reset();
  40879. _super.prototype.disconnect.call(this);
  40880. };
  40881. return PresenceChannel;
  40882. }(private_channel));
  40883. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40884. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40885. var nacl_fast = __webpack_require__(0);
  40886. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40887. var nacl_util = __webpack_require__(1);
  40888. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40889. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40890. var extendStatics = function (d, b) {
  40891. extendStatics = Object.setPrototypeOf ||
  40892. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40893. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40894. return extendStatics(d, b);
  40895. };
  40896. return function (d, b) {
  40897. extendStatics(d, b);
  40898. function __() { this.constructor = d; }
  40899. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40900. };
  40901. })();
  40902. var encrypted_channel_EncryptedChannel = (function (_super) {
  40903. encrypted_channel_extends(EncryptedChannel, _super);
  40904. function EncryptedChannel() {
  40905. var _this = _super !== null && _super.apply(this, arguments) || this;
  40906. _this.key = null;
  40907. return _this;
  40908. }
  40909. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40910. var _this = this;
  40911. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40912. if (error) {
  40913. callback(true, authData);
  40914. return;
  40915. }
  40916. var sharedSecret = authData["shared_secret"];
  40917. if (!sharedSecret) {
  40918. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40919. callback(true, errorMsg);
  40920. return;
  40921. }
  40922. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40923. delete authData["shared_secret"];
  40924. callback(false, authData);
  40925. });
  40926. };
  40927. EncryptedChannel.prototype.trigger = function (event, data) {
  40928. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40929. };
  40930. EncryptedChannel.prototype.handleEvent = function (event) {
  40931. var eventName = event.event;
  40932. var data = event.data;
  40933. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40934. _super.prototype.handleEvent.call(this, event);
  40935. return;
  40936. }
  40937. this.handleEncryptedEvent(eventName, data);
  40938. };
  40939. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40940. var _this = this;
  40941. if (!this.key) {
  40942. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40943. return;
  40944. }
  40945. if (!data.ciphertext || !data.nonce) {
  40946. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40947. return;
  40948. }
  40949. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40950. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40951. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40952. return;
  40953. }
  40954. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40955. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40956. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40957. return;
  40958. }
  40959. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40960. if (bytes === null) {
  40961. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40962. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40963. if (error) {
  40964. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40965. return;
  40966. }
  40967. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40968. if (bytes === null) {
  40969. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40970. return;
  40971. }
  40972. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40973. return;
  40974. });
  40975. return;
  40976. }
  40977. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40978. };
  40979. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40980. try {
  40981. this.emit(eventName, JSON.parse(data));
  40982. }
  40983. catch (e) {
  40984. this.emit(eventName, data);
  40985. }
  40986. return this;
  40987. };
  40988. return EncryptedChannel;
  40989. }(private_channel));
  40990. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40991. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40992. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40993. var extendStatics = function (d, b) {
  40994. extendStatics = Object.setPrototypeOf ||
  40995. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40996. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40997. return extendStatics(d, b);
  40998. };
  40999. return function (d, b) {
  41000. extendStatics(d, b);
  41001. function __() { this.constructor = d; }
  41002. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41003. };
  41004. })();
  41005. var connection_manager_ConnectionManager = (function (_super) {
  41006. connection_manager_extends(ConnectionManager, _super);
  41007. function ConnectionManager(key, options) {
  41008. var _this = _super.call(this) || this;
  41009. _this.key = key;
  41010. _this.options = options || {};
  41011. _this.state = "initialized";
  41012. _this.connection = null;
  41013. _this.usingTLS = !!options.useTLS;
  41014. _this.timeline = _this.options.timeline;
  41015. _this.errorCallbacks = _this.buildErrorCallbacks();
  41016. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41017. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41018. var Network = runtime.getNetwork();
  41019. Network.bind("online", function () {
  41020. _this.timeline.info({ netinfo: "online" });
  41021. if (_this.state === "connecting" || _this.state === "unavailable") {
  41022. _this.retryIn(0);
  41023. }
  41024. });
  41025. Network.bind("offline", function () {
  41026. _this.timeline.info({ netinfo: "offline" });
  41027. if (_this.connection) {
  41028. _this.sendActivityCheck();
  41029. }
  41030. });
  41031. _this.updateStrategy();
  41032. return _this;
  41033. }
  41034. ConnectionManager.prototype.connect = function () {
  41035. if (this.connection || this.runner) {
  41036. return;
  41037. }
  41038. if (!this.strategy.isSupported()) {
  41039. this.updateState("failed");
  41040. return;
  41041. }
  41042. this.updateState("connecting");
  41043. this.startConnecting();
  41044. this.setUnavailableTimer();
  41045. };
  41046. ;
  41047. ConnectionManager.prototype.send = function (data) {
  41048. if (this.connection) {
  41049. return this.connection.send(data);
  41050. }
  41051. else {
  41052. return false;
  41053. }
  41054. };
  41055. ;
  41056. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41057. if (this.connection) {
  41058. return this.connection.send_event(name, data, channel);
  41059. }
  41060. else {
  41061. return false;
  41062. }
  41063. };
  41064. ;
  41065. ConnectionManager.prototype.disconnect = function () {
  41066. this.disconnectInternally();
  41067. this.updateState("disconnected");
  41068. };
  41069. ;
  41070. ConnectionManager.prototype.isUsingTLS = function () {
  41071. return this.usingTLS;
  41072. };
  41073. ;
  41074. ConnectionManager.prototype.startConnecting = function () {
  41075. var _this = this;
  41076. var callback = function (error, handshake) {
  41077. if (error) {
  41078. _this.runner = _this.strategy.connect(0, callback);
  41079. }
  41080. else {
  41081. if (handshake.action === "error") {
  41082. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41083. _this.timeline.error({ handshakeError: handshake.error });
  41084. }
  41085. else {
  41086. _this.abortConnecting();
  41087. _this.handshakeCallbacks[handshake.action](handshake);
  41088. }
  41089. }
  41090. };
  41091. this.runner = this.strategy.connect(0, callback);
  41092. };
  41093. ;
  41094. ConnectionManager.prototype.abortConnecting = function () {
  41095. if (this.runner) {
  41096. this.runner.abort();
  41097. this.runner = null;
  41098. }
  41099. };
  41100. ;
  41101. ConnectionManager.prototype.disconnectInternally = function () {
  41102. this.abortConnecting();
  41103. this.clearRetryTimer();
  41104. this.clearUnavailableTimer();
  41105. if (this.connection) {
  41106. var connection = this.abandonConnection();
  41107. connection.close();
  41108. }
  41109. };
  41110. ;
  41111. ConnectionManager.prototype.updateStrategy = function () {
  41112. this.strategy = this.options.getStrategy({
  41113. key: this.key,
  41114. timeline: this.timeline,
  41115. useTLS: this.usingTLS
  41116. });
  41117. };
  41118. ;
  41119. ConnectionManager.prototype.retryIn = function (delay) {
  41120. var _this = this;
  41121. this.timeline.info({ action: "retry", delay: delay });
  41122. if (delay > 0) {
  41123. this.emit("connecting_in", Math.round(delay / 1000));
  41124. }
  41125. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41126. _this.disconnectInternally();
  41127. _this.connect();
  41128. });
  41129. };
  41130. ;
  41131. ConnectionManager.prototype.clearRetryTimer = function () {
  41132. if (this.retryTimer) {
  41133. this.retryTimer.ensureAborted();
  41134. this.retryTimer = null;
  41135. }
  41136. };
  41137. ;
  41138. ConnectionManager.prototype.setUnavailableTimer = function () {
  41139. var _this = this;
  41140. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41141. _this.updateState("unavailable");
  41142. });
  41143. };
  41144. ;
  41145. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41146. if (this.unavailableTimer) {
  41147. this.unavailableTimer.ensureAborted();
  41148. }
  41149. };
  41150. ;
  41151. ConnectionManager.prototype.sendActivityCheck = function () {
  41152. var _this = this;
  41153. this.stopActivityCheck();
  41154. this.connection.ping();
  41155. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41156. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41157. _this.retryIn(0);
  41158. });
  41159. };
  41160. ;
  41161. ConnectionManager.prototype.resetActivityCheck = function () {
  41162. var _this = this;
  41163. this.stopActivityCheck();
  41164. if (this.connection && !this.connection.handlesActivityChecks()) {
  41165. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41166. _this.sendActivityCheck();
  41167. });
  41168. }
  41169. };
  41170. ;
  41171. ConnectionManager.prototype.stopActivityCheck = function () {
  41172. if (this.activityTimer) {
  41173. this.activityTimer.ensureAborted();
  41174. }
  41175. };
  41176. ;
  41177. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41178. var _this = this;
  41179. return extend({}, errorCallbacks, {
  41180. message: function (message) {
  41181. _this.resetActivityCheck();
  41182. _this.emit('message', message);
  41183. },
  41184. ping: function () {
  41185. _this.send_event('pusher:pong', {});
  41186. },
  41187. activity: function () {
  41188. _this.resetActivityCheck();
  41189. },
  41190. error: function (error) {
  41191. _this.emit("error", { type: "WebSocketError", error: error });
  41192. },
  41193. closed: function () {
  41194. _this.abandonConnection();
  41195. if (_this.shouldRetry()) {
  41196. _this.retryIn(1000);
  41197. }
  41198. }
  41199. });
  41200. };
  41201. ;
  41202. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41203. var _this = this;
  41204. return extend({}, errorCallbacks, {
  41205. connected: function (handshake) {
  41206. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41207. _this.clearUnavailableTimer();
  41208. _this.setConnection(handshake.connection);
  41209. _this.socket_id = _this.connection.id;
  41210. _this.updateState("connected", { socket_id: _this.socket_id });
  41211. }
  41212. });
  41213. };
  41214. ;
  41215. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41216. var _this = this;
  41217. var withErrorEmitted = function (callback) {
  41218. return function (result) {
  41219. if (result.error) {
  41220. _this.emit("error", { type: "WebSocketError", error: result.error });
  41221. }
  41222. callback(result);
  41223. };
  41224. };
  41225. return {
  41226. tls_only: withErrorEmitted(function () {
  41227. _this.usingTLS = true;
  41228. _this.updateStrategy();
  41229. _this.retryIn(0);
  41230. }),
  41231. refused: withErrorEmitted(function () {
  41232. _this.disconnect();
  41233. }),
  41234. backoff: withErrorEmitted(function () {
  41235. _this.retryIn(1000);
  41236. }),
  41237. retry: withErrorEmitted(function () {
  41238. _this.retryIn(0);
  41239. })
  41240. };
  41241. };
  41242. ;
  41243. ConnectionManager.prototype.setConnection = function (connection) {
  41244. this.connection = connection;
  41245. for (var event in this.connectionCallbacks) {
  41246. this.connection.bind(event, this.connectionCallbacks[event]);
  41247. }
  41248. this.resetActivityCheck();
  41249. };
  41250. ;
  41251. ConnectionManager.prototype.abandonConnection = function () {
  41252. if (!this.connection) {
  41253. return;
  41254. }
  41255. this.stopActivityCheck();
  41256. for (var event in this.connectionCallbacks) {
  41257. this.connection.unbind(event, this.connectionCallbacks[event]);
  41258. }
  41259. var connection = this.connection;
  41260. this.connection = null;
  41261. return connection;
  41262. };
  41263. ConnectionManager.prototype.updateState = function (newState, data) {
  41264. var previousState = this.state;
  41265. this.state = newState;
  41266. if (previousState !== newState) {
  41267. var newStateDescription = newState;
  41268. if (newStateDescription === "connected") {
  41269. newStateDescription += " with new socket ID " + data.socket_id;
  41270. }
  41271. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41272. this.timeline.info({ state: newState, params: data });
  41273. this.emit('state_change', { previous: previousState, current: newState });
  41274. this.emit(newState, data);
  41275. }
  41276. };
  41277. ConnectionManager.prototype.shouldRetry = function () {
  41278. return this.state === "connecting" || this.state === "connected";
  41279. };
  41280. return ConnectionManager;
  41281. }(dispatcher));
  41282. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41283. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41284. var channels_Channels = (function () {
  41285. function Channels() {
  41286. this.channels = {};
  41287. }
  41288. Channels.prototype.add = function (name, pusher) {
  41289. if (!this.channels[name]) {
  41290. this.channels[name] = createChannel(name, pusher);
  41291. }
  41292. return this.channels[name];
  41293. };
  41294. Channels.prototype.all = function () {
  41295. return values(this.channels);
  41296. };
  41297. Channels.prototype.find = function (name) {
  41298. return this.channels[name];
  41299. };
  41300. Channels.prototype.remove = function (name) {
  41301. var channel = this.channels[name];
  41302. delete this.channels[name];
  41303. return channel;
  41304. };
  41305. Channels.prototype.disconnect = function () {
  41306. objectApply(this.channels, function (channel) {
  41307. channel.disconnect();
  41308. });
  41309. };
  41310. return Channels;
  41311. }());
  41312. /* harmony default export */ var channels = (channels_Channels);
  41313. function createChannel(name, pusher) {
  41314. if (name.indexOf('private-encrypted-') === 0) {
  41315. if (false) { var errorMsg; }
  41316. return factory.createEncryptedChannel(name, pusher);
  41317. }
  41318. else if (name.indexOf('private-') === 0) {
  41319. return factory.createPrivateChannel(name, pusher);
  41320. }
  41321. else if (name.indexOf('presence-') === 0) {
  41322. return factory.createPresenceChannel(name, pusher);
  41323. }
  41324. else {
  41325. return factory.createChannel(name, pusher);
  41326. }
  41327. }
  41328. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41329. var Factory = {
  41330. createChannels: function () {
  41331. return new channels();
  41332. },
  41333. createConnectionManager: function (key, options) {
  41334. return new connection_manager(key, options);
  41335. },
  41336. createChannel: function (name, pusher) {
  41337. return new channels_channel(name, pusher);
  41338. },
  41339. createPrivateChannel: function (name, pusher) {
  41340. return new private_channel(name, pusher);
  41341. },
  41342. createPresenceChannel: function (name, pusher) {
  41343. return new presence_channel(name, pusher);
  41344. },
  41345. createEncryptedChannel: function (name, pusher) {
  41346. return new encrypted_channel(name, pusher);
  41347. },
  41348. createTimelineSender: function (timeline, options) {
  41349. return new timeline_sender(timeline, options);
  41350. },
  41351. createAuthorizer: function (channel, options) {
  41352. if (options.authorizer) {
  41353. return options.authorizer(channel, options);
  41354. }
  41355. return new pusher_authorizer(channel, options);
  41356. },
  41357. createHandshake: function (transport, callback) {
  41358. return new connection_handshake(transport, callback);
  41359. },
  41360. createAssistantToTheTransportManager: function (manager, transport, options) {
  41361. return new assistant_to_the_transport_manager(manager, transport, options);
  41362. }
  41363. };
  41364. /* harmony default export */ var factory = (Factory);
  41365. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41366. var transport_manager_TransportManager = (function () {
  41367. function TransportManager(options) {
  41368. this.options = options || {};
  41369. this.livesLeft = this.options.lives || Infinity;
  41370. }
  41371. TransportManager.prototype.getAssistant = function (transport) {
  41372. return factory.createAssistantToTheTransportManager(this, transport, {
  41373. minPingDelay: this.options.minPingDelay,
  41374. maxPingDelay: this.options.maxPingDelay
  41375. });
  41376. };
  41377. TransportManager.prototype.isAlive = function () {
  41378. return this.livesLeft > 0;
  41379. };
  41380. TransportManager.prototype.reportDeath = function () {
  41381. this.livesLeft -= 1;
  41382. };
  41383. return TransportManager;
  41384. }());
  41385. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41386. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41387. var sequential_strategy_SequentialStrategy = (function () {
  41388. function SequentialStrategy(strategies, options) {
  41389. this.strategies = strategies;
  41390. this.loop = Boolean(options.loop);
  41391. this.failFast = Boolean(options.failFast);
  41392. this.timeout = options.timeout;
  41393. this.timeoutLimit = options.timeoutLimit;
  41394. }
  41395. SequentialStrategy.prototype.isSupported = function () {
  41396. return any(this.strategies, util.method("isSupported"));
  41397. };
  41398. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41399. var _this = this;
  41400. var strategies = this.strategies;
  41401. var current = 0;
  41402. var timeout = this.timeout;
  41403. var runner = null;
  41404. var tryNextStrategy = function (error, handshake) {
  41405. if (handshake) {
  41406. callback(null, handshake);
  41407. }
  41408. else {
  41409. current = current + 1;
  41410. if (_this.loop) {
  41411. current = current % strategies.length;
  41412. }
  41413. if (current < strategies.length) {
  41414. if (timeout) {
  41415. timeout = timeout * 2;
  41416. if (_this.timeoutLimit) {
  41417. timeout = Math.min(timeout, _this.timeoutLimit);
  41418. }
  41419. }
  41420. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41421. }
  41422. else {
  41423. callback(true);
  41424. }
  41425. }
  41426. };
  41427. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41428. return {
  41429. abort: function () {
  41430. runner.abort();
  41431. },
  41432. forceMinPriority: function (p) {
  41433. minPriority = p;
  41434. if (runner) {
  41435. runner.forceMinPriority(p);
  41436. }
  41437. }
  41438. };
  41439. };
  41440. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41441. var timer = null;
  41442. var runner = null;
  41443. if (options.timeout > 0) {
  41444. timer = new OneOffTimer(options.timeout, function () {
  41445. runner.abort();
  41446. callback(true);
  41447. });
  41448. }
  41449. runner = strategy.connect(minPriority, function (error, handshake) {
  41450. if (error && timer && timer.isRunning() && !options.failFast) {
  41451. return;
  41452. }
  41453. if (timer) {
  41454. timer.ensureAborted();
  41455. }
  41456. callback(error, handshake);
  41457. });
  41458. return {
  41459. abort: function () {
  41460. if (timer) {
  41461. timer.ensureAborted();
  41462. }
  41463. runner.abort();
  41464. },
  41465. forceMinPriority: function (p) {
  41466. runner.forceMinPriority(p);
  41467. }
  41468. };
  41469. };
  41470. return SequentialStrategy;
  41471. }());
  41472. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41473. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41474. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41475. function BestConnectedEverStrategy(strategies) {
  41476. this.strategies = strategies;
  41477. }
  41478. BestConnectedEverStrategy.prototype.isSupported = function () {
  41479. return any(this.strategies, util.method("isSupported"));
  41480. };
  41481. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41482. return connect(this.strategies, minPriority, function (i, runners) {
  41483. return function (error, handshake) {
  41484. runners[i].error = error;
  41485. if (error) {
  41486. if (allRunnersFailed(runners)) {
  41487. callback(true);
  41488. }
  41489. return;
  41490. }
  41491. apply(runners, function (runner) {
  41492. runner.forceMinPriority(handshake.transport.priority);
  41493. });
  41494. callback(null, handshake);
  41495. };
  41496. });
  41497. };
  41498. return BestConnectedEverStrategy;
  41499. }());
  41500. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41501. function connect(strategies, minPriority, callbackBuilder) {
  41502. var runners = map(strategies, function (strategy, i, _, rs) {
  41503. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41504. });
  41505. return {
  41506. abort: function () {
  41507. apply(runners, abortRunner);
  41508. },
  41509. forceMinPriority: function (p) {
  41510. apply(runners, function (runner) {
  41511. runner.forceMinPriority(p);
  41512. });
  41513. }
  41514. };
  41515. }
  41516. function allRunnersFailed(runners) {
  41517. return collections_all(runners, function (runner) {
  41518. return Boolean(runner.error);
  41519. });
  41520. }
  41521. function abortRunner(runner) {
  41522. if (!runner.error && !runner.aborted) {
  41523. runner.abort();
  41524. runner.aborted = true;
  41525. }
  41526. }
  41527. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41528. var cached_strategy_CachedStrategy = (function () {
  41529. function CachedStrategy(strategy, transports, options) {
  41530. this.strategy = strategy;
  41531. this.transports = transports;
  41532. this.ttl = options.ttl || 1800 * 1000;
  41533. this.usingTLS = options.useTLS;
  41534. this.timeline = options.timeline;
  41535. }
  41536. CachedStrategy.prototype.isSupported = function () {
  41537. return this.strategy.isSupported();
  41538. };
  41539. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41540. var usingTLS = this.usingTLS;
  41541. var info = fetchTransportCache(usingTLS);
  41542. var strategies = [this.strategy];
  41543. if (info && info.timestamp + this.ttl >= util.now()) {
  41544. var transport = this.transports[info.transport];
  41545. if (transport) {
  41546. this.timeline.info({
  41547. cached: true,
  41548. transport: info.transport,
  41549. latency: info.latency
  41550. });
  41551. strategies.push(new sequential_strategy([transport], {
  41552. timeout: info.latency * 2 + 1000,
  41553. failFast: true
  41554. }));
  41555. }
  41556. }
  41557. var startTimestamp = util.now();
  41558. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41559. if (error) {
  41560. flushTransportCache(usingTLS);
  41561. if (strategies.length > 0) {
  41562. startTimestamp = util.now();
  41563. runner = strategies.pop().connect(minPriority, cb);
  41564. }
  41565. else {
  41566. callback(error);
  41567. }
  41568. }
  41569. else {
  41570. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41571. callback(null, handshake);
  41572. }
  41573. });
  41574. return {
  41575. abort: function () {
  41576. runner.abort();
  41577. },
  41578. forceMinPriority: function (p) {
  41579. minPriority = p;
  41580. if (runner) {
  41581. runner.forceMinPriority(p);
  41582. }
  41583. }
  41584. };
  41585. };
  41586. return CachedStrategy;
  41587. }());
  41588. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41589. function getTransportCacheKey(usingTLS) {
  41590. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41591. }
  41592. function fetchTransportCache(usingTLS) {
  41593. var storage = runtime.getLocalStorage();
  41594. if (storage) {
  41595. try {
  41596. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41597. if (serializedCache) {
  41598. return JSON.parse(serializedCache);
  41599. }
  41600. }
  41601. catch (e) {
  41602. flushTransportCache(usingTLS);
  41603. }
  41604. }
  41605. return null;
  41606. }
  41607. function storeTransportCache(usingTLS, transport, latency) {
  41608. var storage = runtime.getLocalStorage();
  41609. if (storage) {
  41610. try {
  41611. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41612. timestamp: util.now(),
  41613. transport: transport,
  41614. latency: latency
  41615. });
  41616. }
  41617. catch (e) {
  41618. }
  41619. }
  41620. }
  41621. function flushTransportCache(usingTLS) {
  41622. var storage = runtime.getLocalStorage();
  41623. if (storage) {
  41624. try {
  41625. delete storage[getTransportCacheKey(usingTLS)];
  41626. }
  41627. catch (e) {
  41628. }
  41629. }
  41630. }
  41631. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41632. var delayed_strategy_DelayedStrategy = (function () {
  41633. function DelayedStrategy(strategy, _a) {
  41634. var number = _a.delay;
  41635. this.strategy = strategy;
  41636. this.options = { delay: number };
  41637. }
  41638. DelayedStrategy.prototype.isSupported = function () {
  41639. return this.strategy.isSupported();
  41640. };
  41641. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41642. var strategy = this.strategy;
  41643. var runner;
  41644. var timer = new OneOffTimer(this.options.delay, function () {
  41645. runner = strategy.connect(minPriority, callback);
  41646. });
  41647. return {
  41648. abort: function () {
  41649. timer.ensureAborted();
  41650. if (runner) {
  41651. runner.abort();
  41652. }
  41653. },
  41654. forceMinPriority: function (p) {
  41655. minPriority = p;
  41656. if (runner) {
  41657. runner.forceMinPriority(p);
  41658. }
  41659. }
  41660. };
  41661. };
  41662. return DelayedStrategy;
  41663. }());
  41664. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41665. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41666. var IfStrategy = (function () {
  41667. function IfStrategy(test, trueBranch, falseBranch) {
  41668. this.test = test;
  41669. this.trueBranch = trueBranch;
  41670. this.falseBranch = falseBranch;
  41671. }
  41672. IfStrategy.prototype.isSupported = function () {
  41673. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41674. return branch.isSupported();
  41675. };
  41676. IfStrategy.prototype.connect = function (minPriority, callback) {
  41677. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41678. return branch.connect(minPriority, callback);
  41679. };
  41680. return IfStrategy;
  41681. }());
  41682. /* harmony default export */ var if_strategy = (IfStrategy);
  41683. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41684. var FirstConnectedStrategy = (function () {
  41685. function FirstConnectedStrategy(strategy) {
  41686. this.strategy = strategy;
  41687. }
  41688. FirstConnectedStrategy.prototype.isSupported = function () {
  41689. return this.strategy.isSupported();
  41690. };
  41691. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41692. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41693. if (handshake) {
  41694. runner.abort();
  41695. }
  41696. callback(error, handshake);
  41697. });
  41698. return runner;
  41699. };
  41700. return FirstConnectedStrategy;
  41701. }());
  41702. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41703. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41704. function testSupportsStrategy(strategy) {
  41705. return function () {
  41706. return strategy.isSupported();
  41707. };
  41708. }
  41709. var getDefaultStrategy = function (config, defineTransport) {
  41710. var definedTransports = {};
  41711. function defineTransportStrategy(name, type, priority, options, manager) {
  41712. var transport = defineTransport(config, name, type, priority, options, manager);
  41713. definedTransports[name] = transport;
  41714. return transport;
  41715. }
  41716. var ws_options = {
  41717. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41718. hostTLS: config.wsHost + ":" + config.wssPort,
  41719. httpPath: config.wsPath
  41720. };
  41721. var wss_options = extend({}, ws_options, {
  41722. useTLS: true
  41723. });
  41724. var sockjs_options = {
  41725. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41726. hostTLS: config.httpHost + ":" + config.httpsPort,
  41727. httpPath: config.httpPath
  41728. };
  41729. var timeouts = {
  41730. loop: true,
  41731. timeout: 15000,
  41732. timeoutLimit: 60000
  41733. };
  41734. var ws_manager = new transport_manager({
  41735. lives: 2,
  41736. minPingDelay: 10000,
  41737. maxPingDelay: config.activity_timeout
  41738. });
  41739. var streaming_manager = new transport_manager({
  41740. lives: 2,
  41741. minPingDelay: 10000,
  41742. maxPingDelay: config.activity_timeout
  41743. });
  41744. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41745. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41746. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41747. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41748. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41749. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41750. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41751. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41752. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41753. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41754. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41755. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41756. 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);
  41757. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41758. var wsStrategy;
  41759. if (config.useTLS) {
  41760. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41761. }
  41762. else {
  41763. wsStrategy = new best_connected_ever_strategy([
  41764. ws_loop,
  41765. new delayed_strategy(wss_loop, { delay: 2000 }),
  41766. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41767. ]);
  41768. }
  41769. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41770. ttl: 1800000,
  41771. timeline: config.timeline,
  41772. useTLS: config.useTLS
  41773. });
  41774. };
  41775. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41776. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41777. /* harmony default export */ var transport_connection_initializer = (function () {
  41778. var self = this;
  41779. self.timeline.info(self.buildTimelineMessage({
  41780. transport: self.name + (self.options.useTLS ? "s" : "")
  41781. }));
  41782. if (self.hooks.isInitialized()) {
  41783. self.changeState("initialized");
  41784. }
  41785. else if (self.hooks.file) {
  41786. self.changeState("initializing");
  41787. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41788. if (self.hooks.isInitialized()) {
  41789. self.changeState("initialized");
  41790. callback(true);
  41791. }
  41792. else {
  41793. if (error) {
  41794. self.onError(error);
  41795. }
  41796. self.onClose();
  41797. callback(false);
  41798. }
  41799. });
  41800. }
  41801. else {
  41802. self.onClose();
  41803. }
  41804. });
  41805. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41806. var http_xdomain_request_hooks = {
  41807. getRequest: function (socket) {
  41808. var xdr = new window.XDomainRequest();
  41809. xdr.ontimeout = function () {
  41810. socket.emit("error", new RequestTimedOut());
  41811. socket.close();
  41812. };
  41813. xdr.onerror = function (e) {
  41814. socket.emit("error", e);
  41815. socket.close();
  41816. };
  41817. xdr.onprogress = function () {
  41818. if (xdr.responseText && xdr.responseText.length > 0) {
  41819. socket.onChunk(200, xdr.responseText);
  41820. }
  41821. };
  41822. xdr.onload = function () {
  41823. if (xdr.responseText && xdr.responseText.length > 0) {
  41824. socket.onChunk(200, xdr.responseText);
  41825. }
  41826. socket.emit("finished", 200);
  41827. socket.close();
  41828. };
  41829. return xdr;
  41830. },
  41831. abortRequest: function (xdr) {
  41832. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41833. xdr.abort();
  41834. }
  41835. };
  41836. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41837. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41838. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41839. var extendStatics = function (d, b) {
  41840. extendStatics = Object.setPrototypeOf ||
  41841. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41842. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41843. return extendStatics(d, b);
  41844. };
  41845. return function (d, b) {
  41846. extendStatics(d, b);
  41847. function __() { this.constructor = d; }
  41848. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41849. };
  41850. })();
  41851. var MAX_BUFFER_LENGTH = 256 * 1024;
  41852. var http_request_HTTPRequest = (function (_super) {
  41853. http_request_extends(HTTPRequest, _super);
  41854. function HTTPRequest(hooks, method, url) {
  41855. var _this = _super.call(this) || this;
  41856. _this.hooks = hooks;
  41857. _this.method = method;
  41858. _this.url = url;
  41859. return _this;
  41860. }
  41861. HTTPRequest.prototype.start = function (payload) {
  41862. var _this = this;
  41863. this.position = 0;
  41864. this.xhr = this.hooks.getRequest(this);
  41865. this.unloader = function () {
  41866. _this.close();
  41867. };
  41868. runtime.addUnloadListener(this.unloader);
  41869. this.xhr.open(this.method, this.url, true);
  41870. if (this.xhr.setRequestHeader) {
  41871. this.xhr.setRequestHeader("Content-Type", "application/json");
  41872. }
  41873. this.xhr.send(payload);
  41874. };
  41875. HTTPRequest.prototype.close = function () {
  41876. if (this.unloader) {
  41877. runtime.removeUnloadListener(this.unloader);
  41878. this.unloader = null;
  41879. }
  41880. if (this.xhr) {
  41881. this.hooks.abortRequest(this.xhr);
  41882. this.xhr = null;
  41883. }
  41884. };
  41885. HTTPRequest.prototype.onChunk = function (status, data) {
  41886. while (true) {
  41887. var chunk = this.advanceBuffer(data);
  41888. if (chunk) {
  41889. this.emit("chunk", { status: status, data: chunk });
  41890. }
  41891. else {
  41892. break;
  41893. }
  41894. }
  41895. if (this.isBufferTooLong(data)) {
  41896. this.emit("buffer_too_long");
  41897. }
  41898. };
  41899. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41900. var unreadData = buffer.slice(this.position);
  41901. var endOfLinePosition = unreadData.indexOf("\n");
  41902. if (endOfLinePosition !== -1) {
  41903. this.position += endOfLinePosition + 1;
  41904. return unreadData.slice(0, endOfLinePosition);
  41905. }
  41906. else {
  41907. return null;
  41908. }
  41909. };
  41910. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41911. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41912. };
  41913. return HTTPRequest;
  41914. }(dispatcher));
  41915. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41916. // CONCATENATED MODULE: ./src/core/http/state.ts
  41917. var State;
  41918. (function (State) {
  41919. State[State["CONNECTING"] = 0] = "CONNECTING";
  41920. State[State["OPEN"] = 1] = "OPEN";
  41921. State[State["CLOSED"] = 3] = "CLOSED";
  41922. })(State || (State = {}));
  41923. /* harmony default export */ var state = (State);
  41924. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41925. var autoIncrement = 1;
  41926. var http_socket_HTTPSocket = (function () {
  41927. function HTTPSocket(hooks, url) {
  41928. this.hooks = hooks;
  41929. this.session = randomNumber(1000) + "/" + randomString(8);
  41930. this.location = getLocation(url);
  41931. this.readyState = state.CONNECTING;
  41932. this.openStream();
  41933. }
  41934. HTTPSocket.prototype.send = function (payload) {
  41935. return this.sendRaw(JSON.stringify([payload]));
  41936. };
  41937. HTTPSocket.prototype.ping = function () {
  41938. this.hooks.sendHeartbeat(this);
  41939. };
  41940. HTTPSocket.prototype.close = function (code, reason) {
  41941. this.onClose(code, reason, true);
  41942. };
  41943. HTTPSocket.prototype.sendRaw = function (payload) {
  41944. if (this.readyState === state.OPEN) {
  41945. try {
  41946. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41947. return true;
  41948. }
  41949. catch (e) {
  41950. return false;
  41951. }
  41952. }
  41953. else {
  41954. return false;
  41955. }
  41956. };
  41957. HTTPSocket.prototype.reconnect = function () {
  41958. this.closeStream();
  41959. this.openStream();
  41960. };
  41961. ;
  41962. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41963. this.closeStream();
  41964. this.readyState = state.CLOSED;
  41965. if (this.onclose) {
  41966. this.onclose({
  41967. code: code,
  41968. reason: reason,
  41969. wasClean: wasClean
  41970. });
  41971. }
  41972. };
  41973. HTTPSocket.prototype.onChunk = function (chunk) {
  41974. if (chunk.status !== 200) {
  41975. return;
  41976. }
  41977. if (this.readyState === state.OPEN) {
  41978. this.onActivity();
  41979. }
  41980. var payload;
  41981. var type = chunk.data.slice(0, 1);
  41982. switch (type) {
  41983. case 'o':
  41984. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41985. this.onOpen(payload);
  41986. break;
  41987. case 'a':
  41988. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41989. for (var i = 0; i < payload.length; i++) {
  41990. this.onEvent(payload[i]);
  41991. }
  41992. break;
  41993. case 'm':
  41994. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41995. this.onEvent(payload);
  41996. break;
  41997. case 'h':
  41998. this.hooks.onHeartbeat(this);
  41999. break;
  42000. case 'c':
  42001. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42002. this.onClose(payload[0], payload[1], true);
  42003. break;
  42004. }
  42005. };
  42006. HTTPSocket.prototype.onOpen = function (options) {
  42007. if (this.readyState === state.CONNECTING) {
  42008. if (options && options.hostname) {
  42009. this.location.base = replaceHost(this.location.base, options.hostname);
  42010. }
  42011. this.readyState = state.OPEN;
  42012. if (this.onopen) {
  42013. this.onopen();
  42014. }
  42015. }
  42016. else {
  42017. this.onClose(1006, "Server lost session", true);
  42018. }
  42019. };
  42020. HTTPSocket.prototype.onEvent = function (event) {
  42021. if (this.readyState === state.OPEN && this.onmessage) {
  42022. this.onmessage({ data: event });
  42023. }
  42024. };
  42025. HTTPSocket.prototype.onActivity = function () {
  42026. if (this.onactivity) {
  42027. this.onactivity();
  42028. }
  42029. };
  42030. HTTPSocket.prototype.onError = function (error) {
  42031. if (this.onerror) {
  42032. this.onerror(error);
  42033. }
  42034. };
  42035. HTTPSocket.prototype.openStream = function () {
  42036. var _this = this;
  42037. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42038. this.stream.bind("chunk", function (chunk) {
  42039. _this.onChunk(chunk);
  42040. });
  42041. this.stream.bind("finished", function (status) {
  42042. _this.hooks.onFinished(_this, status);
  42043. });
  42044. this.stream.bind("buffer_too_long", function () {
  42045. _this.reconnect();
  42046. });
  42047. try {
  42048. this.stream.start();
  42049. }
  42050. catch (error) {
  42051. util.defer(function () {
  42052. _this.onError(error);
  42053. _this.onClose(1006, "Could not start streaming", false);
  42054. });
  42055. }
  42056. };
  42057. HTTPSocket.prototype.closeStream = function () {
  42058. if (this.stream) {
  42059. this.stream.unbind_all();
  42060. this.stream.close();
  42061. this.stream = null;
  42062. }
  42063. };
  42064. return HTTPSocket;
  42065. }());
  42066. function getLocation(url) {
  42067. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42068. return {
  42069. base: parts[1],
  42070. queryString: parts[2]
  42071. };
  42072. }
  42073. function getSendURL(url, session) {
  42074. return url.base + "/" + session + "/xhr_send";
  42075. }
  42076. function getUniqueURL(url) {
  42077. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42078. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42079. }
  42080. function replaceHost(url, hostname) {
  42081. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42082. return urlParts[1] + hostname + urlParts[3];
  42083. }
  42084. function randomNumber(max) {
  42085. return Math.floor(Math.random() * max);
  42086. }
  42087. function randomString(length) {
  42088. var result = [];
  42089. for (var i = 0; i < length; i++) {
  42090. result.push(randomNumber(32).toString(32));
  42091. }
  42092. return result.join('');
  42093. }
  42094. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42095. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42096. var http_streaming_socket_hooks = {
  42097. getReceiveURL: function (url, session) {
  42098. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42099. },
  42100. onHeartbeat: function (socket) {
  42101. socket.sendRaw("[]");
  42102. },
  42103. sendHeartbeat: function (socket) {
  42104. socket.sendRaw("[]");
  42105. },
  42106. onFinished: function (socket, status) {
  42107. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42108. }
  42109. };
  42110. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42111. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42112. var http_polling_socket_hooks = {
  42113. getReceiveURL: function (url, session) {
  42114. return url.base + "/" + session + "/xhr" + url.queryString;
  42115. },
  42116. onHeartbeat: function () {
  42117. },
  42118. sendHeartbeat: function (socket) {
  42119. socket.sendRaw("[]");
  42120. },
  42121. onFinished: function (socket, status) {
  42122. if (status === 200) {
  42123. socket.reconnect();
  42124. }
  42125. else {
  42126. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42127. }
  42128. }
  42129. };
  42130. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42131. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42132. var http_xhr_request_hooks = {
  42133. getRequest: function (socket) {
  42134. var Constructor = runtime.getXHRAPI();
  42135. var xhr = new Constructor();
  42136. xhr.onreadystatechange = xhr.onprogress = function () {
  42137. switch (xhr.readyState) {
  42138. case 3:
  42139. if (xhr.responseText && xhr.responseText.length > 0) {
  42140. socket.onChunk(xhr.status, xhr.responseText);
  42141. }
  42142. break;
  42143. case 4:
  42144. if (xhr.responseText && xhr.responseText.length > 0) {
  42145. socket.onChunk(xhr.status, xhr.responseText);
  42146. }
  42147. socket.emit("finished", xhr.status);
  42148. socket.close();
  42149. break;
  42150. }
  42151. };
  42152. return xhr;
  42153. },
  42154. abortRequest: function (xhr) {
  42155. xhr.onreadystatechange = null;
  42156. xhr.abort();
  42157. }
  42158. };
  42159. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42160. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42161. var HTTP = {
  42162. createStreamingSocket: function (url) {
  42163. return this.createSocket(http_streaming_socket, url);
  42164. },
  42165. createPollingSocket: function (url) {
  42166. return this.createSocket(http_polling_socket, url);
  42167. },
  42168. createSocket: function (hooks, url) {
  42169. return new http_socket(hooks, url);
  42170. },
  42171. createXHR: function (method, url) {
  42172. return this.createRequest(http_xhr_request, method, url);
  42173. },
  42174. createRequest: function (hooks, method, url) {
  42175. return new http_request(hooks, method, url);
  42176. }
  42177. };
  42178. /* harmony default export */ var http_http = (HTTP);
  42179. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42180. http_http.createXDR = function (method, url) {
  42181. return this.createRequest(http_xdomain_request, method, url);
  42182. };
  42183. /* harmony default export */ var web_http_http = (http_http);
  42184. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42185. var Runtime = {
  42186. nextAuthCallbackID: 1,
  42187. auth_callbacks: {},
  42188. ScriptReceivers: ScriptReceivers,
  42189. DependenciesReceivers: DependenciesReceivers,
  42190. getDefaultStrategy: default_strategy,
  42191. Transports: transports_transports,
  42192. transportConnectionInitializer: transport_connection_initializer,
  42193. HTTPFactory: web_http_http,
  42194. TimelineTransport: jsonp_timeline,
  42195. getXHRAPI: function () {
  42196. return window.XMLHttpRequest;
  42197. },
  42198. getWebSocketAPI: function () {
  42199. return window.WebSocket || window.MozWebSocket;
  42200. },
  42201. setup: function (PusherClass) {
  42202. var _this = this;
  42203. window.Pusher = PusherClass;
  42204. var initializeOnDocumentBody = function () {
  42205. _this.onDocumentBody(PusherClass.ready);
  42206. };
  42207. if (!window.JSON) {
  42208. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42209. }
  42210. else {
  42211. initializeOnDocumentBody();
  42212. }
  42213. },
  42214. getDocument: function () {
  42215. return document;
  42216. },
  42217. getProtocol: function () {
  42218. return this.getDocument().location.protocol;
  42219. },
  42220. getAuthorizers: function () {
  42221. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42222. },
  42223. onDocumentBody: function (callback) {
  42224. var _this = this;
  42225. if (document.body) {
  42226. callback();
  42227. }
  42228. else {
  42229. setTimeout(function () {
  42230. _this.onDocumentBody(callback);
  42231. }, 0);
  42232. }
  42233. },
  42234. createJSONPRequest: function (url, data) {
  42235. return new jsonp_request(url, data);
  42236. },
  42237. createScriptRequest: function (src) {
  42238. return new script_request(src);
  42239. },
  42240. getLocalStorage: function () {
  42241. try {
  42242. return window.localStorage;
  42243. }
  42244. catch (e) {
  42245. return undefined;
  42246. }
  42247. },
  42248. createXHR: function () {
  42249. if (this.getXHRAPI()) {
  42250. return this.createXMLHttpRequest();
  42251. }
  42252. else {
  42253. return this.createMicrosoftXHR();
  42254. }
  42255. },
  42256. createXMLHttpRequest: function () {
  42257. var Constructor = this.getXHRAPI();
  42258. return new Constructor();
  42259. },
  42260. createMicrosoftXHR: function () {
  42261. return new ActiveXObject("Microsoft.XMLHTTP");
  42262. },
  42263. getNetwork: function () {
  42264. return net_info_Network;
  42265. },
  42266. createWebSocket: function (url) {
  42267. var Constructor = this.getWebSocketAPI();
  42268. return new Constructor(url);
  42269. },
  42270. createSocketRequest: function (method, url) {
  42271. if (this.isXHRSupported()) {
  42272. return this.HTTPFactory.createXHR(method, url);
  42273. }
  42274. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42275. return this.HTTPFactory.createXDR(method, url);
  42276. }
  42277. else {
  42278. throw "Cross-origin HTTP requests are not supported";
  42279. }
  42280. },
  42281. isXHRSupported: function () {
  42282. var Constructor = this.getXHRAPI();
  42283. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42284. },
  42285. isXDRSupported: function (useTLS) {
  42286. var protocol = useTLS ? "https:" : "http:";
  42287. var documentProtocol = this.getProtocol();
  42288. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42289. },
  42290. addUnloadListener: function (listener) {
  42291. if (window.addEventListener !== undefined) {
  42292. window.addEventListener("unload", listener, false);
  42293. }
  42294. else if (window.attachEvent !== undefined) {
  42295. window.attachEvent("onunload", listener);
  42296. }
  42297. },
  42298. removeUnloadListener: function (listener) {
  42299. if (window.addEventListener !== undefined) {
  42300. window.removeEventListener("unload", listener, false);
  42301. }
  42302. else if (window.detachEvent !== undefined) {
  42303. window.detachEvent("onunload", listener);
  42304. }
  42305. }
  42306. };
  42307. /* harmony default export */ var runtime = (Runtime);
  42308. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42309. var TimelineLevel;
  42310. (function (TimelineLevel) {
  42311. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42312. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42313. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42314. })(TimelineLevel || (TimelineLevel = {}));
  42315. /* harmony default export */ var timeline_level = (TimelineLevel);
  42316. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42317. var timeline_Timeline = (function () {
  42318. function Timeline(key, session, options) {
  42319. this.key = key;
  42320. this.session = session;
  42321. this.events = [];
  42322. this.options = options || {};
  42323. this.sent = 0;
  42324. this.uniqueID = 0;
  42325. }
  42326. Timeline.prototype.log = function (level, event) {
  42327. if (level <= this.options.level) {
  42328. this.events.push(extend({}, event, { timestamp: util.now() }));
  42329. if (this.options.limit && this.events.length > this.options.limit) {
  42330. this.events.shift();
  42331. }
  42332. }
  42333. };
  42334. Timeline.prototype.error = function (event) {
  42335. this.log(timeline_level.ERROR, event);
  42336. };
  42337. Timeline.prototype.info = function (event) {
  42338. this.log(timeline_level.INFO, event);
  42339. };
  42340. Timeline.prototype.debug = function (event) {
  42341. this.log(timeline_level.DEBUG, event);
  42342. };
  42343. Timeline.prototype.isEmpty = function () {
  42344. return this.events.length === 0;
  42345. };
  42346. Timeline.prototype.send = function (sendfn, callback) {
  42347. var _this = this;
  42348. var data = extend({
  42349. session: this.session,
  42350. bundle: this.sent + 1,
  42351. key: this.key,
  42352. lib: "js",
  42353. version: this.options.version,
  42354. cluster: this.options.cluster,
  42355. features: this.options.features,
  42356. timeline: this.events
  42357. }, this.options.params);
  42358. this.events = [];
  42359. sendfn(data, function (error, result) {
  42360. if (!error) {
  42361. _this.sent++;
  42362. }
  42363. if (callback) {
  42364. callback(error, result);
  42365. }
  42366. });
  42367. return true;
  42368. };
  42369. Timeline.prototype.generateUniqueID = function () {
  42370. this.uniqueID++;
  42371. return this.uniqueID;
  42372. };
  42373. return Timeline;
  42374. }());
  42375. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42376. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42377. var transport_strategy_TransportStrategy = (function () {
  42378. function TransportStrategy(name, priority, transport, options) {
  42379. this.name = name;
  42380. this.priority = priority;
  42381. this.transport = transport;
  42382. this.options = options || {};
  42383. }
  42384. TransportStrategy.prototype.isSupported = function () {
  42385. return this.transport.isSupported({
  42386. useTLS: this.options.useTLS
  42387. });
  42388. };
  42389. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42390. var _this = this;
  42391. if (!this.isSupported()) {
  42392. return failAttempt(new UnsupportedStrategy(), callback);
  42393. }
  42394. else if (this.priority < minPriority) {
  42395. return failAttempt(new TransportPriorityTooLow(), callback);
  42396. }
  42397. var connected = false;
  42398. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42399. var handshake = null;
  42400. var onInitialized = function () {
  42401. transport.unbind("initialized", onInitialized);
  42402. transport.connect();
  42403. };
  42404. var onOpen = function () {
  42405. handshake = factory.createHandshake(transport, function (result) {
  42406. connected = true;
  42407. unbindListeners();
  42408. callback(null, result);
  42409. });
  42410. };
  42411. var onError = function (error) {
  42412. unbindListeners();
  42413. callback(error);
  42414. };
  42415. var onClosed = function () {
  42416. unbindListeners();
  42417. var serializedTransport;
  42418. serializedTransport = safeJSONStringify(transport);
  42419. callback(new TransportClosed(serializedTransport));
  42420. };
  42421. var unbindListeners = function () {
  42422. transport.unbind("initialized", onInitialized);
  42423. transport.unbind("open", onOpen);
  42424. transport.unbind("error", onError);
  42425. transport.unbind("closed", onClosed);
  42426. };
  42427. transport.bind("initialized", onInitialized);
  42428. transport.bind("open", onOpen);
  42429. transport.bind("error", onError);
  42430. transport.bind("closed", onClosed);
  42431. transport.initialize();
  42432. return {
  42433. abort: function () {
  42434. if (connected) {
  42435. return;
  42436. }
  42437. unbindListeners();
  42438. if (handshake) {
  42439. handshake.close();
  42440. }
  42441. else {
  42442. transport.close();
  42443. }
  42444. },
  42445. forceMinPriority: function (p) {
  42446. if (connected) {
  42447. return;
  42448. }
  42449. if (_this.priority < p) {
  42450. if (handshake) {
  42451. handshake.close();
  42452. }
  42453. else {
  42454. transport.close();
  42455. }
  42456. }
  42457. }
  42458. };
  42459. };
  42460. return TransportStrategy;
  42461. }());
  42462. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42463. function failAttempt(error, callback) {
  42464. util.defer(function () {
  42465. callback(error);
  42466. });
  42467. return {
  42468. abort: function () { },
  42469. forceMinPriority: function () { }
  42470. };
  42471. }
  42472. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42473. var strategy_builder_Transports = runtime.Transports;
  42474. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42475. var transportClass = strategy_builder_Transports[type];
  42476. if (!transportClass) {
  42477. throw new UnsupportedTransport(type);
  42478. }
  42479. var enabled = (!config.enabledTransports ||
  42480. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42481. (!config.disabledTransports ||
  42482. arrayIndexOf(config.disabledTransports, name) === -1);
  42483. var transport;
  42484. if (enabled) {
  42485. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42486. key: config.key,
  42487. useTLS: config.useTLS,
  42488. timeline: config.timeline,
  42489. ignoreNullOrigin: config.ignoreNullOrigin
  42490. }, options));
  42491. }
  42492. else {
  42493. transport = strategy_builder_UnsupportedStrategy;
  42494. }
  42495. return transport;
  42496. };
  42497. var strategy_builder_UnsupportedStrategy = {
  42498. isSupported: function () {
  42499. return false;
  42500. },
  42501. connect: function (_, callback) {
  42502. var deferred = util.defer(function () {
  42503. callback(new UnsupportedStrategy());
  42504. });
  42505. return {
  42506. abort: function () {
  42507. deferred.ensureAborted();
  42508. },
  42509. forceMinPriority: function () { }
  42510. };
  42511. }
  42512. };
  42513. // CONCATENATED MODULE: ./src/core/config.ts
  42514. var getGlobalConfig = function () {
  42515. return {
  42516. wsHost: defaults.host,
  42517. wsPort: defaults.ws_port,
  42518. wssPort: defaults.wss_port,
  42519. wsPath: defaults.ws_path,
  42520. httpHost: defaults.sockjs_host,
  42521. httpPort: defaults.sockjs_http_port,
  42522. httpsPort: defaults.sockjs_https_port,
  42523. httpPath: defaults.sockjs_path,
  42524. statsHost: defaults.stats_host,
  42525. authEndpoint: defaults.channel_auth_endpoint,
  42526. authTransport: defaults.channel_auth_transport,
  42527. activity_timeout: defaults.activity_timeout,
  42528. pong_timeout: defaults.pong_timeout,
  42529. unavailable_timeout: defaults.unavailable_timeout
  42530. };
  42531. };
  42532. var getClusterConfig = function (clusterName) {
  42533. return {
  42534. wsHost: 'ws-' + clusterName + '.pusher.com',
  42535. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42536. };
  42537. };
  42538. // CONCATENATED MODULE: ./src/core/pusher.ts
  42539. var pusher_Pusher = (function () {
  42540. function Pusher(app_key, options) {
  42541. var _this = this;
  42542. checkAppKey(app_key);
  42543. options = options || {};
  42544. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42545. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42546. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42547. }
  42548. this.key = app_key;
  42549. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42550. this.channels = factory.createChannels();
  42551. this.global_emitter = new dispatcher();
  42552. this.sessionID = Math.floor(Math.random() * 1000000000);
  42553. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42554. cluster: this.config.cluster,
  42555. features: Pusher.getClientFeatures(),
  42556. params: this.config.timelineParams || {},
  42557. limit: 50,
  42558. level: timeline_level.INFO,
  42559. version: defaults.VERSION
  42560. });
  42561. if (!this.config.disableStats) {
  42562. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42563. host: this.config.statsHost,
  42564. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42565. });
  42566. }
  42567. var getStrategy = function (options) {
  42568. var config = extend({}, _this.config, options);
  42569. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42570. };
  42571. this.connection = factory.createConnectionManager(this.key, extend({
  42572. getStrategy: getStrategy,
  42573. timeline: this.timeline,
  42574. activityTimeout: this.config.activity_timeout,
  42575. pongTimeout: this.config.pong_timeout,
  42576. unavailableTimeout: this.config.unavailable_timeout
  42577. }, this.config, { useTLS: this.shouldUseTLS() }));
  42578. this.connection.bind('connected', function () {
  42579. _this.subscribeAll();
  42580. if (_this.timelineSender) {
  42581. _this.timelineSender.send(_this.connection.isUsingTLS());
  42582. }
  42583. });
  42584. this.connection.bind('message', function (event) {
  42585. var eventName = event.event;
  42586. var internal = eventName.indexOf('pusher_internal:') === 0;
  42587. if (event.channel) {
  42588. var channel = _this.channel(event.channel);
  42589. if (channel) {
  42590. channel.handleEvent(event);
  42591. }
  42592. }
  42593. if (!internal) {
  42594. _this.global_emitter.emit(event.event, event.data);
  42595. }
  42596. });
  42597. this.connection.bind('connecting', function () {
  42598. _this.channels.disconnect();
  42599. });
  42600. this.connection.bind('disconnected', function () {
  42601. _this.channels.disconnect();
  42602. });
  42603. this.connection.bind('error', function (err) {
  42604. logger.warn(err);
  42605. });
  42606. Pusher.instances.push(this);
  42607. this.timeline.info({ instances: Pusher.instances.length });
  42608. if (Pusher.isReady) {
  42609. this.connect();
  42610. }
  42611. }
  42612. Pusher.ready = function () {
  42613. Pusher.isReady = true;
  42614. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42615. Pusher.instances[i].connect();
  42616. }
  42617. };
  42618. Pusher.getClientFeatures = function () {
  42619. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42620. return t.isSupported({});
  42621. }));
  42622. };
  42623. Pusher.prototype.channel = function (name) {
  42624. return this.channels.find(name);
  42625. };
  42626. Pusher.prototype.allChannels = function () {
  42627. return this.channels.all();
  42628. };
  42629. Pusher.prototype.connect = function () {
  42630. this.connection.connect();
  42631. if (this.timelineSender) {
  42632. if (!this.timelineSenderTimer) {
  42633. var usingTLS = this.connection.isUsingTLS();
  42634. var timelineSender = this.timelineSender;
  42635. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42636. timelineSender.send(usingTLS);
  42637. });
  42638. }
  42639. }
  42640. };
  42641. Pusher.prototype.disconnect = function () {
  42642. this.connection.disconnect();
  42643. if (this.timelineSenderTimer) {
  42644. this.timelineSenderTimer.ensureAborted();
  42645. this.timelineSenderTimer = null;
  42646. }
  42647. };
  42648. Pusher.prototype.bind = function (event_name, callback, context) {
  42649. this.global_emitter.bind(event_name, callback, context);
  42650. return this;
  42651. };
  42652. Pusher.prototype.unbind = function (event_name, callback, context) {
  42653. this.global_emitter.unbind(event_name, callback, context);
  42654. return this;
  42655. };
  42656. Pusher.prototype.bind_global = function (callback) {
  42657. this.global_emitter.bind_global(callback);
  42658. return this;
  42659. };
  42660. Pusher.prototype.unbind_global = function (callback) {
  42661. this.global_emitter.unbind_global(callback);
  42662. return this;
  42663. };
  42664. Pusher.prototype.unbind_all = function (callback) {
  42665. this.global_emitter.unbind_all();
  42666. return this;
  42667. };
  42668. Pusher.prototype.subscribeAll = function () {
  42669. var channelName;
  42670. for (channelName in this.channels.channels) {
  42671. if (this.channels.channels.hasOwnProperty(channelName)) {
  42672. this.subscribe(channelName);
  42673. }
  42674. }
  42675. };
  42676. Pusher.prototype.subscribe = function (channel_name) {
  42677. var channel = this.channels.add(channel_name, this);
  42678. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42679. channel.reinstateSubscription();
  42680. }
  42681. else if (!channel.subscriptionPending &&
  42682. this.connection.state === 'connected') {
  42683. channel.subscribe();
  42684. }
  42685. return channel;
  42686. };
  42687. Pusher.prototype.unsubscribe = function (channel_name) {
  42688. var channel = this.channels.find(channel_name);
  42689. if (channel && channel.subscriptionPending) {
  42690. channel.cancelSubscription();
  42691. }
  42692. else {
  42693. channel = this.channels.remove(channel_name);
  42694. if (channel && this.connection.state === 'connected') {
  42695. channel.unsubscribe();
  42696. }
  42697. }
  42698. };
  42699. Pusher.prototype.send_event = function (event_name, data, channel) {
  42700. return this.connection.send_event(event_name, data, channel);
  42701. };
  42702. Pusher.prototype.shouldUseTLS = function () {
  42703. if (runtime.getProtocol() === 'https:') {
  42704. return true;
  42705. }
  42706. else if (this.config.forceTLS === true) {
  42707. return true;
  42708. }
  42709. else {
  42710. return Boolean(this.config.encrypted);
  42711. }
  42712. };
  42713. Pusher.instances = [];
  42714. Pusher.isReady = false;
  42715. Pusher.logToConsole = false;
  42716. Pusher.Runtime = runtime;
  42717. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42718. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42719. Pusher.auth_callbacks = runtime.auth_callbacks;
  42720. return Pusher;
  42721. }());
  42722. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42723. function checkAppKey(key) {
  42724. if (key === null || key === undefined) {
  42725. throw 'You must pass your app key when you instantiate Pusher.';
  42726. }
  42727. }
  42728. runtime.setup(pusher_Pusher);
  42729. /***/ })
  42730. /******/ ]);
  42731. });
  42732. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42733. /***/ }),
  42734. /***/ "./node_modules/setimmediate/setImmediate.js":
  42735. /*!***************************************************!*\
  42736. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42737. \***************************************************/
  42738. /*! no static exports found */
  42739. /***/ (function(module, exports, __webpack_require__) {
  42740. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42741. "use strict";
  42742. if (global.setImmediate) {
  42743. return;
  42744. }
  42745. var nextHandle = 1; // Spec says greater than zero
  42746. var tasksByHandle = {};
  42747. var currentlyRunningATask = false;
  42748. var doc = global.document;
  42749. var registerImmediate;
  42750. function setImmediate(callback) {
  42751. // Callback can either be a function or a string
  42752. if (typeof callback !== "function") {
  42753. callback = new Function("" + callback);
  42754. }
  42755. // Copy function arguments
  42756. var args = new Array(arguments.length - 1);
  42757. for (var i = 0; i < args.length; i++) {
  42758. args[i] = arguments[i + 1];
  42759. }
  42760. // Store and register the task
  42761. var task = { callback: callback, args: args };
  42762. tasksByHandle[nextHandle] = task;
  42763. registerImmediate(nextHandle);
  42764. return nextHandle++;
  42765. }
  42766. function clearImmediate(handle) {
  42767. delete tasksByHandle[handle];
  42768. }
  42769. function run(task) {
  42770. var callback = task.callback;
  42771. var args = task.args;
  42772. switch (args.length) {
  42773. case 0:
  42774. callback();
  42775. break;
  42776. case 1:
  42777. callback(args[0]);
  42778. break;
  42779. case 2:
  42780. callback(args[0], args[1]);
  42781. break;
  42782. case 3:
  42783. callback(args[0], args[1], args[2]);
  42784. break;
  42785. default:
  42786. callback.apply(undefined, args);
  42787. break;
  42788. }
  42789. }
  42790. function runIfPresent(handle) {
  42791. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42792. // So if we're currently running a task, we'll need to delay this invocation.
  42793. if (currentlyRunningATask) {
  42794. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42795. // "too much recursion" error.
  42796. setTimeout(runIfPresent, 0, handle);
  42797. } else {
  42798. var task = tasksByHandle[handle];
  42799. if (task) {
  42800. currentlyRunningATask = true;
  42801. try {
  42802. run(task);
  42803. } finally {
  42804. clearImmediate(handle);
  42805. currentlyRunningATask = false;
  42806. }
  42807. }
  42808. }
  42809. }
  42810. function installNextTickImplementation() {
  42811. registerImmediate = function(handle) {
  42812. process.nextTick(function () { runIfPresent(handle); });
  42813. };
  42814. }
  42815. function canUsePostMessage() {
  42816. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42817. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42818. if (global.postMessage && !global.importScripts) {
  42819. var postMessageIsAsynchronous = true;
  42820. var oldOnMessage = global.onmessage;
  42821. global.onmessage = function() {
  42822. postMessageIsAsynchronous = false;
  42823. };
  42824. global.postMessage("", "*");
  42825. global.onmessage = oldOnMessage;
  42826. return postMessageIsAsynchronous;
  42827. }
  42828. }
  42829. function installPostMessageImplementation() {
  42830. // Installs an event handler on `global` for the `message` event: see
  42831. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42832. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42833. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42834. var onGlobalMessage = function(event) {
  42835. if (event.source === global &&
  42836. typeof event.data === "string" &&
  42837. event.data.indexOf(messagePrefix) === 0) {
  42838. runIfPresent(+event.data.slice(messagePrefix.length));
  42839. }
  42840. };
  42841. if (global.addEventListener) {
  42842. global.addEventListener("message", onGlobalMessage, false);
  42843. } else {
  42844. global.attachEvent("onmessage", onGlobalMessage);
  42845. }
  42846. registerImmediate = function(handle) {
  42847. global.postMessage(messagePrefix + handle, "*");
  42848. };
  42849. }
  42850. function installMessageChannelImplementation() {
  42851. var channel = new MessageChannel();
  42852. channel.port1.onmessage = function(event) {
  42853. var handle = event.data;
  42854. runIfPresent(handle);
  42855. };
  42856. registerImmediate = function(handle) {
  42857. channel.port2.postMessage(handle);
  42858. };
  42859. }
  42860. function installReadyStateChangeImplementation() {
  42861. var html = doc.documentElement;
  42862. registerImmediate = function(handle) {
  42863. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42864. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42865. var script = doc.createElement("script");
  42866. script.onreadystatechange = function () {
  42867. runIfPresent(handle);
  42868. script.onreadystatechange = null;
  42869. html.removeChild(script);
  42870. script = null;
  42871. };
  42872. html.appendChild(script);
  42873. };
  42874. }
  42875. function installSetTimeoutImplementation() {
  42876. registerImmediate = function(handle) {
  42877. setTimeout(runIfPresent, 0, handle);
  42878. };
  42879. }
  42880. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42881. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42882. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42883. // Don't get fooled by e.g. browserify environments.
  42884. if ({}.toString.call(global.process) === "[object process]") {
  42885. // For Node.js before 0.9
  42886. installNextTickImplementation();
  42887. } else if (canUsePostMessage()) {
  42888. // For non-IE10 modern browsers
  42889. installPostMessageImplementation();
  42890. } else if (global.MessageChannel) {
  42891. // For web workers, where supported
  42892. installMessageChannelImplementation();
  42893. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42894. // For IE 6–8
  42895. installReadyStateChangeImplementation();
  42896. } else {
  42897. // For older browsers
  42898. installSetTimeoutImplementation();
  42899. }
  42900. attachTo.setImmediate = setImmediate;
  42901. attachTo.clearImmediate = clearImmediate;
  42902. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42903. /* 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")))
  42904. /***/ }),
  42905. /***/ "./node_modules/timers-browserify/main.js":
  42906. /*!************************************************!*\
  42907. !*** ./node_modules/timers-browserify/main.js ***!
  42908. \************************************************/
  42909. /*! no static exports found */
  42910. /***/ (function(module, exports, __webpack_require__) {
  42911. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42912. (typeof self !== "undefined" && self) ||
  42913. window;
  42914. var apply = Function.prototype.apply;
  42915. // DOM APIs, for completeness
  42916. exports.setTimeout = function() {
  42917. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42918. };
  42919. exports.setInterval = function() {
  42920. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42921. };
  42922. exports.clearTimeout =
  42923. exports.clearInterval = function(timeout) {
  42924. if (timeout) {
  42925. timeout.close();
  42926. }
  42927. };
  42928. function Timeout(id, clearFn) {
  42929. this._id = id;
  42930. this._clearFn = clearFn;
  42931. }
  42932. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42933. Timeout.prototype.close = function() {
  42934. this._clearFn.call(scope, this._id);
  42935. };
  42936. // Does not start the time, just sets up the members needed.
  42937. exports.enroll = function(item, msecs) {
  42938. clearTimeout(item._idleTimeoutId);
  42939. item._idleTimeout = msecs;
  42940. };
  42941. exports.unenroll = function(item) {
  42942. clearTimeout(item._idleTimeoutId);
  42943. item._idleTimeout = -1;
  42944. };
  42945. exports._unrefActive = exports.active = function(item) {
  42946. clearTimeout(item._idleTimeoutId);
  42947. var msecs = item._idleTimeout;
  42948. if (msecs >= 0) {
  42949. item._idleTimeoutId = setTimeout(function onTimeout() {
  42950. if (item._onTimeout)
  42951. item._onTimeout();
  42952. }, msecs);
  42953. }
  42954. };
  42955. // setimmediate attaches itself to the global object
  42956. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42957. // On some exotic environments, it's not clear which object `setimmediate` was
  42958. // able to install onto. Search each possibility in the same order as the
  42959. // `setimmediate` library.
  42960. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42961. (typeof global !== "undefined" && global.setImmediate) ||
  42962. (this && this.setImmediate);
  42963. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42964. (typeof global !== "undefined" && global.clearImmediate) ||
  42965. (this && this.clearImmediate);
  42966. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42967. /***/ }),
  42968. /***/ "./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&":
  42969. /*!*******************************************************************************************************************************************************************************************************************!*\
  42970. !*** ./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& ***!
  42971. \*******************************************************************************************************************************************************************************************************************/
  42972. /*! exports provided: render, staticRenderFns */
  42973. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42974. "use strict";
  42975. __webpack_require__.r(__webpack_exports__);
  42976. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42977. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42978. var render = function() {
  42979. var _vm = this
  42980. var _h = _vm.$createElement
  42981. var _c = _vm._self._c || _h
  42982. return _vm._m(0)
  42983. }
  42984. var staticRenderFns = [
  42985. function() {
  42986. var _vm = this
  42987. var _h = _vm.$createElement
  42988. var _c = _vm._self._c || _h
  42989. return _c("div", { staticClass: "container" }, [
  42990. _c("div", { staticClass: "row justify-content-center" }, [
  42991. _c("div", { staticClass: "col-md-8" }, [
  42992. _c("div", { staticClass: "card" }, [
  42993. _c("div", { staticClass: "card-header" }, [
  42994. _vm._v("Example Component")
  42995. ]),
  42996. _vm._v(" "),
  42997. _c("div", { staticClass: "card-body" }, [
  42998. _vm._v(
  42999. "\n I'm an example component.\n "
  43000. )
  43001. ])
  43002. ])
  43003. ])
  43004. ])
  43005. ])
  43006. }
  43007. ]
  43008. render._withStripped = true
  43009. /***/ }),
  43010. /***/ "./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&":
  43011. /*!************************************************************************************************************************************************************************************************************!*\
  43012. !*** ./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& ***!
  43013. \************************************************************************************************************************************************************************************************************/
  43014. /*! exports provided: render, staticRenderFns */
  43015. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43016. "use strict";
  43017. __webpack_require__.r(__webpack_exports__);
  43018. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43019. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43020. var render = function() {
  43021. var _vm = this
  43022. var _h = _vm.$createElement
  43023. var _c = _vm._self._c || _h
  43024. return _c(
  43025. "div",
  43026. [
  43027. _c(
  43028. "modal",
  43029. {
  43030. attrs: {
  43031. id: "asseteditModal",
  43032. tabindex: "-1",
  43033. role: "dialog",
  43034. "aria-labelledby": "asseteditModalLabel"
  43035. }
  43036. },
  43037. [
  43038. _c(
  43039. "h5",
  43040. {
  43041. staticClass: "modal-title",
  43042. attrs: { slot: "header", id: "asseteditModalLabel" },
  43043. slot: "header"
  43044. },
  43045. [_vm._v("\n Edit Work Order Information\n ")]
  43046. ),
  43047. _vm._v(" "),
  43048. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43049. _c("div", { staticClass: "form-group" }, [
  43050. _c("label", { attrs: { for: "manufacturer" } }, [
  43051. _vm._v("Manufacturer")
  43052. ]),
  43053. _vm._v(" "),
  43054. _c("input", {
  43055. directives: [
  43056. {
  43057. name: "model",
  43058. rawName: "v-model.lazy",
  43059. value: _vm.data.pcmanu,
  43060. expression: "data.pcmanu",
  43061. modifiers: { lazy: true }
  43062. }
  43063. ],
  43064. staticClass: "form-control",
  43065. attrs: {
  43066. type: "text",
  43067. name: "manufacturer",
  43068. id: "manufacturer"
  43069. },
  43070. domProps: { value: _vm.data.pcmanu },
  43071. on: {
  43072. change: function($event) {
  43073. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43074. }
  43075. }
  43076. })
  43077. ]),
  43078. _vm._v(" "),
  43079. _c("div", { staticClass: "form-group" }, [
  43080. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43081. _vm._v(" "),
  43082. _c("input", {
  43083. directives: [
  43084. {
  43085. name: "model",
  43086. rawName: "v-model.lazy",
  43087. value: _vm.data.pcmake,
  43088. expression: "data.pcmake",
  43089. modifiers: { lazy: true }
  43090. }
  43091. ],
  43092. staticClass: "form-control",
  43093. attrs: { type: "text", name: "make", id: "make" },
  43094. domProps: { value: _vm.data.pcmake },
  43095. on: {
  43096. change: function($event) {
  43097. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43098. }
  43099. }
  43100. })
  43101. ]),
  43102. _vm._v(" "),
  43103. _c("div", { staticClass: "form-group" }, [
  43104. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43105. _vm._v(" "),
  43106. _c("input", {
  43107. directives: [
  43108. {
  43109. name: "model",
  43110. rawName: "v-model.lazy",
  43111. value: _vm.data.pcnickname,
  43112. expression: "data.pcnickname",
  43113. modifiers: { lazy: true }
  43114. }
  43115. ],
  43116. staticClass: "form-control",
  43117. attrs: { type: "text", name: "nickname", id: "nickname" },
  43118. domProps: { value: _vm.data.pcnickname },
  43119. on: {
  43120. change: function($event) {
  43121. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43122. }
  43123. }
  43124. })
  43125. ]),
  43126. _vm._v(" "),
  43127. _c("div", { staticClass: "form-group" }, [
  43128. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43129. _vm._v(" "),
  43130. _c("input", {
  43131. directives: [
  43132. {
  43133. name: "model",
  43134. rawName: "v-model.lazy",
  43135. value: _vm.pcextra[2],
  43136. expression: "pcextra[2]",
  43137. modifiers: { lazy: true }
  43138. }
  43139. ],
  43140. staticClass: "form-control",
  43141. attrs: { type: "text", name: "os", id: "os" },
  43142. domProps: { value: _vm.pcextra[2] },
  43143. on: {
  43144. change: function($event) {
  43145. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43146. }
  43147. }
  43148. })
  43149. ]),
  43150. _vm._v(" "),
  43151. _c("div", { staticClass: "form-group" }, [
  43152. _c("label", { attrs: { for: "serial" } }, [
  43153. _vm._v("Serial Number")
  43154. ]),
  43155. _vm._v(" "),
  43156. _c("input", {
  43157. directives: [
  43158. {
  43159. name: "model",
  43160. rawName: "v-model.lazy",
  43161. value: _vm.pcextra[104],
  43162. expression: "pcextra[104]",
  43163. modifiers: { lazy: true }
  43164. }
  43165. ],
  43166. staticClass: "form-control",
  43167. attrs: { type: "text", id: "serial", name: "serial" },
  43168. domProps: { value: _vm.pcextra[104] },
  43169. on: {
  43170. change: function($event) {
  43171. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43172. }
  43173. }
  43174. })
  43175. ]),
  43176. _vm._v(" "),
  43177. _c("div", { staticClass: "form-group" }, [
  43178. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43179. _vm._v(" "),
  43180. _c("input", {
  43181. directives: [
  43182. {
  43183. name: "model",
  43184. rawName: "v-model.lazy",
  43185. value: _vm.pcextra[101],
  43186. expression: "pcextra[101]",
  43187. modifiers: { lazy: true }
  43188. }
  43189. ],
  43190. staticClass: "form-control",
  43191. attrs: { type: "text", id: "cpu", name: "cpu" },
  43192. domProps: { value: _vm.pcextra[101] },
  43193. on: {
  43194. change: function($event) {
  43195. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43196. }
  43197. }
  43198. })
  43199. ]),
  43200. _vm._v(" "),
  43201. _c("div", { staticClass: "form-group" }, [
  43202. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43203. _vm._v(" "),
  43204. _c("input", {
  43205. directives: [
  43206. {
  43207. name: "model",
  43208. rawName: "v-model.lazy",
  43209. value: _vm.pcextra[100],
  43210. expression: "pcextra[100]",
  43211. modifiers: { lazy: true }
  43212. }
  43213. ],
  43214. staticClass: "form-control",
  43215. attrs: { type: "text", name: "ram", id: "ram" },
  43216. domProps: { value: _vm.pcextra[100] },
  43217. on: {
  43218. change: function($event) {
  43219. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43220. }
  43221. }
  43222. })
  43223. ]),
  43224. _vm._v(" "),
  43225. _c("div", { staticClass: "form-group" }, [
  43226. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43227. _vm._v(" "),
  43228. _c("input", {
  43229. directives: [
  43230. {
  43231. name: "model",
  43232. rawName: "v-model.lazy",
  43233. value: _vm.pcextra[4],
  43234. expression: "pcextra[4]",
  43235. modifiers: { lazy: true }
  43236. }
  43237. ],
  43238. staticClass: "form-control",
  43239. attrs: { type: "text", name: "graphics", id: "grapics" },
  43240. domProps: { value: _vm.pcextra[4] },
  43241. on: {
  43242. change: function($event) {
  43243. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43244. }
  43245. }
  43246. })
  43247. ])
  43248. ]),
  43249. _vm._v(" "),
  43250. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43251. _c(
  43252. "button",
  43253. {
  43254. staticClass: "btn btn-secondary",
  43255. attrs: { type: "button", "data-dismiss": "modal" }
  43256. },
  43257. [_vm._v("Close")]
  43258. ),
  43259. _vm._v(" "),
  43260. _c(
  43261. "button",
  43262. {
  43263. staticClass: "btn btn-primary",
  43264. attrs: { type: "button" },
  43265. on: {
  43266. click: function($event) {
  43267. return _vm.updateAsset()
  43268. }
  43269. }
  43270. },
  43271. [_vm._v("Save")]
  43272. )
  43273. ])
  43274. ]
  43275. ),
  43276. _vm._v(" "),
  43277. _c("h4", { staticClass: "text-center" }, [
  43278. _vm._v(
  43279. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43280. ),
  43281. _c("small", { staticClass: "text-muted" }, [
  43282. _vm._v(_vm._s(this.data.pcnickname))
  43283. ])
  43284. ]),
  43285. _vm._v(" "),
  43286. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43287. _vm._v(" "),
  43288. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43289. _vm._v(" "),
  43290. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43291. _vm._v(" "),
  43292. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43293. _vm._v(" "),
  43294. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43295. _vm._v(" "),
  43296. _c(
  43297. "button",
  43298. {
  43299. staticClass: "btn btn-primary",
  43300. attrs: {
  43301. type: "button",
  43302. "data-toggle": "modal",
  43303. "data-target": "#asseteditModal"
  43304. }
  43305. },
  43306. [_vm._v("Edit")]
  43307. )
  43308. ],
  43309. 1
  43310. )
  43311. }
  43312. var staticRenderFns = []
  43313. render._withStripped = true
  43314. /***/ }),
  43315. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  43316. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43317. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  43318. \*******************************************************************************************************************************************************************************************************************************/
  43319. /*! exports provided: render, staticRenderFns */
  43320. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43321. "use strict";
  43322. __webpack_require__.r(__webpack_exports__);
  43323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43325. var render = function() {
  43326. var _vm = this
  43327. var _h = _vm.$createElement
  43328. var _c = _vm._self._c || _h
  43329. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43330. _c("div", { staticClass: "input-group" }, [
  43331. _c("input", {
  43332. directives: [
  43333. {
  43334. name: "model",
  43335. rawName: "v-model",
  43336. value: _vm.searchText,
  43337. expression: "searchText"
  43338. }
  43339. ],
  43340. staticClass: "form-control",
  43341. attrs: { type: "text" },
  43342. domProps: { value: _vm.searchText },
  43343. on: {
  43344. input: [
  43345. function($event) {
  43346. if ($event.target.composing) {
  43347. return
  43348. }
  43349. _vm.searchText = $event.target.value
  43350. },
  43351. _vm.searchChanged
  43352. ]
  43353. }
  43354. }),
  43355. _vm._v(" "),
  43356. _c("div", { staticClass: "form-group-append" }, [
  43357. _c(
  43358. "a",
  43359. {
  43360. staticClass: "toggle input-group-text bg-primary text-light",
  43361. on: {
  43362. mousedown: function($event) {
  43363. $event.preventDefault()
  43364. },
  43365. click: function($event) {
  43366. return _vm.setOpen(!_vm.open)
  43367. }
  43368. }
  43369. },
  43370. [
  43371. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43372. _vm._v(" "),
  43373. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43374. ]
  43375. )
  43376. ])
  43377. ]),
  43378. _vm._v(" "),
  43379. _c(
  43380. "ul",
  43381. { staticClass: "suggestion-list list-unstyled" },
  43382. _vm._l(_vm.matches, function(suggestion, index) {
  43383. return _c(
  43384. "li",
  43385. {
  43386. key: index,
  43387. on: {
  43388. mousedown: function($event) {
  43389. $event.preventDefault()
  43390. },
  43391. click: function($event) {
  43392. return _vm.suggestionSelected(suggestion)
  43393. }
  43394. }
  43395. },
  43396. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43397. )
  43398. }),
  43399. 0
  43400. )
  43401. ])
  43402. }
  43403. var staticRenderFns = []
  43404. render._withStripped = true
  43405. /***/ }),
  43406. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  43407. /*!************************************************************************************************************************************************************************************************************************!*\
  43408. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  43409. \************************************************************************************************************************************************************************************************************************/
  43410. /*! exports provided: render, staticRenderFns */
  43411. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43412. "use strict";
  43413. __webpack_require__.r(__webpack_exports__);
  43414. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43415. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43416. var render = function() {
  43417. var _vm = this
  43418. var _h = _vm.$createElement
  43419. var _c = _vm._self._c || _h
  43420. return _c(
  43421. "modal",
  43422. {
  43423. attrs: {
  43424. id: _vm.id,
  43425. tabindex: "-1",
  43426. role: "dialog",
  43427. "aria-labelledby": _vm.id + "Label"
  43428. }
  43429. },
  43430. [
  43431. _c(
  43432. "h5",
  43433. {
  43434. staticClass: "modal-title",
  43435. attrs: { slot: "header", id: _vm.id + "Label" },
  43436. slot: "header"
  43437. },
  43438. [_vm._v("\n Edit Credential\n ")]
  43439. ),
  43440. _vm._v(" "),
  43441. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43442. _c(
  43443. "div",
  43444. { staticClass: "form" },
  43445. [
  43446. _c("autocomplete-custom-dropdown", {
  43447. attrs: {
  43448. options: _vm.descriptions,
  43449. value: _vm.creddesc,
  43450. "allow-custom": true
  43451. },
  43452. model: {
  43453. value: _vm.creddesc,
  43454. callback: function($$v) {
  43455. _vm.creddesc = $$v
  43456. },
  43457. expression: "creddesc"
  43458. }
  43459. })
  43460. ],
  43461. 1
  43462. ),
  43463. _vm._v(" "),
  43464. _c("div", { staticClass: "form-group" }, [
  43465. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43466. _vm._v(" "),
  43467. _c("input", {
  43468. directives: [
  43469. {
  43470. name: "model",
  43471. rawName: "v-model",
  43472. value: _vm.data.creduser,
  43473. expression: "data.creduser"
  43474. }
  43475. ],
  43476. staticClass: "form-control credential",
  43477. attrs: {
  43478. type: "text",
  43479. name: "newusername" + _vm.data.credid,
  43480. id: "newusername" + _vm.data.credid
  43481. },
  43482. domProps: { value: _vm.data.creduser },
  43483. on: {
  43484. input: function($event) {
  43485. if ($event.target.composing) {
  43486. return
  43487. }
  43488. _vm.$set(_vm.data, "creduser", $event.target.value)
  43489. }
  43490. }
  43491. })
  43492. ]),
  43493. _vm._v(" "),
  43494. _c("div", { staticClass: "form-group" }, [
  43495. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43496. _vm._v(" "),
  43497. _c("input", {
  43498. directives: [
  43499. {
  43500. name: "model",
  43501. rawName: "v-model",
  43502. value: _vm.data.credpass,
  43503. expression: "data.credpass"
  43504. }
  43505. ],
  43506. staticClass: "form-control credential",
  43507. attrs: {
  43508. type: "text",
  43509. name: "newpassword" + _vm.data.credid,
  43510. id: "newpassword" + _vm.data.credid
  43511. },
  43512. domProps: { value: _vm.data.credpass },
  43513. on: {
  43514. input: function($event) {
  43515. if ($event.target.composing) {
  43516. return
  43517. }
  43518. _vm.$set(_vm.data, "credpass", $event.target.value)
  43519. }
  43520. }
  43521. }),
  43522. _vm._v(" "),
  43523. _c(
  43524. "button",
  43525. {
  43526. staticClass: "btn btn-secondary",
  43527. attrs: { type: "button" },
  43528. on: {
  43529. click: function($event) {
  43530. return _vm.getRandomPassword(_vm.data.credid)
  43531. }
  43532. }
  43533. },
  43534. [_vm._v("Generate Random")]
  43535. )
  43536. ]),
  43537. _vm._v(" "),
  43538. _c("div", { staticClass: "form-group" })
  43539. ]),
  43540. _vm._v(" "),
  43541. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43542. _c(
  43543. "button",
  43544. {
  43545. staticClass: "btn btn-secondary",
  43546. attrs: { type: "button", "data-dismiss": "modal" }
  43547. },
  43548. [_vm._v("Close")]
  43549. ),
  43550. _vm._v(" "),
  43551. _c(
  43552. "button",
  43553. {
  43554. staticClass: "btn btn-primary",
  43555. attrs: { type: "button" },
  43556. on: {
  43557. click: function($event) {
  43558. return _vm.updateCredential()
  43559. }
  43560. }
  43561. },
  43562. [_vm._v("Save")]
  43563. )
  43564. ])
  43565. ]
  43566. )
  43567. }
  43568. var staticRenderFns = []
  43569. render._withStripped = true
  43570. /***/ }),
  43571. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  43572. /*!******************************************************************************************************************************************************************************************************************!*\
  43573. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  43574. \******************************************************************************************************************************************************************************************************************/
  43575. /*! exports provided: render, staticRenderFns */
  43576. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43577. "use strict";
  43578. __webpack_require__.r(__webpack_exports__);
  43579. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43580. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43581. var render = function() {
  43582. var _vm = this
  43583. var _h = _vm.$createElement
  43584. var _c = _vm._self._c || _h
  43585. return _c(
  43586. "div",
  43587. [
  43588. _c("credential-form-modal", {
  43589. attrs: {
  43590. "modal-id": "newCredentialModal",
  43591. descriptions: _vm.creddescList,
  43592. create: true,
  43593. pcid: _vm.pcid
  43594. }
  43595. }),
  43596. _vm._v(" "),
  43597. _c(
  43598. "button",
  43599. {
  43600. staticClass: "btn btn-primary",
  43601. attrs: {
  43602. type: "button",
  43603. "data-toggle": "modal",
  43604. "data-target": "#newCredentialModal"
  43605. }
  43606. },
  43607. [_vm._v("New Credential")]
  43608. ),
  43609. _vm._v(" "),
  43610. _vm._l(_vm.credentials, function(credential) {
  43611. return _c(
  43612. "div",
  43613. { key: credential.credid },
  43614. [
  43615. _c("credential", {
  43616. attrs: { credential: credential, descriptions: _vm.creddescList }
  43617. })
  43618. ],
  43619. 1
  43620. )
  43621. })
  43622. ],
  43623. 2
  43624. )
  43625. }
  43626. var staticRenderFns = []
  43627. render._withStripped = true
  43628. /***/ }),
  43629. /***/ "./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&":
  43630. /*!*************************************************************************************************************************************************************************************************************!*\
  43631. !*** ./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& ***!
  43632. \*************************************************************************************************************************************************************************************************************/
  43633. /*! exports provided: render, staticRenderFns */
  43634. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43635. "use strict";
  43636. __webpack_require__.r(__webpack_exports__);
  43637. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43638. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43639. var render = function() {
  43640. var _vm = this
  43641. var _h = _vm.$createElement
  43642. var _c = _vm._self._c || _h
  43643. return _c(
  43644. "div",
  43645. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43646. [
  43647. _c("credential-form-modal", {
  43648. attrs: {
  43649. descriptions: _vm.creddescList,
  43650. "modal-id": "credential" + this.data.credid + "editModal",
  43651. populateWith: this.data
  43652. }
  43653. }),
  43654. _vm._v(" "),
  43655. _c("div", { staticClass: "row no-gutters" }, [
  43656. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43657. _vm._v(_vm._s(this.data.creddesc))
  43658. ]),
  43659. _vm._v(" "),
  43660. _c("div", { staticClass: "col-9 text-right" }, [
  43661. _vm._v(_vm._s(this.data.creddate))
  43662. ])
  43663. ]),
  43664. _vm._v(" "),
  43665. _c("div", { staticClass: "row" }, [
  43666. _c("div", { staticClass: "col-lg-9" }, [
  43667. _c("div", [
  43668. _vm._m(0),
  43669. _vm._v(" "),
  43670. _c("input", {
  43671. staticClass: "border-0 credential",
  43672. attrs: {
  43673. type: "text",
  43674. id: "username" + this.data.credid,
  43675. readonly: ""
  43676. },
  43677. domProps: { value: this.data.creduser }
  43678. }),
  43679. _vm._v(" "),
  43680. _c(
  43681. "button",
  43682. {
  43683. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43684. attrs: {
  43685. id: "btn-username" + this.data.credid,
  43686. "data-clipboard-target": "#username" + this.data.credid
  43687. }
  43688. },
  43689. [_c("i", { staticClass: "far fa-clone" })]
  43690. )
  43691. ]),
  43692. _vm._v(" "),
  43693. _c("div", [
  43694. _vm._m(1),
  43695. _vm._v(" "),
  43696. _c("input", {
  43697. staticClass: "border-0 credential",
  43698. attrs: {
  43699. type: "text",
  43700. id: "password" + this.data.credid,
  43701. readonly: ""
  43702. },
  43703. domProps: { value: this.data.credpass }
  43704. }),
  43705. _vm._v(" "),
  43706. _c(
  43707. "button",
  43708. {
  43709. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43710. attrs: {
  43711. id: "btn-password" + this.data.credid,
  43712. "data-clipboard-target": "#password" + this.data.credid
  43713. }
  43714. },
  43715. [_c("i", { staticClass: "far fa-clone" })]
  43716. )
  43717. ])
  43718. ]),
  43719. _vm._v(" "),
  43720. _c(
  43721. "div",
  43722. {
  43723. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43724. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43725. },
  43726. [
  43727. _c(
  43728. "button",
  43729. {
  43730. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43731. attrs: {
  43732. type: "button",
  43733. "data-toggle": "modal",
  43734. "data-target": "#credential" + this.data.credid + "editModal"
  43735. }
  43736. },
  43737. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43738. ),
  43739. _vm._v(" "),
  43740. _vm._m(2)
  43741. ]
  43742. )
  43743. ])
  43744. ],
  43745. 1
  43746. )
  43747. }
  43748. var staticRenderFns = [
  43749. function() {
  43750. var _vm = this
  43751. var _h = _vm.$createElement
  43752. var _c = _vm._self._c || _h
  43753. return _c("label", { attrs: { for: "username" } }, [
  43754. _c("i", { staticClass: "fas fa-fw fa-user" })
  43755. ])
  43756. },
  43757. function() {
  43758. var _vm = this
  43759. var _h = _vm.$createElement
  43760. var _c = _vm._self._c || _h
  43761. return _c("label", { attrs: { for: "password" } }, [
  43762. _c("i", { staticClass: "fas fa-fw fa-key" })
  43763. ])
  43764. },
  43765. function() {
  43766. var _vm = this
  43767. var _h = _vm.$createElement
  43768. var _c = _vm._self._c || _h
  43769. return _c(
  43770. "button",
  43771. {
  43772. staticClass: "btn btn-sm btn-danger p-lg-1",
  43773. attrs: { type: "button" }
  43774. },
  43775. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43776. )
  43777. }
  43778. ]
  43779. render._withStripped = true
  43780. /***/ }),
  43781. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  43782. /*!************************************************************************************************************************************************************************************************************!*\
  43783. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  43784. \************************************************************************************************************************************************************************************************************/
  43785. /*! exports provided: render, staticRenderFns */
  43786. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43787. "use strict";
  43788. __webpack_require__.r(__webpack_exports__);
  43789. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43790. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43791. var render = function() {
  43792. var _vm = this
  43793. var _h = _vm.$createElement
  43794. var _c = _vm._self._c || _h
  43795. return _c(
  43796. "ul",
  43797. { staticClass: "list-unstyled" },
  43798. _vm._l(_vm.errorList, function(error) {
  43799. return _c("li", { key: error, staticClass: "text-danger" }, [
  43800. _vm._v(" " + _vm._s(error) + " ")
  43801. ])
  43802. }),
  43803. 0
  43804. )
  43805. }
  43806. var staticRenderFns = []
  43807. render._withStripped = true
  43808. /***/ }),
  43809. /***/ "./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&":
  43810. /*!********************************************************************************************************************************************************************************************************!*\
  43811. !*** ./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& ***!
  43812. \********************************************************************************************************************************************************************************************************/
  43813. /*! exports provided: render, staticRenderFns */
  43814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43815. "use strict";
  43816. __webpack_require__.r(__webpack_exports__);
  43817. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43818. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43819. var render = function() {
  43820. var _vm = this
  43821. var _h = _vm.$createElement
  43822. var _c = _vm._self._c || _h
  43823. return _c("div", { staticClass: "modal fade" }, [
  43824. _c(
  43825. "div",
  43826. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43827. [
  43828. _c("div", { staticClass: "modal-content" }, [
  43829. _c(
  43830. "div",
  43831. { staticClass: "modal-header" },
  43832. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43833. 2
  43834. ),
  43835. _vm._v(" "),
  43836. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43837. _vm._v(" "),
  43838. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43839. ])
  43840. ]
  43841. )
  43842. ])
  43843. }
  43844. var staticRenderFns = [
  43845. function() {
  43846. var _vm = this
  43847. var _h = _vm.$createElement
  43848. var _c = _vm._self._c || _h
  43849. return _c(
  43850. "button",
  43851. {
  43852. staticClass: "close",
  43853. attrs: {
  43854. type: "button",
  43855. "data-dismiss": "modal",
  43856. "aria-label": "Close"
  43857. }
  43858. },
  43859. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43860. )
  43861. }
  43862. ]
  43863. render._withStripped = true
  43864. /***/ }),
  43865. /***/ "./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&":
  43866. /*!********************************************************************************************************************************************************************************************************!*\
  43867. !*** ./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& ***!
  43868. \********************************************************************************************************************************************************************************************************/
  43869. /*! exports provided: render, staticRenderFns */
  43870. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43871. "use strict";
  43872. __webpack_require__.r(__webpack_exports__);
  43873. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43874. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43875. var render = function() {
  43876. var _vm = this
  43877. var _h = _vm.$createElement
  43878. var _c = _vm._self._c || _h
  43879. return _c(
  43880. "ul",
  43881. { staticClass: "list-unstyled" },
  43882. _vm._l(this.notes, function(note) {
  43883. return _c(
  43884. "li",
  43885. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43886. [
  43887. _c(
  43888. "modal",
  43889. {
  43890. attrs: {
  43891. id: "note" + note.noteid + "editModal",
  43892. tabindex: "-1",
  43893. role: "dialog",
  43894. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43895. }
  43896. },
  43897. [
  43898. _c(
  43899. "h5",
  43900. {
  43901. staticClass: "modal-title",
  43902. attrs: {
  43903. slot: "header",
  43904. id: "note" + note.noteid + "editModalLabel"
  43905. },
  43906. slot: "header"
  43907. },
  43908. [_vm._v("\n Edit Note\n ")]
  43909. ),
  43910. _vm._v(" "),
  43911. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43912. _c("div", { staticClass: "form-group" }, [
  43913. _c("label", { attrs: { for: "content" } }, [
  43914. _vm._v("Content")
  43915. ]),
  43916. _vm._v(" "),
  43917. _c("textarea", {
  43918. directives: [
  43919. {
  43920. name: "model",
  43921. rawName: "v-model",
  43922. value: note.thenote,
  43923. expression: "note.thenote"
  43924. }
  43925. ],
  43926. staticClass: "form-control",
  43927. attrs: {
  43928. name: "content" + note.noteid,
  43929. id: "content" + note.noteid
  43930. },
  43931. domProps: { value: note.thenote },
  43932. on: {
  43933. input: function($event) {
  43934. if ($event.target.composing) {
  43935. return
  43936. }
  43937. _vm.$set(note, "thenote", $event.target.value)
  43938. }
  43939. }
  43940. })
  43941. ])
  43942. ]),
  43943. _vm._v(" "),
  43944. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43945. _c(
  43946. "button",
  43947. {
  43948. staticClass: "btn btn-secondary",
  43949. attrs: { type: "button", "data-dismiss": "modal" }
  43950. },
  43951. [_vm._v("Close")]
  43952. ),
  43953. _vm._v(" "),
  43954. _c(
  43955. "button",
  43956. {
  43957. staticClass: "btn btn-primary",
  43958. attrs: { type: "button" },
  43959. on: {
  43960. click: function($event) {
  43961. return _vm.updateNote(note.noteid)
  43962. }
  43963. }
  43964. },
  43965. [_vm._v("Save")]
  43966. )
  43967. ])
  43968. ]
  43969. ),
  43970. _vm._v(" "),
  43971. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43972. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43973. _vm._v(_vm._s(note.noteuser))
  43974. ]),
  43975. _vm._v(" "),
  43976. _c(
  43977. "div",
  43978. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43979. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43980. ),
  43981. _vm._v(" "),
  43982. _c(
  43983. "div",
  43984. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43985. [
  43986. _vm.authusername === note.noteuser ||
  43987. _vm.authusername === "admin"
  43988. ? [
  43989. _c(
  43990. "button",
  43991. {
  43992. staticClass: "btn btn-sm btn-primary m-1",
  43993. attrs: {
  43994. "data-toggle": "modal",
  43995. "data-target": "#note" + note.noteid + "editModal"
  43996. }
  43997. },
  43998. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43999. ),
  44000. _vm._v(" "),
  44001. _vm._m(0, true),
  44002. _vm._v(" "),
  44003. _vm._m(1, true)
  44004. ]
  44005. : _vm._e()
  44006. ],
  44007. 2
  44008. )
  44009. ]),
  44010. _vm._v(" "),
  44011. _c("div", { staticClass: "col-md-10" }, [
  44012. _c("div", { staticClass: "card m-2" }, [
  44013. _c("div", { staticClass: "card-body p-2" }, [
  44014. _vm._v(
  44015. "\n " +
  44016. _vm._s(note.thenote) +
  44017. "\n "
  44018. )
  44019. ])
  44020. ])
  44021. ])
  44022. ],
  44023. 1
  44024. )
  44025. }),
  44026. 0
  44027. )
  44028. }
  44029. var staticRenderFns = [
  44030. function() {
  44031. var _vm = this
  44032. var _h = _vm.$createElement
  44033. var _c = _vm._self._c || _h
  44034. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44035. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44036. ])
  44037. },
  44038. function() {
  44039. var _vm = this
  44040. var _h = _vm.$createElement
  44041. var _c = _vm._self._c || _h
  44042. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44043. _c("i", { staticClass: "fa fa-fw fa-random" })
  44044. ])
  44045. }
  44046. ]
  44047. render._withStripped = true
  44048. /***/ }),
  44049. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  44050. /*!********************************************************************************************************************************************************************************************************************!*\
  44051. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  44052. \********************************************************************************************************************************************************************************************************************/
  44053. /*! exports provided: render, staticRenderFns */
  44054. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44055. "use strict";
  44056. __webpack_require__.r(__webpack_exports__);
  44057. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44059. var render = function() {
  44060. var _vm = this
  44061. var _h = _vm.$createElement
  44062. var _c = _vm._self._c || _h
  44063. return _c(
  44064. "modal",
  44065. {
  44066. attrs: {
  44067. id: _vm.id,
  44068. tabindex: "-1",
  44069. role: "dialog",
  44070. "aria-labelledby": _vm.id + "Label"
  44071. }
  44072. },
  44073. [
  44074. _c(
  44075. "h5",
  44076. {
  44077. staticClass: "modal-title",
  44078. attrs: { slot: "header", id: _vm.id + "Label" },
  44079. slot: "header"
  44080. },
  44081. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44082. ),
  44083. _vm._v(" "),
  44084. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44085. _c(
  44086. "div",
  44087. { staticClass: "form-group" },
  44088. [
  44089. _c("label", { attrs: { for: "probdesc" } }, [
  44090. _vm._v("Problem Description")
  44091. ]),
  44092. _vm._v(" "),
  44093. _c("textarea", {
  44094. directives: [
  44095. {
  44096. name: "model",
  44097. rawName: "v-model",
  44098. value: _vm.data.probdesc,
  44099. expression: "data.probdesc"
  44100. }
  44101. ],
  44102. class: {
  44103. "form-control": true,
  44104. "is-invalid": _vm.errors.probdesc
  44105. },
  44106. attrs: { id: "probdesc", name: "probdesc" },
  44107. domProps: { value: _vm.data.probdesc },
  44108. on: {
  44109. input: function($event) {
  44110. if ($event.target.composing) {
  44111. return
  44112. }
  44113. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44114. }
  44115. }
  44116. }),
  44117. _vm._v(" "),
  44118. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44119. ],
  44120. 1
  44121. ),
  44122. _vm._v(" "),
  44123. _c(
  44124. "div",
  44125. { staticClass: "form-group" },
  44126. [
  44127. _c("label", { attrs: { for: "suggested" } }, [
  44128. _vm._v("Suggested Solution")
  44129. ]),
  44130. _vm._v(" "),
  44131. _c("textarea", {
  44132. directives: [
  44133. {
  44134. name: "model",
  44135. rawName: "v-model",
  44136. value: _vm.data.suggested,
  44137. expression: "data.suggested"
  44138. }
  44139. ],
  44140. class: {
  44141. "form-control": true,
  44142. "is-invalid": _vm.errors.suggested
  44143. },
  44144. attrs: { id: "suggested", name: "suggested" },
  44145. domProps: { value: _vm.data.suggested },
  44146. on: {
  44147. input: function($event) {
  44148. if ($event.target.composing) {
  44149. return
  44150. }
  44151. _vm.$set(_vm.data, "suggested", $event.target.value)
  44152. }
  44153. }
  44154. }),
  44155. _vm._v(" "),
  44156. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44157. ],
  44158. 1
  44159. ),
  44160. _vm._v(" "),
  44161. _c(
  44162. "div",
  44163. { staticClass: "form-group" },
  44164. [
  44165. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44166. _vm._v(" "),
  44167. _c("autocomplete-custom-dropdown", {
  44168. attrs: { options: _vm.storeList, value: this.store },
  44169. model: {
  44170. value: _vm.store,
  44171. callback: function($$v) {
  44172. _vm.store = $$v
  44173. },
  44174. expression: "store"
  44175. }
  44176. })
  44177. ],
  44178. 1
  44179. )
  44180. ]),
  44181. _vm._v(" "),
  44182. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44183. _c(
  44184. "button",
  44185. {
  44186. staticClass: "btn btn-secondary",
  44187. attrs: { type: "button", "data-dismiss": "modal" }
  44188. },
  44189. [_vm._v("Close")]
  44190. ),
  44191. _vm._v(" "),
  44192. _c(
  44193. "button",
  44194. {
  44195. staticClass: "btn btn-primary",
  44196. attrs: { type: "button" },
  44197. on: {
  44198. click: function($event) {
  44199. return _vm.updateWorkOrder()
  44200. }
  44201. }
  44202. },
  44203. [_vm._v("Save")]
  44204. )
  44205. ])
  44206. ]
  44207. )
  44208. }
  44209. var staticRenderFns = []
  44210. render._withStripped = true
  44211. /***/ }),
  44212. /***/ "./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&":
  44213. /*!*********************************************************************************************************************************************************************************************************!*\
  44214. !*** ./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& ***!
  44215. \*********************************************************************************************************************************************************************************************************/
  44216. /*! exports provided: render, staticRenderFns */
  44217. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44218. "use strict";
  44219. __webpack_require__.r(__webpack_exports__);
  44220. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44221. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44222. var render = function() {
  44223. var _vm = this
  44224. var _h = _vm.$createElement
  44225. var _c = _vm._self._c || _h
  44226. return _c(
  44227. "div",
  44228. [
  44229. _c("woinfo-edit-modal", {
  44230. attrs: {
  44231. "modal-id": "workordereditModal",
  44232. "populate-with": this.data,
  44233. "store-list": this.storeList
  44234. }
  44235. }),
  44236. _vm._v(" "),
  44237. _c("p", [
  44238. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44239. _vm._v(" "),
  44240. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44241. ]),
  44242. _vm._v(" "),
  44243. _c("p", [
  44244. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44245. _vm._v(" "),
  44246. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44247. ]),
  44248. _vm._v(" "),
  44249. _c("p", [
  44250. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44251. _vm._v(" "),
  44252. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44253. ]),
  44254. _vm._v(" "),
  44255. _c("p", [
  44256. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44257. _vm._v(" "),
  44258. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44259. ]),
  44260. _vm._v(" "),
  44261. _c("p", [
  44262. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44263. _vm._v(" "),
  44264. _c(
  44265. "span",
  44266. {
  44267. staticClass: "dashed-underline",
  44268. attrs: {
  44269. "data-toggle": "tooltip",
  44270. "data-placement": "bottom",
  44271. title: this.getHRDate(this.data.dropdate)
  44272. }
  44273. },
  44274. [
  44275. _vm._v(
  44276. "\n " +
  44277. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44278. " days ago\n "
  44279. )
  44280. ]
  44281. )
  44282. ]),
  44283. _vm._v(" "),
  44284. _c("p", [
  44285. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44286. _vm._v(" "),
  44287. !this.isZero(this.data.pickupdate)
  44288. ? _c(
  44289. "span",
  44290. {
  44291. staticClass: "dashed-underline",
  44292. attrs: {
  44293. "data-toggle": "tooltip",
  44294. "data-placement": "bottom",
  44295. title: this.getHRDate(this.data.pickupdate)
  44296. }
  44297. },
  44298. [
  44299. _vm._v(
  44300. "\n " +
  44301. _vm._s(
  44302. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44303. ) +
  44304. " days ago\n "
  44305. )
  44306. ]
  44307. )
  44308. : _vm._e()
  44309. ]),
  44310. _vm._v(" "),
  44311. _c(
  44312. "button",
  44313. {
  44314. staticClass: "btn btn-primary",
  44315. attrs: {
  44316. type: "button",
  44317. "data-toggle": "modal",
  44318. "data-target": "#workordereditModal"
  44319. }
  44320. },
  44321. [_vm._v("Edit")]
  44322. )
  44323. ],
  44324. 1
  44325. )
  44326. }
  44327. var staticRenderFns = []
  44328. render._withStripped = true
  44329. /***/ }),
  44330. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44331. /*!********************************************************************!*\
  44332. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44333. \********************************************************************/
  44334. /*! exports provided: default */
  44335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44336. "use strict";
  44337. __webpack_require__.r(__webpack_exports__);
  44338. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44339. /* globals __VUE_SSR_CONTEXT__ */
  44340. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44341. // This module is a runtime utility for cleaner component module output and will
  44342. // be included in the final webpack user bundle.
  44343. function normalizeComponent (
  44344. scriptExports,
  44345. render,
  44346. staticRenderFns,
  44347. functionalTemplate,
  44348. injectStyles,
  44349. scopeId,
  44350. moduleIdentifier, /* server only */
  44351. shadowMode /* vue-cli only */
  44352. ) {
  44353. // Vue.extend constructor export interop
  44354. var options = typeof scriptExports === 'function'
  44355. ? scriptExports.options
  44356. : scriptExports
  44357. // render functions
  44358. if (render) {
  44359. options.render = render
  44360. options.staticRenderFns = staticRenderFns
  44361. options._compiled = true
  44362. }
  44363. // functional template
  44364. if (functionalTemplate) {
  44365. options.functional = true
  44366. }
  44367. // scopedId
  44368. if (scopeId) {
  44369. options._scopeId = 'data-v-' + scopeId
  44370. }
  44371. var hook
  44372. if (moduleIdentifier) { // server build
  44373. hook = function (context) {
  44374. // 2.3 injection
  44375. context =
  44376. context || // cached call
  44377. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44378. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44379. // 2.2 with runInNewContext: true
  44380. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44381. context = __VUE_SSR_CONTEXT__
  44382. }
  44383. // inject component styles
  44384. if (injectStyles) {
  44385. injectStyles.call(this, context)
  44386. }
  44387. // register component module identifier for async chunk inferrence
  44388. if (context && context._registeredComponents) {
  44389. context._registeredComponents.add(moduleIdentifier)
  44390. }
  44391. }
  44392. // used by ssr in case component is cached and beforeCreate
  44393. // never gets called
  44394. options._ssrRegister = hook
  44395. } else if (injectStyles) {
  44396. hook = shadowMode
  44397. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44398. : injectStyles
  44399. }
  44400. if (hook) {
  44401. if (options.functional) {
  44402. // for template-only hot-reload because in that case the render fn doesn't
  44403. // go through the normalizer
  44404. options._injectStyles = hook
  44405. // register for functioal component in vue file
  44406. var originalRender = options.render
  44407. options.render = function renderWithStyleInjection (h, context) {
  44408. hook.call(context)
  44409. return originalRender(h, context)
  44410. }
  44411. } else {
  44412. // inject component registration as beforeCreate hook
  44413. var existing = options.beforeCreate
  44414. options.beforeCreate = existing
  44415. ? [].concat(existing, hook)
  44416. : [hook]
  44417. }
  44418. }
  44419. return {
  44420. exports: scriptExports,
  44421. options: options
  44422. }
  44423. }
  44424. /***/ }),
  44425. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44426. /*!*************************************************!*\
  44427. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44428. \*************************************************/
  44429. /*! no static exports found */
  44430. /***/ (function(module, exports, __webpack_require__) {
  44431. "use strict";
  44432. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44433. * Vue.js v2.6.11
  44434. * (c) 2014-2019 Evan You
  44435. * Released under the MIT License.
  44436. */
  44437. /* */
  44438. var emptyObject = Object.freeze({});
  44439. // These helpers produce better VM code in JS engines due to their
  44440. // explicitness and function inlining.
  44441. function isUndef (v) {
  44442. return v === undefined || v === null
  44443. }
  44444. function isDef (v) {
  44445. return v !== undefined && v !== null
  44446. }
  44447. function isTrue (v) {
  44448. return v === true
  44449. }
  44450. function isFalse (v) {
  44451. return v === false
  44452. }
  44453. /**
  44454. * Check if value is primitive.
  44455. */
  44456. function isPrimitive (value) {
  44457. return (
  44458. typeof value === 'string' ||
  44459. typeof value === 'number' ||
  44460. // $flow-disable-line
  44461. typeof value === 'symbol' ||
  44462. typeof value === 'boolean'
  44463. )
  44464. }
  44465. /**
  44466. * Quick object check - this is primarily used to tell
  44467. * Objects from primitive values when we know the value
  44468. * is a JSON-compliant type.
  44469. */
  44470. function isObject (obj) {
  44471. return obj !== null && typeof obj === 'object'
  44472. }
  44473. /**
  44474. * Get the raw type string of a value, e.g., [object Object].
  44475. */
  44476. var _toString = Object.prototype.toString;
  44477. function toRawType (value) {
  44478. return _toString.call(value).slice(8, -1)
  44479. }
  44480. /**
  44481. * Strict object type check. Only returns true
  44482. * for plain JavaScript objects.
  44483. */
  44484. function isPlainObject (obj) {
  44485. return _toString.call(obj) === '[object Object]'
  44486. }
  44487. function isRegExp (v) {
  44488. return _toString.call(v) === '[object RegExp]'
  44489. }
  44490. /**
  44491. * Check if val is a valid array index.
  44492. */
  44493. function isValidArrayIndex (val) {
  44494. var n = parseFloat(String(val));
  44495. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44496. }
  44497. function isPromise (val) {
  44498. return (
  44499. isDef(val) &&
  44500. typeof val.then === 'function' &&
  44501. typeof val.catch === 'function'
  44502. )
  44503. }
  44504. /**
  44505. * Convert a value to a string that is actually rendered.
  44506. */
  44507. function toString (val) {
  44508. return val == null
  44509. ? ''
  44510. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44511. ? JSON.stringify(val, null, 2)
  44512. : String(val)
  44513. }
  44514. /**
  44515. * Convert an input value to a number for persistence.
  44516. * If the conversion fails, return original string.
  44517. */
  44518. function toNumber (val) {
  44519. var n = parseFloat(val);
  44520. return isNaN(n) ? val : n
  44521. }
  44522. /**
  44523. * Make a map and return a function for checking if a key
  44524. * is in that map.
  44525. */
  44526. function makeMap (
  44527. str,
  44528. expectsLowerCase
  44529. ) {
  44530. var map = Object.create(null);
  44531. var list = str.split(',');
  44532. for (var i = 0; i < list.length; i++) {
  44533. map[list[i]] = true;
  44534. }
  44535. return expectsLowerCase
  44536. ? function (val) { return map[val.toLowerCase()]; }
  44537. : function (val) { return map[val]; }
  44538. }
  44539. /**
  44540. * Check if a tag is a built-in tag.
  44541. */
  44542. var isBuiltInTag = makeMap('slot,component', true);
  44543. /**
  44544. * Check if an attribute is a reserved attribute.
  44545. */
  44546. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44547. /**
  44548. * Remove an item from an array.
  44549. */
  44550. function remove (arr, item) {
  44551. if (arr.length) {
  44552. var index = arr.indexOf(item);
  44553. if (index > -1) {
  44554. return arr.splice(index, 1)
  44555. }
  44556. }
  44557. }
  44558. /**
  44559. * Check whether an object has the property.
  44560. */
  44561. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44562. function hasOwn (obj, key) {
  44563. return hasOwnProperty.call(obj, key)
  44564. }
  44565. /**
  44566. * Create a cached version of a pure function.
  44567. */
  44568. function cached (fn) {
  44569. var cache = Object.create(null);
  44570. return (function cachedFn (str) {
  44571. var hit = cache[str];
  44572. return hit || (cache[str] = fn(str))
  44573. })
  44574. }
  44575. /**
  44576. * Camelize a hyphen-delimited string.
  44577. */
  44578. var camelizeRE = /-(\w)/g;
  44579. var camelize = cached(function (str) {
  44580. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44581. });
  44582. /**
  44583. * Capitalize a string.
  44584. */
  44585. var capitalize = cached(function (str) {
  44586. return str.charAt(0).toUpperCase() + str.slice(1)
  44587. });
  44588. /**
  44589. * Hyphenate a camelCase string.
  44590. */
  44591. var hyphenateRE = /\B([A-Z])/g;
  44592. var hyphenate = cached(function (str) {
  44593. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44594. });
  44595. /**
  44596. * Simple bind polyfill for environments that do not support it,
  44597. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44598. * since native bind is now performant enough in most browsers.
  44599. * But removing it would mean breaking code that was able to run in
  44600. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44601. */
  44602. /* istanbul ignore next */
  44603. function polyfillBind (fn, ctx) {
  44604. function boundFn (a) {
  44605. var l = arguments.length;
  44606. return l
  44607. ? l > 1
  44608. ? fn.apply(ctx, arguments)
  44609. : fn.call(ctx, a)
  44610. : fn.call(ctx)
  44611. }
  44612. boundFn._length = fn.length;
  44613. return boundFn
  44614. }
  44615. function nativeBind (fn, ctx) {
  44616. return fn.bind(ctx)
  44617. }
  44618. var bind = Function.prototype.bind
  44619. ? nativeBind
  44620. : polyfillBind;
  44621. /**
  44622. * Convert an Array-like object to a real Array.
  44623. */
  44624. function toArray (list, start) {
  44625. start = start || 0;
  44626. var i = list.length - start;
  44627. var ret = new Array(i);
  44628. while (i--) {
  44629. ret[i] = list[i + start];
  44630. }
  44631. return ret
  44632. }
  44633. /**
  44634. * Mix properties into target object.
  44635. */
  44636. function extend (to, _from) {
  44637. for (var key in _from) {
  44638. to[key] = _from[key];
  44639. }
  44640. return to
  44641. }
  44642. /**
  44643. * Merge an Array of Objects into a single Object.
  44644. */
  44645. function toObject (arr) {
  44646. var res = {};
  44647. for (var i = 0; i < arr.length; i++) {
  44648. if (arr[i]) {
  44649. extend(res, arr[i]);
  44650. }
  44651. }
  44652. return res
  44653. }
  44654. /* eslint-disable no-unused-vars */
  44655. /**
  44656. * Perform no operation.
  44657. * Stubbing args to make Flow happy without leaving useless transpiled code
  44658. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44659. */
  44660. function noop (a, b, c) {}
  44661. /**
  44662. * Always return false.
  44663. */
  44664. var no = function (a, b, c) { return false; };
  44665. /* eslint-enable no-unused-vars */
  44666. /**
  44667. * Return the same value.
  44668. */
  44669. var identity = function (_) { return _; };
  44670. /**
  44671. * Generate a string containing static keys from compiler modules.
  44672. */
  44673. function genStaticKeys (modules) {
  44674. return modules.reduce(function (keys, m) {
  44675. return keys.concat(m.staticKeys || [])
  44676. }, []).join(',')
  44677. }
  44678. /**
  44679. * Check if two values are loosely equal - that is,
  44680. * if they are plain objects, do they have the same shape?
  44681. */
  44682. function looseEqual (a, b) {
  44683. if (a === b) { return true }
  44684. var isObjectA = isObject(a);
  44685. var isObjectB = isObject(b);
  44686. if (isObjectA && isObjectB) {
  44687. try {
  44688. var isArrayA = Array.isArray(a);
  44689. var isArrayB = Array.isArray(b);
  44690. if (isArrayA && isArrayB) {
  44691. return a.length === b.length && a.every(function (e, i) {
  44692. return looseEqual(e, b[i])
  44693. })
  44694. } else if (a instanceof Date && b instanceof Date) {
  44695. return a.getTime() === b.getTime()
  44696. } else if (!isArrayA && !isArrayB) {
  44697. var keysA = Object.keys(a);
  44698. var keysB = Object.keys(b);
  44699. return keysA.length === keysB.length && keysA.every(function (key) {
  44700. return looseEqual(a[key], b[key])
  44701. })
  44702. } else {
  44703. /* istanbul ignore next */
  44704. return false
  44705. }
  44706. } catch (e) {
  44707. /* istanbul ignore next */
  44708. return false
  44709. }
  44710. } else if (!isObjectA && !isObjectB) {
  44711. return String(a) === String(b)
  44712. } else {
  44713. return false
  44714. }
  44715. }
  44716. /**
  44717. * Return the first index at which a loosely equal value can be
  44718. * found in the array (if value is a plain object, the array must
  44719. * contain an object of the same shape), or -1 if it is not present.
  44720. */
  44721. function looseIndexOf (arr, val) {
  44722. for (var i = 0; i < arr.length; i++) {
  44723. if (looseEqual(arr[i], val)) { return i }
  44724. }
  44725. return -1
  44726. }
  44727. /**
  44728. * Ensure a function is called only once.
  44729. */
  44730. function once (fn) {
  44731. var called = false;
  44732. return function () {
  44733. if (!called) {
  44734. called = true;
  44735. fn.apply(this, arguments);
  44736. }
  44737. }
  44738. }
  44739. var SSR_ATTR = 'data-server-rendered';
  44740. var ASSET_TYPES = [
  44741. 'component',
  44742. 'directive',
  44743. 'filter'
  44744. ];
  44745. var LIFECYCLE_HOOKS = [
  44746. 'beforeCreate',
  44747. 'created',
  44748. 'beforeMount',
  44749. 'mounted',
  44750. 'beforeUpdate',
  44751. 'updated',
  44752. 'beforeDestroy',
  44753. 'destroyed',
  44754. 'activated',
  44755. 'deactivated',
  44756. 'errorCaptured',
  44757. 'serverPrefetch'
  44758. ];
  44759. /* */
  44760. var config = ({
  44761. /**
  44762. * Option merge strategies (used in core/util/options)
  44763. */
  44764. // $flow-disable-line
  44765. optionMergeStrategies: Object.create(null),
  44766. /**
  44767. * Whether to suppress warnings.
  44768. */
  44769. silent: false,
  44770. /**
  44771. * Show production mode tip message on boot?
  44772. */
  44773. productionTip: "development" !== 'production',
  44774. /**
  44775. * Whether to enable devtools
  44776. */
  44777. devtools: "development" !== 'production',
  44778. /**
  44779. * Whether to record perf
  44780. */
  44781. performance: false,
  44782. /**
  44783. * Error handler for watcher errors
  44784. */
  44785. errorHandler: null,
  44786. /**
  44787. * Warn handler for watcher warns
  44788. */
  44789. warnHandler: null,
  44790. /**
  44791. * Ignore certain custom elements
  44792. */
  44793. ignoredElements: [],
  44794. /**
  44795. * Custom user key aliases for v-on
  44796. */
  44797. // $flow-disable-line
  44798. keyCodes: Object.create(null),
  44799. /**
  44800. * Check if a tag is reserved so that it cannot be registered as a
  44801. * component. This is platform-dependent and may be overwritten.
  44802. */
  44803. isReservedTag: no,
  44804. /**
  44805. * Check if an attribute is reserved so that it cannot be used as a component
  44806. * prop. This is platform-dependent and may be overwritten.
  44807. */
  44808. isReservedAttr: no,
  44809. /**
  44810. * Check if a tag is an unknown element.
  44811. * Platform-dependent.
  44812. */
  44813. isUnknownElement: no,
  44814. /**
  44815. * Get the namespace of an element
  44816. */
  44817. getTagNamespace: noop,
  44818. /**
  44819. * Parse the real tag name for the specific platform.
  44820. */
  44821. parsePlatformTagName: identity,
  44822. /**
  44823. * Check if an attribute must be bound using property, e.g. value
  44824. * Platform-dependent.
  44825. */
  44826. mustUseProp: no,
  44827. /**
  44828. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44829. * This will significantly reduce performance if set to false.
  44830. */
  44831. async: true,
  44832. /**
  44833. * Exposed for legacy reasons
  44834. */
  44835. _lifecycleHooks: LIFECYCLE_HOOKS
  44836. });
  44837. /* */
  44838. /**
  44839. * unicode letters used for parsing html tags, component names and property paths.
  44840. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44841. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44842. */
  44843. 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/;
  44844. /**
  44845. * Check if a string starts with $ or _
  44846. */
  44847. function isReserved (str) {
  44848. var c = (str + '').charCodeAt(0);
  44849. return c === 0x24 || c === 0x5F
  44850. }
  44851. /**
  44852. * Define a property.
  44853. */
  44854. function def (obj, key, val, enumerable) {
  44855. Object.defineProperty(obj, key, {
  44856. value: val,
  44857. enumerable: !!enumerable,
  44858. writable: true,
  44859. configurable: true
  44860. });
  44861. }
  44862. /**
  44863. * Parse simple path.
  44864. */
  44865. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44866. function parsePath (path) {
  44867. if (bailRE.test(path)) {
  44868. return
  44869. }
  44870. var segments = path.split('.');
  44871. return function (obj) {
  44872. for (var i = 0; i < segments.length; i++) {
  44873. if (!obj) { return }
  44874. obj = obj[segments[i]];
  44875. }
  44876. return obj
  44877. }
  44878. }
  44879. /* */
  44880. // can we use __proto__?
  44881. var hasProto = '__proto__' in {};
  44882. // Browser environment sniffing
  44883. var inBrowser = typeof window !== 'undefined';
  44884. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44885. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44886. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44887. var isIE = UA && /msie|trident/.test(UA);
  44888. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44889. var isEdge = UA && UA.indexOf('edge/') > 0;
  44890. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44891. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44892. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44893. var isPhantomJS = UA && /phantomjs/.test(UA);
  44894. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44895. // Firefox has a "watch" function on Object.prototype...
  44896. var nativeWatch = ({}).watch;
  44897. var supportsPassive = false;
  44898. if (inBrowser) {
  44899. try {
  44900. var opts = {};
  44901. Object.defineProperty(opts, 'passive', ({
  44902. get: function get () {
  44903. /* istanbul ignore next */
  44904. supportsPassive = true;
  44905. }
  44906. })); // https://github.com/facebook/flow/issues/285
  44907. window.addEventListener('test-passive', null, opts);
  44908. } catch (e) {}
  44909. }
  44910. // this needs to be lazy-evaled because vue may be required before
  44911. // vue-server-renderer can set VUE_ENV
  44912. var _isServer;
  44913. var isServerRendering = function () {
  44914. if (_isServer === undefined) {
  44915. /* istanbul ignore if */
  44916. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44917. // detect presence of vue-server-renderer and avoid
  44918. // Webpack shimming the process
  44919. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44920. } else {
  44921. _isServer = false;
  44922. }
  44923. }
  44924. return _isServer
  44925. };
  44926. // detect devtools
  44927. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44928. /* istanbul ignore next */
  44929. function isNative (Ctor) {
  44930. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44931. }
  44932. var hasSymbol =
  44933. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44934. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44935. var _Set;
  44936. /* istanbul ignore if */ // $flow-disable-line
  44937. if (typeof Set !== 'undefined' && isNative(Set)) {
  44938. // use native Set when available.
  44939. _Set = Set;
  44940. } else {
  44941. // a non-standard Set polyfill that only works with primitive keys.
  44942. _Set = /*@__PURE__*/(function () {
  44943. function Set () {
  44944. this.set = Object.create(null);
  44945. }
  44946. Set.prototype.has = function has (key) {
  44947. return this.set[key] === true
  44948. };
  44949. Set.prototype.add = function add (key) {
  44950. this.set[key] = true;
  44951. };
  44952. Set.prototype.clear = function clear () {
  44953. this.set = Object.create(null);
  44954. };
  44955. return Set;
  44956. }());
  44957. }
  44958. /* */
  44959. var warn = noop;
  44960. var tip = noop;
  44961. var generateComponentTrace = (noop); // work around flow check
  44962. var formatComponentName = (noop);
  44963. {
  44964. var hasConsole = typeof console !== 'undefined';
  44965. var classifyRE = /(?:^|[-_])(\w)/g;
  44966. var classify = function (str) { return str
  44967. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44968. .replace(/[-_]/g, ''); };
  44969. warn = function (msg, vm) {
  44970. var trace = vm ? generateComponentTrace(vm) : '';
  44971. if (config.warnHandler) {
  44972. config.warnHandler.call(null, msg, vm, trace);
  44973. } else if (hasConsole && (!config.silent)) {
  44974. console.error(("[Vue warn]: " + msg + trace));
  44975. }
  44976. };
  44977. tip = function (msg, vm) {
  44978. if (hasConsole && (!config.silent)) {
  44979. console.warn("[Vue tip]: " + msg + (
  44980. vm ? generateComponentTrace(vm) : ''
  44981. ));
  44982. }
  44983. };
  44984. formatComponentName = function (vm, includeFile) {
  44985. if (vm.$root === vm) {
  44986. return '<Root>'
  44987. }
  44988. var options = typeof vm === 'function' && vm.cid != null
  44989. ? vm.options
  44990. : vm._isVue
  44991. ? vm.$options || vm.constructor.options
  44992. : vm;
  44993. var name = options.name || options._componentTag;
  44994. var file = options.__file;
  44995. if (!name && file) {
  44996. var match = file.match(/([^/\\]+)\.vue$/);
  44997. name = match && match[1];
  44998. }
  44999. return (
  45000. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45001. (file && includeFile !== false ? (" at " + file) : '')
  45002. )
  45003. };
  45004. var repeat = function (str, n) {
  45005. var res = '';
  45006. while (n) {
  45007. if (n % 2 === 1) { res += str; }
  45008. if (n > 1) { str += str; }
  45009. n >>= 1;
  45010. }
  45011. return res
  45012. };
  45013. generateComponentTrace = function (vm) {
  45014. if (vm._isVue && vm.$parent) {
  45015. var tree = [];
  45016. var currentRecursiveSequence = 0;
  45017. while (vm) {
  45018. if (tree.length > 0) {
  45019. var last = tree[tree.length - 1];
  45020. if (last.constructor === vm.constructor) {
  45021. currentRecursiveSequence++;
  45022. vm = vm.$parent;
  45023. continue
  45024. } else if (currentRecursiveSequence > 0) {
  45025. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45026. currentRecursiveSequence = 0;
  45027. }
  45028. }
  45029. tree.push(vm);
  45030. vm = vm.$parent;
  45031. }
  45032. return '\n\nfound in\n\n' + tree
  45033. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45034. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45035. : formatComponentName(vm))); })
  45036. .join('\n')
  45037. } else {
  45038. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45039. }
  45040. };
  45041. }
  45042. /* */
  45043. var uid = 0;
  45044. /**
  45045. * A dep is an observable that can have multiple
  45046. * directives subscribing to it.
  45047. */
  45048. var Dep = function Dep () {
  45049. this.id = uid++;
  45050. this.subs = [];
  45051. };
  45052. Dep.prototype.addSub = function addSub (sub) {
  45053. this.subs.push(sub);
  45054. };
  45055. Dep.prototype.removeSub = function removeSub (sub) {
  45056. remove(this.subs, sub);
  45057. };
  45058. Dep.prototype.depend = function depend () {
  45059. if (Dep.target) {
  45060. Dep.target.addDep(this);
  45061. }
  45062. };
  45063. Dep.prototype.notify = function notify () {
  45064. // stabilize the subscriber list first
  45065. var subs = this.subs.slice();
  45066. if (!config.async) {
  45067. // subs aren't sorted in scheduler if not running async
  45068. // we need to sort them now to make sure they fire in correct
  45069. // order
  45070. subs.sort(function (a, b) { return a.id - b.id; });
  45071. }
  45072. for (var i = 0, l = subs.length; i < l; i++) {
  45073. subs[i].update();
  45074. }
  45075. };
  45076. // The current target watcher being evaluated.
  45077. // This is globally unique because only one watcher
  45078. // can be evaluated at a time.
  45079. Dep.target = null;
  45080. var targetStack = [];
  45081. function pushTarget (target) {
  45082. targetStack.push(target);
  45083. Dep.target = target;
  45084. }
  45085. function popTarget () {
  45086. targetStack.pop();
  45087. Dep.target = targetStack[targetStack.length - 1];
  45088. }
  45089. /* */
  45090. var VNode = function VNode (
  45091. tag,
  45092. data,
  45093. children,
  45094. text,
  45095. elm,
  45096. context,
  45097. componentOptions,
  45098. asyncFactory
  45099. ) {
  45100. this.tag = tag;
  45101. this.data = data;
  45102. this.children = children;
  45103. this.text = text;
  45104. this.elm = elm;
  45105. this.ns = undefined;
  45106. this.context = context;
  45107. this.fnContext = undefined;
  45108. this.fnOptions = undefined;
  45109. this.fnScopeId = undefined;
  45110. this.key = data && data.key;
  45111. this.componentOptions = componentOptions;
  45112. this.componentInstance = undefined;
  45113. this.parent = undefined;
  45114. this.raw = false;
  45115. this.isStatic = false;
  45116. this.isRootInsert = true;
  45117. this.isComment = false;
  45118. this.isCloned = false;
  45119. this.isOnce = false;
  45120. this.asyncFactory = asyncFactory;
  45121. this.asyncMeta = undefined;
  45122. this.isAsyncPlaceholder = false;
  45123. };
  45124. var prototypeAccessors = { child: { configurable: true } };
  45125. // DEPRECATED: alias for componentInstance for backwards compat.
  45126. /* istanbul ignore next */
  45127. prototypeAccessors.child.get = function () {
  45128. return this.componentInstance
  45129. };
  45130. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45131. var createEmptyVNode = function (text) {
  45132. if ( text === void 0 ) text = '';
  45133. var node = new VNode();
  45134. node.text = text;
  45135. node.isComment = true;
  45136. return node
  45137. };
  45138. function createTextVNode (val) {
  45139. return new VNode(undefined, undefined, undefined, String(val))
  45140. }
  45141. // optimized shallow clone
  45142. // used for static nodes and slot nodes because they may be reused across
  45143. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45144. // on their elm reference.
  45145. function cloneVNode (vnode) {
  45146. var cloned = new VNode(
  45147. vnode.tag,
  45148. vnode.data,
  45149. // #7975
  45150. // clone children array to avoid mutating original in case of cloning
  45151. // a child.
  45152. vnode.children && vnode.children.slice(),
  45153. vnode.text,
  45154. vnode.elm,
  45155. vnode.context,
  45156. vnode.componentOptions,
  45157. vnode.asyncFactory
  45158. );
  45159. cloned.ns = vnode.ns;
  45160. cloned.isStatic = vnode.isStatic;
  45161. cloned.key = vnode.key;
  45162. cloned.isComment = vnode.isComment;
  45163. cloned.fnContext = vnode.fnContext;
  45164. cloned.fnOptions = vnode.fnOptions;
  45165. cloned.fnScopeId = vnode.fnScopeId;
  45166. cloned.asyncMeta = vnode.asyncMeta;
  45167. cloned.isCloned = true;
  45168. return cloned
  45169. }
  45170. /*
  45171. * not type checking this file because flow doesn't play well with
  45172. * dynamically accessing methods on Array prototype
  45173. */
  45174. var arrayProto = Array.prototype;
  45175. var arrayMethods = Object.create(arrayProto);
  45176. var methodsToPatch = [
  45177. 'push',
  45178. 'pop',
  45179. 'shift',
  45180. 'unshift',
  45181. 'splice',
  45182. 'sort',
  45183. 'reverse'
  45184. ];
  45185. /**
  45186. * Intercept mutating methods and emit events
  45187. */
  45188. methodsToPatch.forEach(function (method) {
  45189. // cache original method
  45190. var original = arrayProto[method];
  45191. def(arrayMethods, method, function mutator () {
  45192. var args = [], len = arguments.length;
  45193. while ( len-- ) args[ len ] = arguments[ len ];
  45194. var result = original.apply(this, args);
  45195. var ob = this.__ob__;
  45196. var inserted;
  45197. switch (method) {
  45198. case 'push':
  45199. case 'unshift':
  45200. inserted = args;
  45201. break
  45202. case 'splice':
  45203. inserted = args.slice(2);
  45204. break
  45205. }
  45206. if (inserted) { ob.observeArray(inserted); }
  45207. // notify change
  45208. ob.dep.notify();
  45209. return result
  45210. });
  45211. });
  45212. /* */
  45213. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45214. /**
  45215. * In some cases we may want to disable observation inside a component's
  45216. * update computation.
  45217. */
  45218. var shouldObserve = true;
  45219. function toggleObserving (value) {
  45220. shouldObserve = value;
  45221. }
  45222. /**
  45223. * Observer class that is attached to each observed
  45224. * object. Once attached, the observer converts the target
  45225. * object's property keys into getter/setters that
  45226. * collect dependencies and dispatch updates.
  45227. */
  45228. var Observer = function Observer (value) {
  45229. this.value = value;
  45230. this.dep = new Dep();
  45231. this.vmCount = 0;
  45232. def(value, '__ob__', this);
  45233. if (Array.isArray(value)) {
  45234. if (hasProto) {
  45235. protoAugment(value, arrayMethods);
  45236. } else {
  45237. copyAugment(value, arrayMethods, arrayKeys);
  45238. }
  45239. this.observeArray(value);
  45240. } else {
  45241. this.walk(value);
  45242. }
  45243. };
  45244. /**
  45245. * Walk through all properties and convert them into
  45246. * getter/setters. This method should only be called when
  45247. * value type is Object.
  45248. */
  45249. Observer.prototype.walk = function walk (obj) {
  45250. var keys = Object.keys(obj);
  45251. for (var i = 0; i < keys.length; i++) {
  45252. defineReactive$$1(obj, keys[i]);
  45253. }
  45254. };
  45255. /**
  45256. * Observe a list of Array items.
  45257. */
  45258. Observer.prototype.observeArray = function observeArray (items) {
  45259. for (var i = 0, l = items.length; i < l; i++) {
  45260. observe(items[i]);
  45261. }
  45262. };
  45263. // helpers
  45264. /**
  45265. * Augment a target Object or Array by intercepting
  45266. * the prototype chain using __proto__
  45267. */
  45268. function protoAugment (target, src) {
  45269. /* eslint-disable no-proto */
  45270. target.__proto__ = src;
  45271. /* eslint-enable no-proto */
  45272. }
  45273. /**
  45274. * Augment a target Object or Array by defining
  45275. * hidden properties.
  45276. */
  45277. /* istanbul ignore next */
  45278. function copyAugment (target, src, keys) {
  45279. for (var i = 0, l = keys.length; i < l; i++) {
  45280. var key = keys[i];
  45281. def(target, key, src[key]);
  45282. }
  45283. }
  45284. /**
  45285. * Attempt to create an observer instance for a value,
  45286. * returns the new observer if successfully observed,
  45287. * or the existing observer if the value already has one.
  45288. */
  45289. function observe (value, asRootData) {
  45290. if (!isObject(value) || value instanceof VNode) {
  45291. return
  45292. }
  45293. var ob;
  45294. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45295. ob = value.__ob__;
  45296. } else if (
  45297. shouldObserve &&
  45298. !isServerRendering() &&
  45299. (Array.isArray(value) || isPlainObject(value)) &&
  45300. Object.isExtensible(value) &&
  45301. !value._isVue
  45302. ) {
  45303. ob = new Observer(value);
  45304. }
  45305. if (asRootData && ob) {
  45306. ob.vmCount++;
  45307. }
  45308. return ob
  45309. }
  45310. /**
  45311. * Define a reactive property on an Object.
  45312. */
  45313. function defineReactive$$1 (
  45314. obj,
  45315. key,
  45316. val,
  45317. customSetter,
  45318. shallow
  45319. ) {
  45320. var dep = new Dep();
  45321. var property = Object.getOwnPropertyDescriptor(obj, key);
  45322. if (property && property.configurable === false) {
  45323. return
  45324. }
  45325. // cater for pre-defined getter/setters
  45326. var getter = property && property.get;
  45327. var setter = property && property.set;
  45328. if ((!getter || setter) && arguments.length === 2) {
  45329. val = obj[key];
  45330. }
  45331. var childOb = !shallow && observe(val);
  45332. Object.defineProperty(obj, key, {
  45333. enumerable: true,
  45334. configurable: true,
  45335. get: function reactiveGetter () {
  45336. var value = getter ? getter.call(obj) : val;
  45337. if (Dep.target) {
  45338. dep.depend();
  45339. if (childOb) {
  45340. childOb.dep.depend();
  45341. if (Array.isArray(value)) {
  45342. dependArray(value);
  45343. }
  45344. }
  45345. }
  45346. return value
  45347. },
  45348. set: function reactiveSetter (newVal) {
  45349. var value = getter ? getter.call(obj) : val;
  45350. /* eslint-disable no-self-compare */
  45351. if (newVal === value || (newVal !== newVal && value !== value)) {
  45352. return
  45353. }
  45354. /* eslint-enable no-self-compare */
  45355. if (customSetter) {
  45356. customSetter();
  45357. }
  45358. // #7981: for accessor properties without setter
  45359. if (getter && !setter) { return }
  45360. if (setter) {
  45361. setter.call(obj, newVal);
  45362. } else {
  45363. val = newVal;
  45364. }
  45365. childOb = !shallow && observe(newVal);
  45366. dep.notify();
  45367. }
  45368. });
  45369. }
  45370. /**
  45371. * Set a property on an object. Adds the new property and
  45372. * triggers change notification if the property doesn't
  45373. * already exist.
  45374. */
  45375. function set (target, key, val) {
  45376. if (isUndef(target) || isPrimitive(target)
  45377. ) {
  45378. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45379. }
  45380. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45381. target.length = Math.max(target.length, key);
  45382. target.splice(key, 1, val);
  45383. return val
  45384. }
  45385. if (key in target && !(key in Object.prototype)) {
  45386. target[key] = val;
  45387. return val
  45388. }
  45389. var ob = (target).__ob__;
  45390. if (target._isVue || (ob && ob.vmCount)) {
  45391. warn(
  45392. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45393. 'at runtime - declare it upfront in the data option.'
  45394. );
  45395. return val
  45396. }
  45397. if (!ob) {
  45398. target[key] = val;
  45399. return val
  45400. }
  45401. defineReactive$$1(ob.value, key, val);
  45402. ob.dep.notify();
  45403. return val
  45404. }
  45405. /**
  45406. * Delete a property and trigger change if necessary.
  45407. */
  45408. function del (target, key) {
  45409. if (isUndef(target) || isPrimitive(target)
  45410. ) {
  45411. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45412. }
  45413. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45414. target.splice(key, 1);
  45415. return
  45416. }
  45417. var ob = (target).__ob__;
  45418. if (target._isVue || (ob && ob.vmCount)) {
  45419. warn(
  45420. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45421. '- just set it to null.'
  45422. );
  45423. return
  45424. }
  45425. if (!hasOwn(target, key)) {
  45426. return
  45427. }
  45428. delete target[key];
  45429. if (!ob) {
  45430. return
  45431. }
  45432. ob.dep.notify();
  45433. }
  45434. /**
  45435. * Collect dependencies on array elements when the array is touched, since
  45436. * we cannot intercept array element access like property getters.
  45437. */
  45438. function dependArray (value) {
  45439. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45440. e = value[i];
  45441. e && e.__ob__ && e.__ob__.dep.depend();
  45442. if (Array.isArray(e)) {
  45443. dependArray(e);
  45444. }
  45445. }
  45446. }
  45447. /* */
  45448. /**
  45449. * Option overwriting strategies are functions that handle
  45450. * how to merge a parent option value and a child option
  45451. * value into the final value.
  45452. */
  45453. var strats = config.optionMergeStrategies;
  45454. /**
  45455. * Options with restrictions
  45456. */
  45457. {
  45458. strats.el = strats.propsData = function (parent, child, vm, key) {
  45459. if (!vm) {
  45460. warn(
  45461. "option \"" + key + "\" can only be used during instance " +
  45462. 'creation with the `new` keyword.'
  45463. );
  45464. }
  45465. return defaultStrat(parent, child)
  45466. };
  45467. }
  45468. /**
  45469. * Helper that recursively merges two data objects together.
  45470. */
  45471. function mergeData (to, from) {
  45472. if (!from) { return to }
  45473. var key, toVal, fromVal;
  45474. var keys = hasSymbol
  45475. ? Reflect.ownKeys(from)
  45476. : Object.keys(from);
  45477. for (var i = 0; i < keys.length; i++) {
  45478. key = keys[i];
  45479. // in case the object is already observed...
  45480. if (key === '__ob__') { continue }
  45481. toVal = to[key];
  45482. fromVal = from[key];
  45483. if (!hasOwn(to, key)) {
  45484. set(to, key, fromVal);
  45485. } else if (
  45486. toVal !== fromVal &&
  45487. isPlainObject(toVal) &&
  45488. isPlainObject(fromVal)
  45489. ) {
  45490. mergeData(toVal, fromVal);
  45491. }
  45492. }
  45493. return to
  45494. }
  45495. /**
  45496. * Data
  45497. */
  45498. function mergeDataOrFn (
  45499. parentVal,
  45500. childVal,
  45501. vm
  45502. ) {
  45503. if (!vm) {
  45504. // in a Vue.extend merge, both should be functions
  45505. if (!childVal) {
  45506. return parentVal
  45507. }
  45508. if (!parentVal) {
  45509. return childVal
  45510. }
  45511. // when parentVal & childVal are both present,
  45512. // we need to return a function that returns the
  45513. // merged result of both functions... no need to
  45514. // check if parentVal is a function here because
  45515. // it has to be a function to pass previous merges.
  45516. return function mergedDataFn () {
  45517. return mergeData(
  45518. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45519. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45520. )
  45521. }
  45522. } else {
  45523. return function mergedInstanceDataFn () {
  45524. // instance merge
  45525. var instanceData = typeof childVal === 'function'
  45526. ? childVal.call(vm, vm)
  45527. : childVal;
  45528. var defaultData = typeof parentVal === 'function'
  45529. ? parentVal.call(vm, vm)
  45530. : parentVal;
  45531. if (instanceData) {
  45532. return mergeData(instanceData, defaultData)
  45533. } else {
  45534. return defaultData
  45535. }
  45536. }
  45537. }
  45538. }
  45539. strats.data = function (
  45540. parentVal,
  45541. childVal,
  45542. vm
  45543. ) {
  45544. if (!vm) {
  45545. if (childVal && typeof childVal !== 'function') {
  45546. warn(
  45547. 'The "data" option should be a function ' +
  45548. 'that returns a per-instance value in component ' +
  45549. 'definitions.',
  45550. vm
  45551. );
  45552. return parentVal
  45553. }
  45554. return mergeDataOrFn(parentVal, childVal)
  45555. }
  45556. return mergeDataOrFn(parentVal, childVal, vm)
  45557. };
  45558. /**
  45559. * Hooks and props are merged as arrays.
  45560. */
  45561. function mergeHook (
  45562. parentVal,
  45563. childVal
  45564. ) {
  45565. var res = childVal
  45566. ? parentVal
  45567. ? parentVal.concat(childVal)
  45568. : Array.isArray(childVal)
  45569. ? childVal
  45570. : [childVal]
  45571. : parentVal;
  45572. return res
  45573. ? dedupeHooks(res)
  45574. : res
  45575. }
  45576. function dedupeHooks (hooks) {
  45577. var res = [];
  45578. for (var i = 0; i < hooks.length; i++) {
  45579. if (res.indexOf(hooks[i]) === -1) {
  45580. res.push(hooks[i]);
  45581. }
  45582. }
  45583. return res
  45584. }
  45585. LIFECYCLE_HOOKS.forEach(function (hook) {
  45586. strats[hook] = mergeHook;
  45587. });
  45588. /**
  45589. * Assets
  45590. *
  45591. * When a vm is present (instance creation), we need to do
  45592. * a three-way merge between constructor options, instance
  45593. * options and parent options.
  45594. */
  45595. function mergeAssets (
  45596. parentVal,
  45597. childVal,
  45598. vm,
  45599. key
  45600. ) {
  45601. var res = Object.create(parentVal || null);
  45602. if (childVal) {
  45603. assertObjectType(key, childVal, vm);
  45604. return extend(res, childVal)
  45605. } else {
  45606. return res
  45607. }
  45608. }
  45609. ASSET_TYPES.forEach(function (type) {
  45610. strats[type + 's'] = mergeAssets;
  45611. });
  45612. /**
  45613. * Watchers.
  45614. *
  45615. * Watchers hashes should not overwrite one
  45616. * another, so we merge them as arrays.
  45617. */
  45618. strats.watch = function (
  45619. parentVal,
  45620. childVal,
  45621. vm,
  45622. key
  45623. ) {
  45624. // work around Firefox's Object.prototype.watch...
  45625. if (parentVal === nativeWatch) { parentVal = undefined; }
  45626. if (childVal === nativeWatch) { childVal = undefined; }
  45627. /* istanbul ignore if */
  45628. if (!childVal) { return Object.create(parentVal || null) }
  45629. {
  45630. assertObjectType(key, childVal, vm);
  45631. }
  45632. if (!parentVal) { return childVal }
  45633. var ret = {};
  45634. extend(ret, parentVal);
  45635. for (var key$1 in childVal) {
  45636. var parent = ret[key$1];
  45637. var child = childVal[key$1];
  45638. if (parent && !Array.isArray(parent)) {
  45639. parent = [parent];
  45640. }
  45641. ret[key$1] = parent
  45642. ? parent.concat(child)
  45643. : Array.isArray(child) ? child : [child];
  45644. }
  45645. return ret
  45646. };
  45647. /**
  45648. * Other object hashes.
  45649. */
  45650. strats.props =
  45651. strats.methods =
  45652. strats.inject =
  45653. strats.computed = function (
  45654. parentVal,
  45655. childVal,
  45656. vm,
  45657. key
  45658. ) {
  45659. if (childVal && "development" !== 'production') {
  45660. assertObjectType(key, childVal, vm);
  45661. }
  45662. if (!parentVal) { return childVal }
  45663. var ret = Object.create(null);
  45664. extend(ret, parentVal);
  45665. if (childVal) { extend(ret, childVal); }
  45666. return ret
  45667. };
  45668. strats.provide = mergeDataOrFn;
  45669. /**
  45670. * Default strategy.
  45671. */
  45672. var defaultStrat = function (parentVal, childVal) {
  45673. return childVal === undefined
  45674. ? parentVal
  45675. : childVal
  45676. };
  45677. /**
  45678. * Validate component names
  45679. */
  45680. function checkComponents (options) {
  45681. for (var key in options.components) {
  45682. validateComponentName(key);
  45683. }
  45684. }
  45685. function validateComponentName (name) {
  45686. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45687. warn(
  45688. 'Invalid component name: "' + name + '". Component names ' +
  45689. 'should conform to valid custom element name in html5 specification.'
  45690. );
  45691. }
  45692. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45693. warn(
  45694. 'Do not use built-in or reserved HTML elements as component ' +
  45695. 'id: ' + name
  45696. );
  45697. }
  45698. }
  45699. /**
  45700. * Ensure all props option syntax are normalized into the
  45701. * Object-based format.
  45702. */
  45703. function normalizeProps (options, vm) {
  45704. var props = options.props;
  45705. if (!props) { return }
  45706. var res = {};
  45707. var i, val, name;
  45708. if (Array.isArray(props)) {
  45709. i = props.length;
  45710. while (i--) {
  45711. val = props[i];
  45712. if (typeof val === 'string') {
  45713. name = camelize(val);
  45714. res[name] = { type: null };
  45715. } else {
  45716. warn('props must be strings when using array syntax.');
  45717. }
  45718. }
  45719. } else if (isPlainObject(props)) {
  45720. for (var key in props) {
  45721. val = props[key];
  45722. name = camelize(key);
  45723. res[name] = isPlainObject(val)
  45724. ? val
  45725. : { type: val };
  45726. }
  45727. } else {
  45728. warn(
  45729. "Invalid value for option \"props\": expected an Array or an Object, " +
  45730. "but got " + (toRawType(props)) + ".",
  45731. vm
  45732. );
  45733. }
  45734. options.props = res;
  45735. }
  45736. /**
  45737. * Normalize all injections into Object-based format
  45738. */
  45739. function normalizeInject (options, vm) {
  45740. var inject = options.inject;
  45741. if (!inject) { return }
  45742. var normalized = options.inject = {};
  45743. if (Array.isArray(inject)) {
  45744. for (var i = 0; i < inject.length; i++) {
  45745. normalized[inject[i]] = { from: inject[i] };
  45746. }
  45747. } else if (isPlainObject(inject)) {
  45748. for (var key in inject) {
  45749. var val = inject[key];
  45750. normalized[key] = isPlainObject(val)
  45751. ? extend({ from: key }, val)
  45752. : { from: val };
  45753. }
  45754. } else {
  45755. warn(
  45756. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45757. "but got " + (toRawType(inject)) + ".",
  45758. vm
  45759. );
  45760. }
  45761. }
  45762. /**
  45763. * Normalize raw function directives into object format.
  45764. */
  45765. function normalizeDirectives (options) {
  45766. var dirs = options.directives;
  45767. if (dirs) {
  45768. for (var key in dirs) {
  45769. var def$$1 = dirs[key];
  45770. if (typeof def$$1 === 'function') {
  45771. dirs[key] = { bind: def$$1, update: def$$1 };
  45772. }
  45773. }
  45774. }
  45775. }
  45776. function assertObjectType (name, value, vm) {
  45777. if (!isPlainObject(value)) {
  45778. warn(
  45779. "Invalid value for option \"" + name + "\": expected an Object, " +
  45780. "but got " + (toRawType(value)) + ".",
  45781. vm
  45782. );
  45783. }
  45784. }
  45785. /**
  45786. * Merge two option objects into a new one.
  45787. * Core utility used in both instantiation and inheritance.
  45788. */
  45789. function mergeOptions (
  45790. parent,
  45791. child,
  45792. vm
  45793. ) {
  45794. {
  45795. checkComponents(child);
  45796. }
  45797. if (typeof child === 'function') {
  45798. child = child.options;
  45799. }
  45800. normalizeProps(child, vm);
  45801. normalizeInject(child, vm);
  45802. normalizeDirectives(child);
  45803. // Apply extends and mixins on the child options,
  45804. // but only if it is a raw options object that isn't
  45805. // the result of another mergeOptions call.
  45806. // Only merged options has the _base property.
  45807. if (!child._base) {
  45808. if (child.extends) {
  45809. parent = mergeOptions(parent, child.extends, vm);
  45810. }
  45811. if (child.mixins) {
  45812. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45813. parent = mergeOptions(parent, child.mixins[i], vm);
  45814. }
  45815. }
  45816. }
  45817. var options = {};
  45818. var key;
  45819. for (key in parent) {
  45820. mergeField(key);
  45821. }
  45822. for (key in child) {
  45823. if (!hasOwn(parent, key)) {
  45824. mergeField(key);
  45825. }
  45826. }
  45827. function mergeField (key) {
  45828. var strat = strats[key] || defaultStrat;
  45829. options[key] = strat(parent[key], child[key], vm, key);
  45830. }
  45831. return options
  45832. }
  45833. /**
  45834. * Resolve an asset.
  45835. * This function is used because child instances need access
  45836. * to assets defined in its ancestor chain.
  45837. */
  45838. function resolveAsset (
  45839. options,
  45840. type,
  45841. id,
  45842. warnMissing
  45843. ) {
  45844. /* istanbul ignore if */
  45845. if (typeof id !== 'string') {
  45846. return
  45847. }
  45848. var assets = options[type];
  45849. // check local registration variations first
  45850. if (hasOwn(assets, id)) { return assets[id] }
  45851. var camelizedId = camelize(id);
  45852. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45853. var PascalCaseId = capitalize(camelizedId);
  45854. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45855. // fallback to prototype chain
  45856. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45857. if (warnMissing && !res) {
  45858. warn(
  45859. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45860. options
  45861. );
  45862. }
  45863. return res
  45864. }
  45865. /* */
  45866. function validateProp (
  45867. key,
  45868. propOptions,
  45869. propsData,
  45870. vm
  45871. ) {
  45872. var prop = propOptions[key];
  45873. var absent = !hasOwn(propsData, key);
  45874. var value = propsData[key];
  45875. // boolean casting
  45876. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45877. if (booleanIndex > -1) {
  45878. if (absent && !hasOwn(prop, 'default')) {
  45879. value = false;
  45880. } else if (value === '' || value === hyphenate(key)) {
  45881. // only cast empty string / same name to boolean if
  45882. // boolean has higher priority
  45883. var stringIndex = getTypeIndex(String, prop.type);
  45884. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45885. value = true;
  45886. }
  45887. }
  45888. }
  45889. // check default value
  45890. if (value === undefined) {
  45891. value = getPropDefaultValue(vm, prop, key);
  45892. // since the default value is a fresh copy,
  45893. // make sure to observe it.
  45894. var prevShouldObserve = shouldObserve;
  45895. toggleObserving(true);
  45896. observe(value);
  45897. toggleObserving(prevShouldObserve);
  45898. }
  45899. {
  45900. assertProp(prop, key, value, vm, absent);
  45901. }
  45902. return value
  45903. }
  45904. /**
  45905. * Get the default value of a prop.
  45906. */
  45907. function getPropDefaultValue (vm, prop, key) {
  45908. // no default, return undefined
  45909. if (!hasOwn(prop, 'default')) {
  45910. return undefined
  45911. }
  45912. var def = prop.default;
  45913. // warn against non-factory defaults for Object & Array
  45914. if (isObject(def)) {
  45915. warn(
  45916. 'Invalid default value for prop "' + key + '": ' +
  45917. 'Props with type Object/Array must use a factory function ' +
  45918. 'to return the default value.',
  45919. vm
  45920. );
  45921. }
  45922. // the raw prop value was also undefined from previous render,
  45923. // return previous default value to avoid unnecessary watcher trigger
  45924. if (vm && vm.$options.propsData &&
  45925. vm.$options.propsData[key] === undefined &&
  45926. vm._props[key] !== undefined
  45927. ) {
  45928. return vm._props[key]
  45929. }
  45930. // call factory function for non-Function types
  45931. // a value is Function if its prototype is function even across different execution context
  45932. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45933. ? def.call(vm)
  45934. : def
  45935. }
  45936. /**
  45937. * Assert whether a prop is valid.
  45938. */
  45939. function assertProp (
  45940. prop,
  45941. name,
  45942. value,
  45943. vm,
  45944. absent
  45945. ) {
  45946. if (prop.required && absent) {
  45947. warn(
  45948. 'Missing required prop: "' + name + '"',
  45949. vm
  45950. );
  45951. return
  45952. }
  45953. if (value == null && !prop.required) {
  45954. return
  45955. }
  45956. var type = prop.type;
  45957. var valid = !type || type === true;
  45958. var expectedTypes = [];
  45959. if (type) {
  45960. if (!Array.isArray(type)) {
  45961. type = [type];
  45962. }
  45963. for (var i = 0; i < type.length && !valid; i++) {
  45964. var assertedType = assertType(value, type[i]);
  45965. expectedTypes.push(assertedType.expectedType || '');
  45966. valid = assertedType.valid;
  45967. }
  45968. }
  45969. if (!valid) {
  45970. warn(
  45971. getInvalidTypeMessage(name, value, expectedTypes),
  45972. vm
  45973. );
  45974. return
  45975. }
  45976. var validator = prop.validator;
  45977. if (validator) {
  45978. if (!validator(value)) {
  45979. warn(
  45980. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45981. vm
  45982. );
  45983. }
  45984. }
  45985. }
  45986. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45987. function assertType (value, type) {
  45988. var valid;
  45989. var expectedType = getType(type);
  45990. if (simpleCheckRE.test(expectedType)) {
  45991. var t = typeof value;
  45992. valid = t === expectedType.toLowerCase();
  45993. // for primitive wrapper objects
  45994. if (!valid && t === 'object') {
  45995. valid = value instanceof type;
  45996. }
  45997. } else if (expectedType === 'Object') {
  45998. valid = isPlainObject(value);
  45999. } else if (expectedType === 'Array') {
  46000. valid = Array.isArray(value);
  46001. } else {
  46002. valid = value instanceof type;
  46003. }
  46004. return {
  46005. valid: valid,
  46006. expectedType: expectedType
  46007. }
  46008. }
  46009. /**
  46010. * Use function string name to check built-in types,
  46011. * because a simple equality check will fail when running
  46012. * across different vms / iframes.
  46013. */
  46014. function getType (fn) {
  46015. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46016. return match ? match[1] : ''
  46017. }
  46018. function isSameType (a, b) {
  46019. return getType(a) === getType(b)
  46020. }
  46021. function getTypeIndex (type, expectedTypes) {
  46022. if (!Array.isArray(expectedTypes)) {
  46023. return isSameType(expectedTypes, type) ? 0 : -1
  46024. }
  46025. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46026. if (isSameType(expectedTypes[i], type)) {
  46027. return i
  46028. }
  46029. }
  46030. return -1
  46031. }
  46032. function getInvalidTypeMessage (name, value, expectedTypes) {
  46033. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46034. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46035. var expectedType = expectedTypes[0];
  46036. var receivedType = toRawType(value);
  46037. var expectedValue = styleValue(value, expectedType);
  46038. var receivedValue = styleValue(value, receivedType);
  46039. // check if we need to specify expected value
  46040. if (expectedTypes.length === 1 &&
  46041. isExplicable(expectedType) &&
  46042. !isBoolean(expectedType, receivedType)) {
  46043. message += " with value " + expectedValue;
  46044. }
  46045. message += ", got " + receivedType + " ";
  46046. // check if we need to specify received value
  46047. if (isExplicable(receivedType)) {
  46048. message += "with value " + receivedValue + ".";
  46049. }
  46050. return message
  46051. }
  46052. function styleValue (value, type) {
  46053. if (type === 'String') {
  46054. return ("\"" + value + "\"")
  46055. } else if (type === 'Number') {
  46056. return ("" + (Number(value)))
  46057. } else {
  46058. return ("" + value)
  46059. }
  46060. }
  46061. function isExplicable (value) {
  46062. var explicitTypes = ['string', 'number', 'boolean'];
  46063. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46064. }
  46065. function isBoolean () {
  46066. var args = [], len = arguments.length;
  46067. while ( len-- ) args[ len ] = arguments[ len ];
  46068. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46069. }
  46070. /* */
  46071. function handleError (err, vm, info) {
  46072. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46073. // See: https://github.com/vuejs/vuex/issues/1505
  46074. pushTarget();
  46075. try {
  46076. if (vm) {
  46077. var cur = vm;
  46078. while ((cur = cur.$parent)) {
  46079. var hooks = cur.$options.errorCaptured;
  46080. if (hooks) {
  46081. for (var i = 0; i < hooks.length; i++) {
  46082. try {
  46083. var capture = hooks[i].call(cur, err, vm, info) === false;
  46084. if (capture) { return }
  46085. } catch (e) {
  46086. globalHandleError(e, cur, 'errorCaptured hook');
  46087. }
  46088. }
  46089. }
  46090. }
  46091. }
  46092. globalHandleError(err, vm, info);
  46093. } finally {
  46094. popTarget();
  46095. }
  46096. }
  46097. function invokeWithErrorHandling (
  46098. handler,
  46099. context,
  46100. args,
  46101. vm,
  46102. info
  46103. ) {
  46104. var res;
  46105. try {
  46106. res = args ? handler.apply(context, args) : handler.call(context);
  46107. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46108. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46109. // issue #9511
  46110. // avoid catch triggering multiple times when nested calls
  46111. res._handled = true;
  46112. }
  46113. } catch (e) {
  46114. handleError(e, vm, info);
  46115. }
  46116. return res
  46117. }
  46118. function globalHandleError (err, vm, info) {
  46119. if (config.errorHandler) {
  46120. try {
  46121. return config.errorHandler.call(null, err, vm, info)
  46122. } catch (e) {
  46123. // if the user intentionally throws the original error in the handler,
  46124. // do not log it twice
  46125. if (e !== err) {
  46126. logError(e, null, 'config.errorHandler');
  46127. }
  46128. }
  46129. }
  46130. logError(err, vm, info);
  46131. }
  46132. function logError (err, vm, info) {
  46133. {
  46134. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46135. }
  46136. /* istanbul ignore else */
  46137. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46138. console.error(err);
  46139. } else {
  46140. throw err
  46141. }
  46142. }
  46143. /* */
  46144. var isUsingMicroTask = false;
  46145. var callbacks = [];
  46146. var pending = false;
  46147. function flushCallbacks () {
  46148. pending = false;
  46149. var copies = callbacks.slice(0);
  46150. callbacks.length = 0;
  46151. for (var i = 0; i < copies.length; i++) {
  46152. copies[i]();
  46153. }
  46154. }
  46155. // Here we have async deferring wrappers using microtasks.
  46156. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46157. // However, it has subtle problems when state is changed right before repaint
  46158. // (e.g. #6813, out-in transitions).
  46159. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46160. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46161. // So we now use microtasks everywhere, again.
  46162. // A major drawback of this tradeoff is that there are some scenarios
  46163. // where microtasks have too high a priority and fire in between supposedly
  46164. // sequential events (e.g. #4521, #6690, which have workarounds)
  46165. // or even between bubbling of the same event (#6566).
  46166. var timerFunc;
  46167. // The nextTick behavior leverages the microtask queue, which can be accessed
  46168. // via either native Promise.then or MutationObserver.
  46169. // MutationObserver has wider support, however it is seriously bugged in
  46170. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46171. // completely stops working after triggering a few times... so, if native
  46172. // Promise is available, we will use it:
  46173. /* istanbul ignore next, $flow-disable-line */
  46174. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46175. var p = Promise.resolve();
  46176. timerFunc = function () {
  46177. p.then(flushCallbacks);
  46178. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46179. // it can get stuck in a weird state where callbacks are pushed into the
  46180. // microtask queue but the queue isn't being flushed, until the browser
  46181. // needs to do some other work, e.g. handle a timer. Therefore we can
  46182. // "force" the microtask queue to be flushed by adding an empty timer.
  46183. if (isIOS) { setTimeout(noop); }
  46184. };
  46185. isUsingMicroTask = true;
  46186. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46187. isNative(MutationObserver) ||
  46188. // PhantomJS and iOS 7.x
  46189. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46190. )) {
  46191. // Use MutationObserver where native Promise is not available,
  46192. // e.g. PhantomJS, iOS7, Android 4.4
  46193. // (#6466 MutationObserver is unreliable in IE11)
  46194. var counter = 1;
  46195. var observer = new MutationObserver(flushCallbacks);
  46196. var textNode = document.createTextNode(String(counter));
  46197. observer.observe(textNode, {
  46198. characterData: true
  46199. });
  46200. timerFunc = function () {
  46201. counter = (counter + 1) % 2;
  46202. textNode.data = String(counter);
  46203. };
  46204. isUsingMicroTask = true;
  46205. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46206. // Fallback to setImmediate.
  46207. // Technically it leverages the (macro) task queue,
  46208. // but it is still a better choice than setTimeout.
  46209. timerFunc = function () {
  46210. setImmediate(flushCallbacks);
  46211. };
  46212. } else {
  46213. // Fallback to setTimeout.
  46214. timerFunc = function () {
  46215. setTimeout(flushCallbacks, 0);
  46216. };
  46217. }
  46218. function nextTick (cb, ctx) {
  46219. var _resolve;
  46220. callbacks.push(function () {
  46221. if (cb) {
  46222. try {
  46223. cb.call(ctx);
  46224. } catch (e) {
  46225. handleError(e, ctx, 'nextTick');
  46226. }
  46227. } else if (_resolve) {
  46228. _resolve(ctx);
  46229. }
  46230. });
  46231. if (!pending) {
  46232. pending = true;
  46233. timerFunc();
  46234. }
  46235. // $flow-disable-line
  46236. if (!cb && typeof Promise !== 'undefined') {
  46237. return new Promise(function (resolve) {
  46238. _resolve = resolve;
  46239. })
  46240. }
  46241. }
  46242. /* */
  46243. var mark;
  46244. var measure;
  46245. {
  46246. var perf = inBrowser && window.performance;
  46247. /* istanbul ignore if */
  46248. if (
  46249. perf &&
  46250. perf.mark &&
  46251. perf.measure &&
  46252. perf.clearMarks &&
  46253. perf.clearMeasures
  46254. ) {
  46255. mark = function (tag) { return perf.mark(tag); };
  46256. measure = function (name, startTag, endTag) {
  46257. perf.measure(name, startTag, endTag);
  46258. perf.clearMarks(startTag);
  46259. perf.clearMarks(endTag);
  46260. // perf.clearMeasures(name)
  46261. };
  46262. }
  46263. }
  46264. /* not type checking this file because flow doesn't play well with Proxy */
  46265. var initProxy;
  46266. {
  46267. var allowedGlobals = makeMap(
  46268. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46269. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46270. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46271. 'require' // for Webpack/Browserify
  46272. );
  46273. var warnNonPresent = function (target, key) {
  46274. warn(
  46275. "Property or method \"" + key + "\" is not defined on the instance but " +
  46276. 'referenced during render. Make sure that this property is reactive, ' +
  46277. 'either in the data option, or for class-based components, by ' +
  46278. 'initializing the property. ' +
  46279. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46280. target
  46281. );
  46282. };
  46283. var warnReservedPrefix = function (target, key) {
  46284. warn(
  46285. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46286. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46287. 'prevent conflicts with Vue internals. ' +
  46288. 'See: https://vuejs.org/v2/api/#data',
  46289. target
  46290. );
  46291. };
  46292. var hasProxy =
  46293. typeof Proxy !== 'undefined' && isNative(Proxy);
  46294. if (hasProxy) {
  46295. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46296. config.keyCodes = new Proxy(config.keyCodes, {
  46297. set: function set (target, key, value) {
  46298. if (isBuiltInModifier(key)) {
  46299. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46300. return false
  46301. } else {
  46302. target[key] = value;
  46303. return true
  46304. }
  46305. }
  46306. });
  46307. }
  46308. var hasHandler = {
  46309. has: function has (target, key) {
  46310. var has = key in target;
  46311. var isAllowed = allowedGlobals(key) ||
  46312. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46313. if (!has && !isAllowed) {
  46314. if (key in target.$data) { warnReservedPrefix(target, key); }
  46315. else { warnNonPresent(target, key); }
  46316. }
  46317. return has || !isAllowed
  46318. }
  46319. };
  46320. var getHandler = {
  46321. get: function get (target, key) {
  46322. if (typeof key === 'string' && !(key in target)) {
  46323. if (key in target.$data) { warnReservedPrefix(target, key); }
  46324. else { warnNonPresent(target, key); }
  46325. }
  46326. return target[key]
  46327. }
  46328. };
  46329. initProxy = function initProxy (vm) {
  46330. if (hasProxy) {
  46331. // determine which proxy handler to use
  46332. var options = vm.$options;
  46333. var handlers = options.render && options.render._withStripped
  46334. ? getHandler
  46335. : hasHandler;
  46336. vm._renderProxy = new Proxy(vm, handlers);
  46337. } else {
  46338. vm._renderProxy = vm;
  46339. }
  46340. };
  46341. }
  46342. /* */
  46343. var seenObjects = new _Set();
  46344. /**
  46345. * Recursively traverse an object to evoke all converted
  46346. * getters, so that every nested property inside the object
  46347. * is collected as a "deep" dependency.
  46348. */
  46349. function traverse (val) {
  46350. _traverse(val, seenObjects);
  46351. seenObjects.clear();
  46352. }
  46353. function _traverse (val, seen) {
  46354. var i, keys;
  46355. var isA = Array.isArray(val);
  46356. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46357. return
  46358. }
  46359. if (val.__ob__) {
  46360. var depId = val.__ob__.dep.id;
  46361. if (seen.has(depId)) {
  46362. return
  46363. }
  46364. seen.add(depId);
  46365. }
  46366. if (isA) {
  46367. i = val.length;
  46368. while (i--) { _traverse(val[i], seen); }
  46369. } else {
  46370. keys = Object.keys(val);
  46371. i = keys.length;
  46372. while (i--) { _traverse(val[keys[i]], seen); }
  46373. }
  46374. }
  46375. /* */
  46376. var normalizeEvent = cached(function (name) {
  46377. var passive = name.charAt(0) === '&';
  46378. name = passive ? name.slice(1) : name;
  46379. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46380. name = once$$1 ? name.slice(1) : name;
  46381. var capture = name.charAt(0) === '!';
  46382. name = capture ? name.slice(1) : name;
  46383. return {
  46384. name: name,
  46385. once: once$$1,
  46386. capture: capture,
  46387. passive: passive
  46388. }
  46389. });
  46390. function createFnInvoker (fns, vm) {
  46391. function invoker () {
  46392. var arguments$1 = arguments;
  46393. var fns = invoker.fns;
  46394. if (Array.isArray(fns)) {
  46395. var cloned = fns.slice();
  46396. for (var i = 0; i < cloned.length; i++) {
  46397. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46398. }
  46399. } else {
  46400. // return handler return value for single handlers
  46401. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46402. }
  46403. }
  46404. invoker.fns = fns;
  46405. return invoker
  46406. }
  46407. function updateListeners (
  46408. on,
  46409. oldOn,
  46410. add,
  46411. remove$$1,
  46412. createOnceHandler,
  46413. vm
  46414. ) {
  46415. var name, def$$1, cur, old, event;
  46416. for (name in on) {
  46417. def$$1 = cur = on[name];
  46418. old = oldOn[name];
  46419. event = normalizeEvent(name);
  46420. if (isUndef(cur)) {
  46421. warn(
  46422. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46423. vm
  46424. );
  46425. } else if (isUndef(old)) {
  46426. if (isUndef(cur.fns)) {
  46427. cur = on[name] = createFnInvoker(cur, vm);
  46428. }
  46429. if (isTrue(event.once)) {
  46430. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46431. }
  46432. add(event.name, cur, event.capture, event.passive, event.params);
  46433. } else if (cur !== old) {
  46434. old.fns = cur;
  46435. on[name] = old;
  46436. }
  46437. }
  46438. for (name in oldOn) {
  46439. if (isUndef(on[name])) {
  46440. event = normalizeEvent(name);
  46441. remove$$1(event.name, oldOn[name], event.capture);
  46442. }
  46443. }
  46444. }
  46445. /* */
  46446. function mergeVNodeHook (def, hookKey, hook) {
  46447. if (def instanceof VNode) {
  46448. def = def.data.hook || (def.data.hook = {});
  46449. }
  46450. var invoker;
  46451. var oldHook = def[hookKey];
  46452. function wrappedHook () {
  46453. hook.apply(this, arguments);
  46454. // important: remove merged hook to ensure it's called only once
  46455. // and prevent memory leak
  46456. remove(invoker.fns, wrappedHook);
  46457. }
  46458. if (isUndef(oldHook)) {
  46459. // no existing hook
  46460. invoker = createFnInvoker([wrappedHook]);
  46461. } else {
  46462. /* istanbul ignore if */
  46463. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46464. // already a merged invoker
  46465. invoker = oldHook;
  46466. invoker.fns.push(wrappedHook);
  46467. } else {
  46468. // existing plain hook
  46469. invoker = createFnInvoker([oldHook, wrappedHook]);
  46470. }
  46471. }
  46472. invoker.merged = true;
  46473. def[hookKey] = invoker;
  46474. }
  46475. /* */
  46476. function extractPropsFromVNodeData (
  46477. data,
  46478. Ctor,
  46479. tag
  46480. ) {
  46481. // we are only extracting raw values here.
  46482. // validation and default values are handled in the child
  46483. // component itself.
  46484. var propOptions = Ctor.options.props;
  46485. if (isUndef(propOptions)) {
  46486. return
  46487. }
  46488. var res = {};
  46489. var attrs = data.attrs;
  46490. var props = data.props;
  46491. if (isDef(attrs) || isDef(props)) {
  46492. for (var key in propOptions) {
  46493. var altKey = hyphenate(key);
  46494. {
  46495. var keyInLowerCase = key.toLowerCase();
  46496. if (
  46497. key !== keyInLowerCase &&
  46498. attrs && hasOwn(attrs, keyInLowerCase)
  46499. ) {
  46500. tip(
  46501. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46502. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46503. " \"" + key + "\". " +
  46504. "Note that HTML attributes are case-insensitive and camelCased " +
  46505. "props need to use their kebab-case equivalents when using in-DOM " +
  46506. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46507. );
  46508. }
  46509. }
  46510. checkProp(res, props, key, altKey, true) ||
  46511. checkProp(res, attrs, key, altKey, false);
  46512. }
  46513. }
  46514. return res
  46515. }
  46516. function checkProp (
  46517. res,
  46518. hash,
  46519. key,
  46520. altKey,
  46521. preserve
  46522. ) {
  46523. if (isDef(hash)) {
  46524. if (hasOwn(hash, key)) {
  46525. res[key] = hash[key];
  46526. if (!preserve) {
  46527. delete hash[key];
  46528. }
  46529. return true
  46530. } else if (hasOwn(hash, altKey)) {
  46531. res[key] = hash[altKey];
  46532. if (!preserve) {
  46533. delete hash[altKey];
  46534. }
  46535. return true
  46536. }
  46537. }
  46538. return false
  46539. }
  46540. /* */
  46541. // The template compiler attempts to minimize the need for normalization by
  46542. // statically analyzing the template at compile time.
  46543. //
  46544. // For plain HTML markup, normalization can be completely skipped because the
  46545. // generated render function is guaranteed to return Array<VNode>. There are
  46546. // two cases where extra normalization is needed:
  46547. // 1. When the children contains components - because a functional component
  46548. // may return an Array instead of a single root. In this case, just a simple
  46549. // normalization is needed - if any child is an Array, we flatten the whole
  46550. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46551. // because functional components already normalize their own children.
  46552. function simpleNormalizeChildren (children) {
  46553. for (var i = 0; i < children.length; i++) {
  46554. if (Array.isArray(children[i])) {
  46555. return Array.prototype.concat.apply([], children)
  46556. }
  46557. }
  46558. return children
  46559. }
  46560. // 2. When the children contains constructs that always generated nested Arrays,
  46561. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46562. // with hand-written render functions / JSX. In such cases a full normalization
  46563. // is needed to cater to all possible types of children values.
  46564. function normalizeChildren (children) {
  46565. return isPrimitive(children)
  46566. ? [createTextVNode(children)]
  46567. : Array.isArray(children)
  46568. ? normalizeArrayChildren(children)
  46569. : undefined
  46570. }
  46571. function isTextNode (node) {
  46572. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46573. }
  46574. function normalizeArrayChildren (children, nestedIndex) {
  46575. var res = [];
  46576. var i, c, lastIndex, last;
  46577. for (i = 0; i < children.length; i++) {
  46578. c = children[i];
  46579. if (isUndef(c) || typeof c === 'boolean') { continue }
  46580. lastIndex = res.length - 1;
  46581. last = res[lastIndex];
  46582. // nested
  46583. if (Array.isArray(c)) {
  46584. if (c.length > 0) {
  46585. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46586. // merge adjacent text nodes
  46587. if (isTextNode(c[0]) && isTextNode(last)) {
  46588. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46589. c.shift();
  46590. }
  46591. res.push.apply(res, c);
  46592. }
  46593. } else if (isPrimitive(c)) {
  46594. if (isTextNode(last)) {
  46595. // merge adjacent text nodes
  46596. // this is necessary for SSR hydration because text nodes are
  46597. // essentially merged when rendered to HTML strings
  46598. res[lastIndex] = createTextVNode(last.text + c);
  46599. } else if (c !== '') {
  46600. // convert primitive to vnode
  46601. res.push(createTextVNode(c));
  46602. }
  46603. } else {
  46604. if (isTextNode(c) && isTextNode(last)) {
  46605. // merge adjacent text nodes
  46606. res[lastIndex] = createTextVNode(last.text + c.text);
  46607. } else {
  46608. // default key for nested array children (likely generated by v-for)
  46609. if (isTrue(children._isVList) &&
  46610. isDef(c.tag) &&
  46611. isUndef(c.key) &&
  46612. isDef(nestedIndex)) {
  46613. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46614. }
  46615. res.push(c);
  46616. }
  46617. }
  46618. }
  46619. return res
  46620. }
  46621. /* */
  46622. function initProvide (vm) {
  46623. var provide = vm.$options.provide;
  46624. if (provide) {
  46625. vm._provided = typeof provide === 'function'
  46626. ? provide.call(vm)
  46627. : provide;
  46628. }
  46629. }
  46630. function initInjections (vm) {
  46631. var result = resolveInject(vm.$options.inject, vm);
  46632. if (result) {
  46633. toggleObserving(false);
  46634. Object.keys(result).forEach(function (key) {
  46635. /* istanbul ignore else */
  46636. {
  46637. defineReactive$$1(vm, key, result[key], function () {
  46638. warn(
  46639. "Avoid mutating an injected value directly since the changes will be " +
  46640. "overwritten whenever the provided component re-renders. " +
  46641. "injection being mutated: \"" + key + "\"",
  46642. vm
  46643. );
  46644. });
  46645. }
  46646. });
  46647. toggleObserving(true);
  46648. }
  46649. }
  46650. function resolveInject (inject, vm) {
  46651. if (inject) {
  46652. // inject is :any because flow is not smart enough to figure out cached
  46653. var result = Object.create(null);
  46654. var keys = hasSymbol
  46655. ? Reflect.ownKeys(inject)
  46656. : Object.keys(inject);
  46657. for (var i = 0; i < keys.length; i++) {
  46658. var key = keys[i];
  46659. // #6574 in case the inject object is observed...
  46660. if (key === '__ob__') { continue }
  46661. var provideKey = inject[key].from;
  46662. var source = vm;
  46663. while (source) {
  46664. if (source._provided && hasOwn(source._provided, provideKey)) {
  46665. result[key] = source._provided[provideKey];
  46666. break
  46667. }
  46668. source = source.$parent;
  46669. }
  46670. if (!source) {
  46671. if ('default' in inject[key]) {
  46672. var provideDefault = inject[key].default;
  46673. result[key] = typeof provideDefault === 'function'
  46674. ? provideDefault.call(vm)
  46675. : provideDefault;
  46676. } else {
  46677. warn(("Injection \"" + key + "\" not found"), vm);
  46678. }
  46679. }
  46680. }
  46681. return result
  46682. }
  46683. }
  46684. /* */
  46685. /**
  46686. * Runtime helper for resolving raw children VNodes into a slot object.
  46687. */
  46688. function resolveSlots (
  46689. children,
  46690. context
  46691. ) {
  46692. if (!children || !children.length) {
  46693. return {}
  46694. }
  46695. var slots = {};
  46696. for (var i = 0, l = children.length; i < l; i++) {
  46697. var child = children[i];
  46698. var data = child.data;
  46699. // remove slot attribute if the node is resolved as a Vue slot node
  46700. if (data && data.attrs && data.attrs.slot) {
  46701. delete data.attrs.slot;
  46702. }
  46703. // named slots should only be respected if the vnode was rendered in the
  46704. // same context.
  46705. if ((child.context === context || child.fnContext === context) &&
  46706. data && data.slot != null
  46707. ) {
  46708. var name = data.slot;
  46709. var slot = (slots[name] || (slots[name] = []));
  46710. if (child.tag === 'template') {
  46711. slot.push.apply(slot, child.children || []);
  46712. } else {
  46713. slot.push(child);
  46714. }
  46715. } else {
  46716. (slots.default || (slots.default = [])).push(child);
  46717. }
  46718. }
  46719. // ignore slots that contains only whitespace
  46720. for (var name$1 in slots) {
  46721. if (slots[name$1].every(isWhitespace)) {
  46722. delete slots[name$1];
  46723. }
  46724. }
  46725. return slots
  46726. }
  46727. function isWhitespace (node) {
  46728. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46729. }
  46730. /* */
  46731. function normalizeScopedSlots (
  46732. slots,
  46733. normalSlots,
  46734. prevSlots
  46735. ) {
  46736. var res;
  46737. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46738. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46739. var key = slots && slots.$key;
  46740. if (!slots) {
  46741. res = {};
  46742. } else if (slots._normalized) {
  46743. // fast path 1: child component re-render only, parent did not change
  46744. return slots._normalized
  46745. } else if (
  46746. isStable &&
  46747. prevSlots &&
  46748. prevSlots !== emptyObject &&
  46749. key === prevSlots.$key &&
  46750. !hasNormalSlots &&
  46751. !prevSlots.$hasNormal
  46752. ) {
  46753. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46754. // only need to normalize once
  46755. return prevSlots
  46756. } else {
  46757. res = {};
  46758. for (var key$1 in slots) {
  46759. if (slots[key$1] && key$1[0] !== '$') {
  46760. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46761. }
  46762. }
  46763. }
  46764. // expose normal slots on scopedSlots
  46765. for (var key$2 in normalSlots) {
  46766. if (!(key$2 in res)) {
  46767. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46768. }
  46769. }
  46770. // avoriaz seems to mock a non-extensible $scopedSlots object
  46771. // and when that is passed down this would cause an error
  46772. if (slots && Object.isExtensible(slots)) {
  46773. (slots)._normalized = res;
  46774. }
  46775. def(res, '$stable', isStable);
  46776. def(res, '$key', key);
  46777. def(res, '$hasNormal', hasNormalSlots);
  46778. return res
  46779. }
  46780. function normalizeScopedSlot(normalSlots, key, fn) {
  46781. var normalized = function () {
  46782. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46783. res = res && typeof res === 'object' && !Array.isArray(res)
  46784. ? [res] // single vnode
  46785. : normalizeChildren(res);
  46786. return res && (
  46787. res.length === 0 ||
  46788. (res.length === 1 && res[0].isComment) // #9658
  46789. ) ? undefined
  46790. : res
  46791. };
  46792. // this is a slot using the new v-slot syntax without scope. although it is
  46793. // compiled as a scoped slot, render fn users would expect it to be present
  46794. // on this.$slots because the usage is semantically a normal slot.
  46795. if (fn.proxy) {
  46796. Object.defineProperty(normalSlots, key, {
  46797. get: normalized,
  46798. enumerable: true,
  46799. configurable: true
  46800. });
  46801. }
  46802. return normalized
  46803. }
  46804. function proxyNormalSlot(slots, key) {
  46805. return function () { return slots[key]; }
  46806. }
  46807. /* */
  46808. /**
  46809. * Runtime helper for rendering v-for lists.
  46810. */
  46811. function renderList (
  46812. val,
  46813. render
  46814. ) {
  46815. var ret, i, l, keys, key;
  46816. if (Array.isArray(val) || typeof val === 'string') {
  46817. ret = new Array(val.length);
  46818. for (i = 0, l = val.length; i < l; i++) {
  46819. ret[i] = render(val[i], i);
  46820. }
  46821. } else if (typeof val === 'number') {
  46822. ret = new Array(val);
  46823. for (i = 0; i < val; i++) {
  46824. ret[i] = render(i + 1, i);
  46825. }
  46826. } else if (isObject(val)) {
  46827. if (hasSymbol && val[Symbol.iterator]) {
  46828. ret = [];
  46829. var iterator = val[Symbol.iterator]();
  46830. var result = iterator.next();
  46831. while (!result.done) {
  46832. ret.push(render(result.value, ret.length));
  46833. result = iterator.next();
  46834. }
  46835. } else {
  46836. keys = Object.keys(val);
  46837. ret = new Array(keys.length);
  46838. for (i = 0, l = keys.length; i < l; i++) {
  46839. key = keys[i];
  46840. ret[i] = render(val[key], key, i);
  46841. }
  46842. }
  46843. }
  46844. if (!isDef(ret)) {
  46845. ret = [];
  46846. }
  46847. (ret)._isVList = true;
  46848. return ret
  46849. }
  46850. /* */
  46851. /**
  46852. * Runtime helper for rendering <slot>
  46853. */
  46854. function renderSlot (
  46855. name,
  46856. fallback,
  46857. props,
  46858. bindObject
  46859. ) {
  46860. var scopedSlotFn = this.$scopedSlots[name];
  46861. var nodes;
  46862. if (scopedSlotFn) { // scoped slot
  46863. props = props || {};
  46864. if (bindObject) {
  46865. if (!isObject(bindObject)) {
  46866. warn(
  46867. 'slot v-bind without argument expects an Object',
  46868. this
  46869. );
  46870. }
  46871. props = extend(extend({}, bindObject), props);
  46872. }
  46873. nodes = scopedSlotFn(props) || fallback;
  46874. } else {
  46875. nodes = this.$slots[name] || fallback;
  46876. }
  46877. var target = props && props.slot;
  46878. if (target) {
  46879. return this.$createElement('template', { slot: target }, nodes)
  46880. } else {
  46881. return nodes
  46882. }
  46883. }
  46884. /* */
  46885. /**
  46886. * Runtime helper for resolving filters
  46887. */
  46888. function resolveFilter (id) {
  46889. return resolveAsset(this.$options, 'filters', id, true) || identity
  46890. }
  46891. /* */
  46892. function isKeyNotMatch (expect, actual) {
  46893. if (Array.isArray(expect)) {
  46894. return expect.indexOf(actual) === -1
  46895. } else {
  46896. return expect !== actual
  46897. }
  46898. }
  46899. /**
  46900. * Runtime helper for checking keyCodes from config.
  46901. * exposed as Vue.prototype._k
  46902. * passing in eventKeyName as last argument separately for backwards compat
  46903. */
  46904. function checkKeyCodes (
  46905. eventKeyCode,
  46906. key,
  46907. builtInKeyCode,
  46908. eventKeyName,
  46909. builtInKeyName
  46910. ) {
  46911. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46912. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46913. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46914. } else if (mappedKeyCode) {
  46915. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46916. } else if (eventKeyName) {
  46917. return hyphenate(eventKeyName) !== key
  46918. }
  46919. }
  46920. /* */
  46921. /**
  46922. * Runtime helper for merging v-bind="object" into a VNode's data.
  46923. */
  46924. function bindObjectProps (
  46925. data,
  46926. tag,
  46927. value,
  46928. asProp,
  46929. isSync
  46930. ) {
  46931. if (value) {
  46932. if (!isObject(value)) {
  46933. warn(
  46934. 'v-bind without argument expects an Object or Array value',
  46935. this
  46936. );
  46937. } else {
  46938. if (Array.isArray(value)) {
  46939. value = toObject(value);
  46940. }
  46941. var hash;
  46942. var loop = function ( key ) {
  46943. if (
  46944. key === 'class' ||
  46945. key === 'style' ||
  46946. isReservedAttribute(key)
  46947. ) {
  46948. hash = data;
  46949. } else {
  46950. var type = data.attrs && data.attrs.type;
  46951. hash = asProp || config.mustUseProp(tag, type, key)
  46952. ? data.domProps || (data.domProps = {})
  46953. : data.attrs || (data.attrs = {});
  46954. }
  46955. var camelizedKey = camelize(key);
  46956. var hyphenatedKey = hyphenate(key);
  46957. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46958. hash[key] = value[key];
  46959. if (isSync) {
  46960. var on = data.on || (data.on = {});
  46961. on[("update:" + key)] = function ($event) {
  46962. value[key] = $event;
  46963. };
  46964. }
  46965. }
  46966. };
  46967. for (var key in value) loop( key );
  46968. }
  46969. }
  46970. return data
  46971. }
  46972. /* */
  46973. /**
  46974. * Runtime helper for rendering static trees.
  46975. */
  46976. function renderStatic (
  46977. index,
  46978. isInFor
  46979. ) {
  46980. var cached = this._staticTrees || (this._staticTrees = []);
  46981. var tree = cached[index];
  46982. // if has already-rendered static tree and not inside v-for,
  46983. // we can reuse the same tree.
  46984. if (tree && !isInFor) {
  46985. return tree
  46986. }
  46987. // otherwise, render a fresh tree.
  46988. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46989. this._renderProxy,
  46990. null,
  46991. this // for render fns generated for functional component templates
  46992. );
  46993. markStatic(tree, ("__static__" + index), false);
  46994. return tree
  46995. }
  46996. /**
  46997. * Runtime helper for v-once.
  46998. * Effectively it means marking the node as static with a unique key.
  46999. */
  47000. function markOnce (
  47001. tree,
  47002. index,
  47003. key
  47004. ) {
  47005. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47006. return tree
  47007. }
  47008. function markStatic (
  47009. tree,
  47010. key,
  47011. isOnce
  47012. ) {
  47013. if (Array.isArray(tree)) {
  47014. for (var i = 0; i < tree.length; i++) {
  47015. if (tree[i] && typeof tree[i] !== 'string') {
  47016. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47017. }
  47018. }
  47019. } else {
  47020. markStaticNode(tree, key, isOnce);
  47021. }
  47022. }
  47023. function markStaticNode (node, key, isOnce) {
  47024. node.isStatic = true;
  47025. node.key = key;
  47026. node.isOnce = isOnce;
  47027. }
  47028. /* */
  47029. function bindObjectListeners (data, value) {
  47030. if (value) {
  47031. if (!isPlainObject(value)) {
  47032. warn(
  47033. 'v-on without argument expects an Object value',
  47034. this
  47035. );
  47036. } else {
  47037. var on = data.on = data.on ? extend({}, data.on) : {};
  47038. for (var key in value) {
  47039. var existing = on[key];
  47040. var ours = value[key];
  47041. on[key] = existing ? [].concat(existing, ours) : ours;
  47042. }
  47043. }
  47044. }
  47045. return data
  47046. }
  47047. /* */
  47048. function resolveScopedSlots (
  47049. fns, // see flow/vnode
  47050. res,
  47051. // the following are added in 2.6
  47052. hasDynamicKeys,
  47053. contentHashKey
  47054. ) {
  47055. res = res || { $stable: !hasDynamicKeys };
  47056. for (var i = 0; i < fns.length; i++) {
  47057. var slot = fns[i];
  47058. if (Array.isArray(slot)) {
  47059. resolveScopedSlots(slot, res, hasDynamicKeys);
  47060. } else if (slot) {
  47061. // marker for reverse proxying v-slot without scope on this.$slots
  47062. if (slot.proxy) {
  47063. slot.fn.proxy = true;
  47064. }
  47065. res[slot.key] = slot.fn;
  47066. }
  47067. }
  47068. if (contentHashKey) {
  47069. (res).$key = contentHashKey;
  47070. }
  47071. return res
  47072. }
  47073. /* */
  47074. function bindDynamicKeys (baseObj, values) {
  47075. for (var i = 0; i < values.length; i += 2) {
  47076. var key = values[i];
  47077. if (typeof key === 'string' && key) {
  47078. baseObj[values[i]] = values[i + 1];
  47079. } else if (key !== '' && key !== null) {
  47080. // null is a special value for explicitly removing a binding
  47081. warn(
  47082. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47083. this
  47084. );
  47085. }
  47086. }
  47087. return baseObj
  47088. }
  47089. // helper to dynamically append modifier runtime markers to event names.
  47090. // ensure only append when value is already string, otherwise it will be cast
  47091. // to string and cause the type check to miss.
  47092. function prependModifier (value, symbol) {
  47093. return typeof value === 'string' ? symbol + value : value
  47094. }
  47095. /* */
  47096. function installRenderHelpers (target) {
  47097. target._o = markOnce;
  47098. target._n = toNumber;
  47099. target._s = toString;
  47100. target._l = renderList;
  47101. target._t = renderSlot;
  47102. target._q = looseEqual;
  47103. target._i = looseIndexOf;
  47104. target._m = renderStatic;
  47105. target._f = resolveFilter;
  47106. target._k = checkKeyCodes;
  47107. target._b = bindObjectProps;
  47108. target._v = createTextVNode;
  47109. target._e = createEmptyVNode;
  47110. target._u = resolveScopedSlots;
  47111. target._g = bindObjectListeners;
  47112. target._d = bindDynamicKeys;
  47113. target._p = prependModifier;
  47114. }
  47115. /* */
  47116. function FunctionalRenderContext (
  47117. data,
  47118. props,
  47119. children,
  47120. parent,
  47121. Ctor
  47122. ) {
  47123. var this$1 = this;
  47124. var options = Ctor.options;
  47125. // ensure the createElement function in functional components
  47126. // gets a unique context - this is necessary for correct named slot check
  47127. var contextVm;
  47128. if (hasOwn(parent, '_uid')) {
  47129. contextVm = Object.create(parent);
  47130. // $flow-disable-line
  47131. contextVm._original = parent;
  47132. } else {
  47133. // the context vm passed in is a functional context as well.
  47134. // in this case we want to make sure we are able to get a hold to the
  47135. // real context instance.
  47136. contextVm = parent;
  47137. // $flow-disable-line
  47138. parent = parent._original;
  47139. }
  47140. var isCompiled = isTrue(options._compiled);
  47141. var needNormalization = !isCompiled;
  47142. this.data = data;
  47143. this.props = props;
  47144. this.children = children;
  47145. this.parent = parent;
  47146. this.listeners = data.on || emptyObject;
  47147. this.injections = resolveInject(options.inject, parent);
  47148. this.slots = function () {
  47149. if (!this$1.$slots) {
  47150. normalizeScopedSlots(
  47151. data.scopedSlots,
  47152. this$1.$slots = resolveSlots(children, parent)
  47153. );
  47154. }
  47155. return this$1.$slots
  47156. };
  47157. Object.defineProperty(this, 'scopedSlots', ({
  47158. enumerable: true,
  47159. get: function get () {
  47160. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47161. }
  47162. }));
  47163. // support for compiled functional template
  47164. if (isCompiled) {
  47165. // exposing $options for renderStatic()
  47166. this.$options = options;
  47167. // pre-resolve slots for renderSlot()
  47168. this.$slots = this.slots();
  47169. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47170. }
  47171. if (options._scopeId) {
  47172. this._c = function (a, b, c, d) {
  47173. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47174. if (vnode && !Array.isArray(vnode)) {
  47175. vnode.fnScopeId = options._scopeId;
  47176. vnode.fnContext = parent;
  47177. }
  47178. return vnode
  47179. };
  47180. } else {
  47181. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47182. }
  47183. }
  47184. installRenderHelpers(FunctionalRenderContext.prototype);
  47185. function createFunctionalComponent (
  47186. Ctor,
  47187. propsData,
  47188. data,
  47189. contextVm,
  47190. children
  47191. ) {
  47192. var options = Ctor.options;
  47193. var props = {};
  47194. var propOptions = options.props;
  47195. if (isDef(propOptions)) {
  47196. for (var key in propOptions) {
  47197. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47198. }
  47199. } else {
  47200. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47201. if (isDef(data.props)) { mergeProps(props, data.props); }
  47202. }
  47203. var renderContext = new FunctionalRenderContext(
  47204. data,
  47205. props,
  47206. children,
  47207. contextVm,
  47208. Ctor
  47209. );
  47210. var vnode = options.render.call(null, renderContext._c, renderContext);
  47211. if (vnode instanceof VNode) {
  47212. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47213. } else if (Array.isArray(vnode)) {
  47214. var vnodes = normalizeChildren(vnode) || [];
  47215. var res = new Array(vnodes.length);
  47216. for (var i = 0; i < vnodes.length; i++) {
  47217. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47218. }
  47219. return res
  47220. }
  47221. }
  47222. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47223. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47224. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47225. // that should not be matched to match.
  47226. var clone = cloneVNode(vnode);
  47227. clone.fnContext = contextVm;
  47228. clone.fnOptions = options;
  47229. {
  47230. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47231. }
  47232. if (data.slot) {
  47233. (clone.data || (clone.data = {})).slot = data.slot;
  47234. }
  47235. return clone
  47236. }
  47237. function mergeProps (to, from) {
  47238. for (var key in from) {
  47239. to[camelize(key)] = from[key];
  47240. }
  47241. }
  47242. /* */
  47243. /* */
  47244. /* */
  47245. /* */
  47246. // inline hooks to be invoked on component VNodes during patch
  47247. var componentVNodeHooks = {
  47248. init: function init (vnode, hydrating) {
  47249. if (
  47250. vnode.componentInstance &&
  47251. !vnode.componentInstance._isDestroyed &&
  47252. vnode.data.keepAlive
  47253. ) {
  47254. // kept-alive components, treat as a patch
  47255. var mountedNode = vnode; // work around flow
  47256. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47257. } else {
  47258. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47259. vnode,
  47260. activeInstance
  47261. );
  47262. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47263. }
  47264. },
  47265. prepatch: function prepatch (oldVnode, vnode) {
  47266. var options = vnode.componentOptions;
  47267. var child = vnode.componentInstance = oldVnode.componentInstance;
  47268. updateChildComponent(
  47269. child,
  47270. options.propsData, // updated props
  47271. options.listeners, // updated listeners
  47272. vnode, // new parent vnode
  47273. options.children // new children
  47274. );
  47275. },
  47276. insert: function insert (vnode) {
  47277. var context = vnode.context;
  47278. var componentInstance = vnode.componentInstance;
  47279. if (!componentInstance._isMounted) {
  47280. componentInstance._isMounted = true;
  47281. callHook(componentInstance, 'mounted');
  47282. }
  47283. if (vnode.data.keepAlive) {
  47284. if (context._isMounted) {
  47285. // vue-router#1212
  47286. // During updates, a kept-alive component's child components may
  47287. // change, so directly walking the tree here may call activated hooks
  47288. // on incorrect children. Instead we push them into a queue which will
  47289. // be processed after the whole patch process ended.
  47290. queueActivatedComponent(componentInstance);
  47291. } else {
  47292. activateChildComponent(componentInstance, true /* direct */);
  47293. }
  47294. }
  47295. },
  47296. destroy: function destroy (vnode) {
  47297. var componentInstance = vnode.componentInstance;
  47298. if (!componentInstance._isDestroyed) {
  47299. if (!vnode.data.keepAlive) {
  47300. componentInstance.$destroy();
  47301. } else {
  47302. deactivateChildComponent(componentInstance, true /* direct */);
  47303. }
  47304. }
  47305. }
  47306. };
  47307. var hooksToMerge = Object.keys(componentVNodeHooks);
  47308. function createComponent (
  47309. Ctor,
  47310. data,
  47311. context,
  47312. children,
  47313. tag
  47314. ) {
  47315. if (isUndef(Ctor)) {
  47316. return
  47317. }
  47318. var baseCtor = context.$options._base;
  47319. // plain options object: turn it into a constructor
  47320. if (isObject(Ctor)) {
  47321. Ctor = baseCtor.extend(Ctor);
  47322. }
  47323. // if at this stage it's not a constructor or an async component factory,
  47324. // reject.
  47325. if (typeof Ctor !== 'function') {
  47326. {
  47327. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47328. }
  47329. return
  47330. }
  47331. // async component
  47332. var asyncFactory;
  47333. if (isUndef(Ctor.cid)) {
  47334. asyncFactory = Ctor;
  47335. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47336. if (Ctor === undefined) {
  47337. // return a placeholder node for async component, which is rendered
  47338. // as a comment node but preserves all the raw information for the node.
  47339. // the information will be used for async server-rendering and hydration.
  47340. return createAsyncPlaceholder(
  47341. asyncFactory,
  47342. data,
  47343. context,
  47344. children,
  47345. tag
  47346. )
  47347. }
  47348. }
  47349. data = data || {};
  47350. // resolve constructor options in case global mixins are applied after
  47351. // component constructor creation
  47352. resolveConstructorOptions(Ctor);
  47353. // transform component v-model data into props & events
  47354. if (isDef(data.model)) {
  47355. transformModel(Ctor.options, data);
  47356. }
  47357. // extract props
  47358. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47359. // functional component
  47360. if (isTrue(Ctor.options.functional)) {
  47361. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47362. }
  47363. // extract listeners, since these needs to be treated as
  47364. // child component listeners instead of DOM listeners
  47365. var listeners = data.on;
  47366. // replace with listeners with .native modifier
  47367. // so it gets processed during parent component patch.
  47368. data.on = data.nativeOn;
  47369. if (isTrue(Ctor.options.abstract)) {
  47370. // abstract components do not keep anything
  47371. // other than props & listeners & slot
  47372. // work around flow
  47373. var slot = data.slot;
  47374. data = {};
  47375. if (slot) {
  47376. data.slot = slot;
  47377. }
  47378. }
  47379. // install component management hooks onto the placeholder node
  47380. installComponentHooks(data);
  47381. // return a placeholder vnode
  47382. var name = Ctor.options.name || tag;
  47383. var vnode = new VNode(
  47384. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47385. data, undefined, undefined, undefined, context,
  47386. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47387. asyncFactory
  47388. );
  47389. return vnode
  47390. }
  47391. function createComponentInstanceForVnode (
  47392. vnode, // we know it's MountedComponentVNode but flow doesn't
  47393. parent // activeInstance in lifecycle state
  47394. ) {
  47395. var options = {
  47396. _isComponent: true,
  47397. _parentVnode: vnode,
  47398. parent: parent
  47399. };
  47400. // check inline-template render functions
  47401. var inlineTemplate = vnode.data.inlineTemplate;
  47402. if (isDef(inlineTemplate)) {
  47403. options.render = inlineTemplate.render;
  47404. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47405. }
  47406. return new vnode.componentOptions.Ctor(options)
  47407. }
  47408. function installComponentHooks (data) {
  47409. var hooks = data.hook || (data.hook = {});
  47410. for (var i = 0; i < hooksToMerge.length; i++) {
  47411. var key = hooksToMerge[i];
  47412. var existing = hooks[key];
  47413. var toMerge = componentVNodeHooks[key];
  47414. if (existing !== toMerge && !(existing && existing._merged)) {
  47415. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47416. }
  47417. }
  47418. }
  47419. function mergeHook$1 (f1, f2) {
  47420. var merged = function (a, b) {
  47421. // flow complains about extra args which is why we use any
  47422. f1(a, b);
  47423. f2(a, b);
  47424. };
  47425. merged._merged = true;
  47426. return merged
  47427. }
  47428. // transform component v-model info (value and callback) into
  47429. // prop and event handler respectively.
  47430. function transformModel (options, data) {
  47431. var prop = (options.model && options.model.prop) || 'value';
  47432. var event = (options.model && options.model.event) || 'input'
  47433. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47434. var on = data.on || (data.on = {});
  47435. var existing = on[event];
  47436. var callback = data.model.callback;
  47437. if (isDef(existing)) {
  47438. if (
  47439. Array.isArray(existing)
  47440. ? existing.indexOf(callback) === -1
  47441. : existing !== callback
  47442. ) {
  47443. on[event] = [callback].concat(existing);
  47444. }
  47445. } else {
  47446. on[event] = callback;
  47447. }
  47448. }
  47449. /* */
  47450. var SIMPLE_NORMALIZE = 1;
  47451. var ALWAYS_NORMALIZE = 2;
  47452. // wrapper function for providing a more flexible interface
  47453. // without getting yelled at by flow
  47454. function createElement (
  47455. context,
  47456. tag,
  47457. data,
  47458. children,
  47459. normalizationType,
  47460. alwaysNormalize
  47461. ) {
  47462. if (Array.isArray(data) || isPrimitive(data)) {
  47463. normalizationType = children;
  47464. children = data;
  47465. data = undefined;
  47466. }
  47467. if (isTrue(alwaysNormalize)) {
  47468. normalizationType = ALWAYS_NORMALIZE;
  47469. }
  47470. return _createElement(context, tag, data, children, normalizationType)
  47471. }
  47472. function _createElement (
  47473. context,
  47474. tag,
  47475. data,
  47476. children,
  47477. normalizationType
  47478. ) {
  47479. if (isDef(data) && isDef((data).__ob__)) {
  47480. warn(
  47481. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47482. 'Always create fresh vnode data objects in each render!',
  47483. context
  47484. );
  47485. return createEmptyVNode()
  47486. }
  47487. // object syntax in v-bind
  47488. if (isDef(data) && isDef(data.is)) {
  47489. tag = data.is;
  47490. }
  47491. if (!tag) {
  47492. // in case of component :is set to falsy value
  47493. return createEmptyVNode()
  47494. }
  47495. // warn against non-primitive key
  47496. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47497. ) {
  47498. {
  47499. warn(
  47500. 'Avoid using non-primitive value as key, ' +
  47501. 'use string/number value instead.',
  47502. context
  47503. );
  47504. }
  47505. }
  47506. // support single function children as default scoped slot
  47507. if (Array.isArray(children) &&
  47508. typeof children[0] === 'function'
  47509. ) {
  47510. data = data || {};
  47511. data.scopedSlots = { default: children[0] };
  47512. children.length = 0;
  47513. }
  47514. if (normalizationType === ALWAYS_NORMALIZE) {
  47515. children = normalizeChildren(children);
  47516. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47517. children = simpleNormalizeChildren(children);
  47518. }
  47519. var vnode, ns;
  47520. if (typeof tag === 'string') {
  47521. var Ctor;
  47522. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47523. if (config.isReservedTag(tag)) {
  47524. // platform built-in elements
  47525. if (isDef(data) && isDef(data.nativeOn)) {
  47526. warn(
  47527. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47528. context
  47529. );
  47530. }
  47531. vnode = new VNode(
  47532. config.parsePlatformTagName(tag), data, children,
  47533. undefined, undefined, context
  47534. );
  47535. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47536. // component
  47537. vnode = createComponent(Ctor, data, context, children, tag);
  47538. } else {
  47539. // unknown or unlisted namespaced elements
  47540. // check at runtime because it may get assigned a namespace when its
  47541. // parent normalizes children
  47542. vnode = new VNode(
  47543. tag, data, children,
  47544. undefined, undefined, context
  47545. );
  47546. }
  47547. } else {
  47548. // direct component options / constructor
  47549. vnode = createComponent(tag, data, context, children);
  47550. }
  47551. if (Array.isArray(vnode)) {
  47552. return vnode
  47553. } else if (isDef(vnode)) {
  47554. if (isDef(ns)) { applyNS(vnode, ns); }
  47555. if (isDef(data)) { registerDeepBindings(data); }
  47556. return vnode
  47557. } else {
  47558. return createEmptyVNode()
  47559. }
  47560. }
  47561. function applyNS (vnode, ns, force) {
  47562. vnode.ns = ns;
  47563. if (vnode.tag === 'foreignObject') {
  47564. // use default namespace inside foreignObject
  47565. ns = undefined;
  47566. force = true;
  47567. }
  47568. if (isDef(vnode.children)) {
  47569. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47570. var child = vnode.children[i];
  47571. if (isDef(child.tag) && (
  47572. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47573. applyNS(child, ns, force);
  47574. }
  47575. }
  47576. }
  47577. }
  47578. // ref #5318
  47579. // necessary to ensure parent re-render when deep bindings like :style and
  47580. // :class are used on slot nodes
  47581. function registerDeepBindings (data) {
  47582. if (isObject(data.style)) {
  47583. traverse(data.style);
  47584. }
  47585. if (isObject(data.class)) {
  47586. traverse(data.class);
  47587. }
  47588. }
  47589. /* */
  47590. function initRender (vm) {
  47591. vm._vnode = null; // the root of the child tree
  47592. vm._staticTrees = null; // v-once cached trees
  47593. var options = vm.$options;
  47594. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47595. var renderContext = parentVnode && parentVnode.context;
  47596. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47597. vm.$scopedSlots = emptyObject;
  47598. // bind the createElement fn to this instance
  47599. // so that we get proper render context inside it.
  47600. // args order: tag, data, children, normalizationType, alwaysNormalize
  47601. // internal version is used by render functions compiled from templates
  47602. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47603. // normalization is always applied for the public version, used in
  47604. // user-written render functions.
  47605. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47606. // $attrs & $listeners are exposed for easier HOC creation.
  47607. // they need to be reactive so that HOCs using them are always updated
  47608. var parentData = parentVnode && parentVnode.data;
  47609. /* istanbul ignore else */
  47610. {
  47611. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47612. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47613. }, true);
  47614. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47615. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47616. }, true);
  47617. }
  47618. }
  47619. var currentRenderingInstance = null;
  47620. function renderMixin (Vue) {
  47621. // install runtime convenience helpers
  47622. installRenderHelpers(Vue.prototype);
  47623. Vue.prototype.$nextTick = function (fn) {
  47624. return nextTick(fn, this)
  47625. };
  47626. Vue.prototype._render = function () {
  47627. var vm = this;
  47628. var ref = vm.$options;
  47629. var render = ref.render;
  47630. var _parentVnode = ref._parentVnode;
  47631. if (_parentVnode) {
  47632. vm.$scopedSlots = normalizeScopedSlots(
  47633. _parentVnode.data.scopedSlots,
  47634. vm.$slots,
  47635. vm.$scopedSlots
  47636. );
  47637. }
  47638. // set parent vnode. this allows render functions to have access
  47639. // to the data on the placeholder node.
  47640. vm.$vnode = _parentVnode;
  47641. // render self
  47642. var vnode;
  47643. try {
  47644. // There's no need to maintain a stack because all render fns are called
  47645. // separately from one another. Nested component's render fns are called
  47646. // when parent component is patched.
  47647. currentRenderingInstance = vm;
  47648. vnode = render.call(vm._renderProxy, vm.$createElement);
  47649. } catch (e) {
  47650. handleError(e, vm, "render");
  47651. // return error render result,
  47652. // or previous vnode to prevent render error causing blank component
  47653. /* istanbul ignore else */
  47654. if (vm.$options.renderError) {
  47655. try {
  47656. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47657. } catch (e) {
  47658. handleError(e, vm, "renderError");
  47659. vnode = vm._vnode;
  47660. }
  47661. } else {
  47662. vnode = vm._vnode;
  47663. }
  47664. } finally {
  47665. currentRenderingInstance = null;
  47666. }
  47667. // if the returned array contains only a single node, allow it
  47668. if (Array.isArray(vnode) && vnode.length === 1) {
  47669. vnode = vnode[0];
  47670. }
  47671. // return empty vnode in case the render function errored out
  47672. if (!(vnode instanceof VNode)) {
  47673. if (Array.isArray(vnode)) {
  47674. warn(
  47675. 'Multiple root nodes returned from render function. Render function ' +
  47676. 'should return a single root node.',
  47677. vm
  47678. );
  47679. }
  47680. vnode = createEmptyVNode();
  47681. }
  47682. // set parent
  47683. vnode.parent = _parentVnode;
  47684. return vnode
  47685. };
  47686. }
  47687. /* */
  47688. function ensureCtor (comp, base) {
  47689. if (
  47690. comp.__esModule ||
  47691. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47692. ) {
  47693. comp = comp.default;
  47694. }
  47695. return isObject(comp)
  47696. ? base.extend(comp)
  47697. : comp
  47698. }
  47699. function createAsyncPlaceholder (
  47700. factory,
  47701. data,
  47702. context,
  47703. children,
  47704. tag
  47705. ) {
  47706. var node = createEmptyVNode();
  47707. node.asyncFactory = factory;
  47708. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47709. return node
  47710. }
  47711. function resolveAsyncComponent (
  47712. factory,
  47713. baseCtor
  47714. ) {
  47715. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47716. return factory.errorComp
  47717. }
  47718. if (isDef(factory.resolved)) {
  47719. return factory.resolved
  47720. }
  47721. var owner = currentRenderingInstance;
  47722. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47723. // already pending
  47724. factory.owners.push(owner);
  47725. }
  47726. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47727. return factory.loadingComp
  47728. }
  47729. if (owner && !isDef(factory.owners)) {
  47730. var owners = factory.owners = [owner];
  47731. var sync = true;
  47732. var timerLoading = null;
  47733. var timerTimeout = null
  47734. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47735. var forceRender = function (renderCompleted) {
  47736. for (var i = 0, l = owners.length; i < l; i++) {
  47737. (owners[i]).$forceUpdate();
  47738. }
  47739. if (renderCompleted) {
  47740. owners.length = 0;
  47741. if (timerLoading !== null) {
  47742. clearTimeout(timerLoading);
  47743. timerLoading = null;
  47744. }
  47745. if (timerTimeout !== null) {
  47746. clearTimeout(timerTimeout);
  47747. timerTimeout = null;
  47748. }
  47749. }
  47750. };
  47751. var resolve = once(function (res) {
  47752. // cache resolved
  47753. factory.resolved = ensureCtor(res, baseCtor);
  47754. // invoke callbacks only if this is not a synchronous resolve
  47755. // (async resolves are shimmed as synchronous during SSR)
  47756. if (!sync) {
  47757. forceRender(true);
  47758. } else {
  47759. owners.length = 0;
  47760. }
  47761. });
  47762. var reject = once(function (reason) {
  47763. warn(
  47764. "Failed to resolve async component: " + (String(factory)) +
  47765. (reason ? ("\nReason: " + reason) : '')
  47766. );
  47767. if (isDef(factory.errorComp)) {
  47768. factory.error = true;
  47769. forceRender(true);
  47770. }
  47771. });
  47772. var res = factory(resolve, reject);
  47773. if (isObject(res)) {
  47774. if (isPromise(res)) {
  47775. // () => Promise
  47776. if (isUndef(factory.resolved)) {
  47777. res.then(resolve, reject);
  47778. }
  47779. } else if (isPromise(res.component)) {
  47780. res.component.then(resolve, reject);
  47781. if (isDef(res.error)) {
  47782. factory.errorComp = ensureCtor(res.error, baseCtor);
  47783. }
  47784. if (isDef(res.loading)) {
  47785. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47786. if (res.delay === 0) {
  47787. factory.loading = true;
  47788. } else {
  47789. timerLoading = setTimeout(function () {
  47790. timerLoading = null;
  47791. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47792. factory.loading = true;
  47793. forceRender(false);
  47794. }
  47795. }, res.delay || 200);
  47796. }
  47797. }
  47798. if (isDef(res.timeout)) {
  47799. timerTimeout = setTimeout(function () {
  47800. timerTimeout = null;
  47801. if (isUndef(factory.resolved)) {
  47802. reject(
  47803. "timeout (" + (res.timeout) + "ms)"
  47804. );
  47805. }
  47806. }, res.timeout);
  47807. }
  47808. }
  47809. }
  47810. sync = false;
  47811. // return in case resolved synchronously
  47812. return factory.loading
  47813. ? factory.loadingComp
  47814. : factory.resolved
  47815. }
  47816. }
  47817. /* */
  47818. function isAsyncPlaceholder (node) {
  47819. return node.isComment && node.asyncFactory
  47820. }
  47821. /* */
  47822. function getFirstComponentChild (children) {
  47823. if (Array.isArray(children)) {
  47824. for (var i = 0; i < children.length; i++) {
  47825. var c = children[i];
  47826. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47827. return c
  47828. }
  47829. }
  47830. }
  47831. }
  47832. /* */
  47833. /* */
  47834. function initEvents (vm) {
  47835. vm._events = Object.create(null);
  47836. vm._hasHookEvent = false;
  47837. // init parent attached events
  47838. var listeners = vm.$options._parentListeners;
  47839. if (listeners) {
  47840. updateComponentListeners(vm, listeners);
  47841. }
  47842. }
  47843. var target;
  47844. function add (event, fn) {
  47845. target.$on(event, fn);
  47846. }
  47847. function remove$1 (event, fn) {
  47848. target.$off(event, fn);
  47849. }
  47850. function createOnceHandler (event, fn) {
  47851. var _target = target;
  47852. return function onceHandler () {
  47853. var res = fn.apply(null, arguments);
  47854. if (res !== null) {
  47855. _target.$off(event, onceHandler);
  47856. }
  47857. }
  47858. }
  47859. function updateComponentListeners (
  47860. vm,
  47861. listeners,
  47862. oldListeners
  47863. ) {
  47864. target = vm;
  47865. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47866. target = undefined;
  47867. }
  47868. function eventsMixin (Vue) {
  47869. var hookRE = /^hook:/;
  47870. Vue.prototype.$on = function (event, fn) {
  47871. var vm = this;
  47872. if (Array.isArray(event)) {
  47873. for (var i = 0, l = event.length; i < l; i++) {
  47874. vm.$on(event[i], fn);
  47875. }
  47876. } else {
  47877. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47878. // optimize hook:event cost by using a boolean flag marked at registration
  47879. // instead of a hash lookup
  47880. if (hookRE.test(event)) {
  47881. vm._hasHookEvent = true;
  47882. }
  47883. }
  47884. return vm
  47885. };
  47886. Vue.prototype.$once = function (event, fn) {
  47887. var vm = this;
  47888. function on () {
  47889. vm.$off(event, on);
  47890. fn.apply(vm, arguments);
  47891. }
  47892. on.fn = fn;
  47893. vm.$on(event, on);
  47894. return vm
  47895. };
  47896. Vue.prototype.$off = function (event, fn) {
  47897. var vm = this;
  47898. // all
  47899. if (!arguments.length) {
  47900. vm._events = Object.create(null);
  47901. return vm
  47902. }
  47903. // array of events
  47904. if (Array.isArray(event)) {
  47905. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47906. vm.$off(event[i$1], fn);
  47907. }
  47908. return vm
  47909. }
  47910. // specific event
  47911. var cbs = vm._events[event];
  47912. if (!cbs) {
  47913. return vm
  47914. }
  47915. if (!fn) {
  47916. vm._events[event] = null;
  47917. return vm
  47918. }
  47919. // specific handler
  47920. var cb;
  47921. var i = cbs.length;
  47922. while (i--) {
  47923. cb = cbs[i];
  47924. if (cb === fn || cb.fn === fn) {
  47925. cbs.splice(i, 1);
  47926. break
  47927. }
  47928. }
  47929. return vm
  47930. };
  47931. Vue.prototype.$emit = function (event) {
  47932. var vm = this;
  47933. {
  47934. var lowerCaseEvent = event.toLowerCase();
  47935. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47936. tip(
  47937. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47938. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47939. "Note that HTML attributes are case-insensitive and you cannot use " +
  47940. "v-on to listen to camelCase events when using in-DOM templates. " +
  47941. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47942. );
  47943. }
  47944. }
  47945. var cbs = vm._events[event];
  47946. if (cbs) {
  47947. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47948. var args = toArray(arguments, 1);
  47949. var info = "event handler for \"" + event + "\"";
  47950. for (var i = 0, l = cbs.length; i < l; i++) {
  47951. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47952. }
  47953. }
  47954. return vm
  47955. };
  47956. }
  47957. /* */
  47958. var activeInstance = null;
  47959. var isUpdatingChildComponent = false;
  47960. function setActiveInstance(vm) {
  47961. var prevActiveInstance = activeInstance;
  47962. activeInstance = vm;
  47963. return function () {
  47964. activeInstance = prevActiveInstance;
  47965. }
  47966. }
  47967. function initLifecycle (vm) {
  47968. var options = vm.$options;
  47969. // locate first non-abstract parent
  47970. var parent = options.parent;
  47971. if (parent && !options.abstract) {
  47972. while (parent.$options.abstract && parent.$parent) {
  47973. parent = parent.$parent;
  47974. }
  47975. parent.$children.push(vm);
  47976. }
  47977. vm.$parent = parent;
  47978. vm.$root = parent ? parent.$root : vm;
  47979. vm.$children = [];
  47980. vm.$refs = {};
  47981. vm._watcher = null;
  47982. vm._inactive = null;
  47983. vm._directInactive = false;
  47984. vm._isMounted = false;
  47985. vm._isDestroyed = false;
  47986. vm._isBeingDestroyed = false;
  47987. }
  47988. function lifecycleMixin (Vue) {
  47989. Vue.prototype._update = function (vnode, hydrating) {
  47990. var vm = this;
  47991. var prevEl = vm.$el;
  47992. var prevVnode = vm._vnode;
  47993. var restoreActiveInstance = setActiveInstance(vm);
  47994. vm._vnode = vnode;
  47995. // Vue.prototype.__patch__ is injected in entry points
  47996. // based on the rendering backend used.
  47997. if (!prevVnode) {
  47998. // initial render
  47999. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48000. } else {
  48001. // updates
  48002. vm.$el = vm.__patch__(prevVnode, vnode);
  48003. }
  48004. restoreActiveInstance();
  48005. // update __vue__ reference
  48006. if (prevEl) {
  48007. prevEl.__vue__ = null;
  48008. }
  48009. if (vm.$el) {
  48010. vm.$el.__vue__ = vm;
  48011. }
  48012. // if parent is an HOC, update its $el as well
  48013. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48014. vm.$parent.$el = vm.$el;
  48015. }
  48016. // updated hook is called by the scheduler to ensure that children are
  48017. // updated in a parent's updated hook.
  48018. };
  48019. Vue.prototype.$forceUpdate = function () {
  48020. var vm = this;
  48021. if (vm._watcher) {
  48022. vm._watcher.update();
  48023. }
  48024. };
  48025. Vue.prototype.$destroy = function () {
  48026. var vm = this;
  48027. if (vm._isBeingDestroyed) {
  48028. return
  48029. }
  48030. callHook(vm, 'beforeDestroy');
  48031. vm._isBeingDestroyed = true;
  48032. // remove self from parent
  48033. var parent = vm.$parent;
  48034. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48035. remove(parent.$children, vm);
  48036. }
  48037. // teardown watchers
  48038. if (vm._watcher) {
  48039. vm._watcher.teardown();
  48040. }
  48041. var i = vm._watchers.length;
  48042. while (i--) {
  48043. vm._watchers[i].teardown();
  48044. }
  48045. // remove reference from data ob
  48046. // frozen object may not have observer.
  48047. if (vm._data.__ob__) {
  48048. vm._data.__ob__.vmCount--;
  48049. }
  48050. // call the last hook...
  48051. vm._isDestroyed = true;
  48052. // invoke destroy hooks on current rendered tree
  48053. vm.__patch__(vm._vnode, null);
  48054. // fire destroyed hook
  48055. callHook(vm, 'destroyed');
  48056. // turn off all instance listeners.
  48057. vm.$off();
  48058. // remove __vue__ reference
  48059. if (vm.$el) {
  48060. vm.$el.__vue__ = null;
  48061. }
  48062. // release circular reference (#6759)
  48063. if (vm.$vnode) {
  48064. vm.$vnode.parent = null;
  48065. }
  48066. };
  48067. }
  48068. function mountComponent (
  48069. vm,
  48070. el,
  48071. hydrating
  48072. ) {
  48073. vm.$el = el;
  48074. if (!vm.$options.render) {
  48075. vm.$options.render = createEmptyVNode;
  48076. {
  48077. /* istanbul ignore if */
  48078. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48079. vm.$options.el || el) {
  48080. warn(
  48081. 'You are using the runtime-only build of Vue where the template ' +
  48082. 'compiler is not available. Either pre-compile the templates into ' +
  48083. 'render functions, or use the compiler-included build.',
  48084. vm
  48085. );
  48086. } else {
  48087. warn(
  48088. 'Failed to mount component: template or render function not defined.',
  48089. vm
  48090. );
  48091. }
  48092. }
  48093. }
  48094. callHook(vm, 'beforeMount');
  48095. var updateComponent;
  48096. /* istanbul ignore if */
  48097. if (config.performance && mark) {
  48098. updateComponent = function () {
  48099. var name = vm._name;
  48100. var id = vm._uid;
  48101. var startTag = "vue-perf-start:" + id;
  48102. var endTag = "vue-perf-end:" + id;
  48103. mark(startTag);
  48104. var vnode = vm._render();
  48105. mark(endTag);
  48106. measure(("vue " + name + " render"), startTag, endTag);
  48107. mark(startTag);
  48108. vm._update(vnode, hydrating);
  48109. mark(endTag);
  48110. measure(("vue " + name + " patch"), startTag, endTag);
  48111. };
  48112. } else {
  48113. updateComponent = function () {
  48114. vm._update(vm._render(), hydrating);
  48115. };
  48116. }
  48117. // we set this to vm._watcher inside the watcher's constructor
  48118. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48119. // component's mounted hook), which relies on vm._watcher being already defined
  48120. new Watcher(vm, updateComponent, noop, {
  48121. before: function before () {
  48122. if (vm._isMounted && !vm._isDestroyed) {
  48123. callHook(vm, 'beforeUpdate');
  48124. }
  48125. }
  48126. }, true /* isRenderWatcher */);
  48127. hydrating = false;
  48128. // manually mounted instance, call mounted on self
  48129. // mounted is called for render-created child components in its inserted hook
  48130. if (vm.$vnode == null) {
  48131. vm._isMounted = true;
  48132. callHook(vm, 'mounted');
  48133. }
  48134. return vm
  48135. }
  48136. function updateChildComponent (
  48137. vm,
  48138. propsData,
  48139. listeners,
  48140. parentVnode,
  48141. renderChildren
  48142. ) {
  48143. {
  48144. isUpdatingChildComponent = true;
  48145. }
  48146. // determine whether component has slot children
  48147. // we need to do this before overwriting $options._renderChildren.
  48148. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48149. // dynamic slot names). Static scoped slots compiled from template has the
  48150. // "$stable" marker.
  48151. var newScopedSlots = parentVnode.data.scopedSlots;
  48152. var oldScopedSlots = vm.$scopedSlots;
  48153. var hasDynamicScopedSlot = !!(
  48154. (newScopedSlots && !newScopedSlots.$stable) ||
  48155. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48156. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48157. );
  48158. // Any static slot children from the parent may have changed during parent's
  48159. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48160. // update is necessary to ensure correctness.
  48161. var needsForceUpdate = !!(
  48162. renderChildren || // has new static slots
  48163. vm.$options._renderChildren || // has old static slots
  48164. hasDynamicScopedSlot
  48165. );
  48166. vm.$options._parentVnode = parentVnode;
  48167. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48168. if (vm._vnode) { // update child tree's parent
  48169. vm._vnode.parent = parentVnode;
  48170. }
  48171. vm.$options._renderChildren = renderChildren;
  48172. // update $attrs and $listeners hash
  48173. // these are also reactive so they may trigger child update if the child
  48174. // used them during render
  48175. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48176. vm.$listeners = listeners || emptyObject;
  48177. // update props
  48178. if (propsData && vm.$options.props) {
  48179. toggleObserving(false);
  48180. var props = vm._props;
  48181. var propKeys = vm.$options._propKeys || [];
  48182. for (var i = 0; i < propKeys.length; i++) {
  48183. var key = propKeys[i];
  48184. var propOptions = vm.$options.props; // wtf flow?
  48185. props[key] = validateProp(key, propOptions, propsData, vm);
  48186. }
  48187. toggleObserving(true);
  48188. // keep a copy of raw propsData
  48189. vm.$options.propsData = propsData;
  48190. }
  48191. // update listeners
  48192. listeners = listeners || emptyObject;
  48193. var oldListeners = vm.$options._parentListeners;
  48194. vm.$options._parentListeners = listeners;
  48195. updateComponentListeners(vm, listeners, oldListeners);
  48196. // resolve slots + force update if has children
  48197. if (needsForceUpdate) {
  48198. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48199. vm.$forceUpdate();
  48200. }
  48201. {
  48202. isUpdatingChildComponent = false;
  48203. }
  48204. }
  48205. function isInInactiveTree (vm) {
  48206. while (vm && (vm = vm.$parent)) {
  48207. if (vm._inactive) { return true }
  48208. }
  48209. return false
  48210. }
  48211. function activateChildComponent (vm, direct) {
  48212. if (direct) {
  48213. vm._directInactive = false;
  48214. if (isInInactiveTree(vm)) {
  48215. return
  48216. }
  48217. } else if (vm._directInactive) {
  48218. return
  48219. }
  48220. if (vm._inactive || vm._inactive === null) {
  48221. vm._inactive = false;
  48222. for (var i = 0; i < vm.$children.length; i++) {
  48223. activateChildComponent(vm.$children[i]);
  48224. }
  48225. callHook(vm, 'activated');
  48226. }
  48227. }
  48228. function deactivateChildComponent (vm, direct) {
  48229. if (direct) {
  48230. vm._directInactive = true;
  48231. if (isInInactiveTree(vm)) {
  48232. return
  48233. }
  48234. }
  48235. if (!vm._inactive) {
  48236. vm._inactive = true;
  48237. for (var i = 0; i < vm.$children.length; i++) {
  48238. deactivateChildComponent(vm.$children[i]);
  48239. }
  48240. callHook(vm, 'deactivated');
  48241. }
  48242. }
  48243. function callHook (vm, hook) {
  48244. // #7573 disable dep collection when invoking lifecycle hooks
  48245. pushTarget();
  48246. var handlers = vm.$options[hook];
  48247. var info = hook + " hook";
  48248. if (handlers) {
  48249. for (var i = 0, j = handlers.length; i < j; i++) {
  48250. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48251. }
  48252. }
  48253. if (vm._hasHookEvent) {
  48254. vm.$emit('hook:' + hook);
  48255. }
  48256. popTarget();
  48257. }
  48258. /* */
  48259. var MAX_UPDATE_COUNT = 100;
  48260. var queue = [];
  48261. var activatedChildren = [];
  48262. var has = {};
  48263. var circular = {};
  48264. var waiting = false;
  48265. var flushing = false;
  48266. var index = 0;
  48267. /**
  48268. * Reset the scheduler's state.
  48269. */
  48270. function resetSchedulerState () {
  48271. index = queue.length = activatedChildren.length = 0;
  48272. has = {};
  48273. {
  48274. circular = {};
  48275. }
  48276. waiting = flushing = false;
  48277. }
  48278. // Async edge case #6566 requires saving the timestamp when event listeners are
  48279. // attached. However, calling performance.now() has a perf overhead especially
  48280. // if the page has thousands of event listeners. Instead, we take a timestamp
  48281. // every time the scheduler flushes and use that for all event listeners
  48282. // attached during that flush.
  48283. var currentFlushTimestamp = 0;
  48284. // Async edge case fix requires storing an event listener's attach timestamp.
  48285. var getNow = Date.now;
  48286. // Determine what event timestamp the browser is using. Annoyingly, the
  48287. // timestamp can either be hi-res (relative to page load) or low-res
  48288. // (relative to UNIX epoch), so in order to compare time we have to use the
  48289. // same timestamp type when saving the flush timestamp.
  48290. // All IE versions use low-res event timestamps, and have problematic clock
  48291. // implementations (#9632)
  48292. if (inBrowser && !isIE) {
  48293. var performance = window.performance;
  48294. if (
  48295. performance &&
  48296. typeof performance.now === 'function' &&
  48297. getNow() > document.createEvent('Event').timeStamp
  48298. ) {
  48299. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48300. // smaller than it, it means the event is using a hi-res timestamp,
  48301. // and we need to use the hi-res version for event listener timestamps as
  48302. // well.
  48303. getNow = function () { return performance.now(); };
  48304. }
  48305. }
  48306. /**
  48307. * Flush both queues and run the watchers.
  48308. */
  48309. function flushSchedulerQueue () {
  48310. currentFlushTimestamp = getNow();
  48311. flushing = true;
  48312. var watcher, id;
  48313. // Sort queue before flush.
  48314. // This ensures that:
  48315. // 1. Components are updated from parent to child. (because parent is always
  48316. // created before the child)
  48317. // 2. A component's user watchers are run before its render watcher (because
  48318. // user watchers are created before the render watcher)
  48319. // 3. If a component is destroyed during a parent component's watcher run,
  48320. // its watchers can be skipped.
  48321. queue.sort(function (a, b) { return a.id - b.id; });
  48322. // do not cache length because more watchers might be pushed
  48323. // as we run existing watchers
  48324. for (index = 0; index < queue.length; index++) {
  48325. watcher = queue[index];
  48326. if (watcher.before) {
  48327. watcher.before();
  48328. }
  48329. id = watcher.id;
  48330. has[id] = null;
  48331. watcher.run();
  48332. // in dev build, check and stop circular updates.
  48333. if (has[id] != null) {
  48334. circular[id] = (circular[id] || 0) + 1;
  48335. if (circular[id] > MAX_UPDATE_COUNT) {
  48336. warn(
  48337. 'You may have an infinite update loop ' + (
  48338. watcher.user
  48339. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48340. : "in a component render function."
  48341. ),
  48342. watcher.vm
  48343. );
  48344. break
  48345. }
  48346. }
  48347. }
  48348. // keep copies of post queues before resetting state
  48349. var activatedQueue = activatedChildren.slice();
  48350. var updatedQueue = queue.slice();
  48351. resetSchedulerState();
  48352. // call component updated and activated hooks
  48353. callActivatedHooks(activatedQueue);
  48354. callUpdatedHooks(updatedQueue);
  48355. // devtool hook
  48356. /* istanbul ignore if */
  48357. if (devtools && config.devtools) {
  48358. devtools.emit('flush');
  48359. }
  48360. }
  48361. function callUpdatedHooks (queue) {
  48362. var i = queue.length;
  48363. while (i--) {
  48364. var watcher = queue[i];
  48365. var vm = watcher.vm;
  48366. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48367. callHook(vm, 'updated');
  48368. }
  48369. }
  48370. }
  48371. /**
  48372. * Queue a kept-alive component that was activated during patch.
  48373. * The queue will be processed after the entire tree has been patched.
  48374. */
  48375. function queueActivatedComponent (vm) {
  48376. // setting _inactive to false here so that a render function can
  48377. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48378. vm._inactive = false;
  48379. activatedChildren.push(vm);
  48380. }
  48381. function callActivatedHooks (queue) {
  48382. for (var i = 0; i < queue.length; i++) {
  48383. queue[i]._inactive = true;
  48384. activateChildComponent(queue[i], true /* true */);
  48385. }
  48386. }
  48387. /**
  48388. * Push a watcher into the watcher queue.
  48389. * Jobs with duplicate IDs will be skipped unless it's
  48390. * pushed when the queue is being flushed.
  48391. */
  48392. function queueWatcher (watcher) {
  48393. var id = watcher.id;
  48394. if (has[id] == null) {
  48395. has[id] = true;
  48396. if (!flushing) {
  48397. queue.push(watcher);
  48398. } else {
  48399. // if already flushing, splice the watcher based on its id
  48400. // if already past its id, it will be run next immediately.
  48401. var i = queue.length - 1;
  48402. while (i > index && queue[i].id > watcher.id) {
  48403. i--;
  48404. }
  48405. queue.splice(i + 1, 0, watcher);
  48406. }
  48407. // queue the flush
  48408. if (!waiting) {
  48409. waiting = true;
  48410. if (!config.async) {
  48411. flushSchedulerQueue();
  48412. return
  48413. }
  48414. nextTick(flushSchedulerQueue);
  48415. }
  48416. }
  48417. }
  48418. /* */
  48419. var uid$2 = 0;
  48420. /**
  48421. * A watcher parses an expression, collects dependencies,
  48422. * and fires callback when the expression value changes.
  48423. * This is used for both the $watch() api and directives.
  48424. */
  48425. var Watcher = function Watcher (
  48426. vm,
  48427. expOrFn,
  48428. cb,
  48429. options,
  48430. isRenderWatcher
  48431. ) {
  48432. this.vm = vm;
  48433. if (isRenderWatcher) {
  48434. vm._watcher = this;
  48435. }
  48436. vm._watchers.push(this);
  48437. // options
  48438. if (options) {
  48439. this.deep = !!options.deep;
  48440. this.user = !!options.user;
  48441. this.lazy = !!options.lazy;
  48442. this.sync = !!options.sync;
  48443. this.before = options.before;
  48444. } else {
  48445. this.deep = this.user = this.lazy = this.sync = false;
  48446. }
  48447. this.cb = cb;
  48448. this.id = ++uid$2; // uid for batching
  48449. this.active = true;
  48450. this.dirty = this.lazy; // for lazy watchers
  48451. this.deps = [];
  48452. this.newDeps = [];
  48453. this.depIds = new _Set();
  48454. this.newDepIds = new _Set();
  48455. this.expression = expOrFn.toString();
  48456. // parse expression for getter
  48457. if (typeof expOrFn === 'function') {
  48458. this.getter = expOrFn;
  48459. } else {
  48460. this.getter = parsePath(expOrFn);
  48461. if (!this.getter) {
  48462. this.getter = noop;
  48463. warn(
  48464. "Failed watching path: \"" + expOrFn + "\" " +
  48465. 'Watcher only accepts simple dot-delimited paths. ' +
  48466. 'For full control, use a function instead.',
  48467. vm
  48468. );
  48469. }
  48470. }
  48471. this.value = this.lazy
  48472. ? undefined
  48473. : this.get();
  48474. };
  48475. /**
  48476. * Evaluate the getter, and re-collect dependencies.
  48477. */
  48478. Watcher.prototype.get = function get () {
  48479. pushTarget(this);
  48480. var value;
  48481. var vm = this.vm;
  48482. try {
  48483. value = this.getter.call(vm, vm);
  48484. } catch (e) {
  48485. if (this.user) {
  48486. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48487. } else {
  48488. throw e
  48489. }
  48490. } finally {
  48491. // "touch" every property so they are all tracked as
  48492. // dependencies for deep watching
  48493. if (this.deep) {
  48494. traverse(value);
  48495. }
  48496. popTarget();
  48497. this.cleanupDeps();
  48498. }
  48499. return value
  48500. };
  48501. /**
  48502. * Add a dependency to this directive.
  48503. */
  48504. Watcher.prototype.addDep = function addDep (dep) {
  48505. var id = dep.id;
  48506. if (!this.newDepIds.has(id)) {
  48507. this.newDepIds.add(id);
  48508. this.newDeps.push(dep);
  48509. if (!this.depIds.has(id)) {
  48510. dep.addSub(this);
  48511. }
  48512. }
  48513. };
  48514. /**
  48515. * Clean up for dependency collection.
  48516. */
  48517. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48518. var i = this.deps.length;
  48519. while (i--) {
  48520. var dep = this.deps[i];
  48521. if (!this.newDepIds.has(dep.id)) {
  48522. dep.removeSub(this);
  48523. }
  48524. }
  48525. var tmp = this.depIds;
  48526. this.depIds = this.newDepIds;
  48527. this.newDepIds = tmp;
  48528. this.newDepIds.clear();
  48529. tmp = this.deps;
  48530. this.deps = this.newDeps;
  48531. this.newDeps = tmp;
  48532. this.newDeps.length = 0;
  48533. };
  48534. /**
  48535. * Subscriber interface.
  48536. * Will be called when a dependency changes.
  48537. */
  48538. Watcher.prototype.update = function update () {
  48539. /* istanbul ignore else */
  48540. if (this.lazy) {
  48541. this.dirty = true;
  48542. } else if (this.sync) {
  48543. this.run();
  48544. } else {
  48545. queueWatcher(this);
  48546. }
  48547. };
  48548. /**
  48549. * Scheduler job interface.
  48550. * Will be called by the scheduler.
  48551. */
  48552. Watcher.prototype.run = function run () {
  48553. if (this.active) {
  48554. var value = this.get();
  48555. if (
  48556. value !== this.value ||
  48557. // Deep watchers and watchers on Object/Arrays should fire even
  48558. // when the value is the same, because the value may
  48559. // have mutated.
  48560. isObject(value) ||
  48561. this.deep
  48562. ) {
  48563. // set new value
  48564. var oldValue = this.value;
  48565. this.value = value;
  48566. if (this.user) {
  48567. try {
  48568. this.cb.call(this.vm, value, oldValue);
  48569. } catch (e) {
  48570. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48571. }
  48572. } else {
  48573. this.cb.call(this.vm, value, oldValue);
  48574. }
  48575. }
  48576. }
  48577. };
  48578. /**
  48579. * Evaluate the value of the watcher.
  48580. * This only gets called for lazy watchers.
  48581. */
  48582. Watcher.prototype.evaluate = function evaluate () {
  48583. this.value = this.get();
  48584. this.dirty = false;
  48585. };
  48586. /**
  48587. * Depend on all deps collected by this watcher.
  48588. */
  48589. Watcher.prototype.depend = function depend () {
  48590. var i = this.deps.length;
  48591. while (i--) {
  48592. this.deps[i].depend();
  48593. }
  48594. };
  48595. /**
  48596. * Remove self from all dependencies' subscriber list.
  48597. */
  48598. Watcher.prototype.teardown = function teardown () {
  48599. if (this.active) {
  48600. // remove self from vm's watcher list
  48601. // this is a somewhat expensive operation so we skip it
  48602. // if the vm is being destroyed.
  48603. if (!this.vm._isBeingDestroyed) {
  48604. remove(this.vm._watchers, this);
  48605. }
  48606. var i = this.deps.length;
  48607. while (i--) {
  48608. this.deps[i].removeSub(this);
  48609. }
  48610. this.active = false;
  48611. }
  48612. };
  48613. /* */
  48614. var sharedPropertyDefinition = {
  48615. enumerable: true,
  48616. configurable: true,
  48617. get: noop,
  48618. set: noop
  48619. };
  48620. function proxy (target, sourceKey, key) {
  48621. sharedPropertyDefinition.get = function proxyGetter () {
  48622. return this[sourceKey][key]
  48623. };
  48624. sharedPropertyDefinition.set = function proxySetter (val) {
  48625. this[sourceKey][key] = val;
  48626. };
  48627. Object.defineProperty(target, key, sharedPropertyDefinition);
  48628. }
  48629. function initState (vm) {
  48630. vm._watchers = [];
  48631. var opts = vm.$options;
  48632. if (opts.props) { initProps(vm, opts.props); }
  48633. if (opts.methods) { initMethods(vm, opts.methods); }
  48634. if (opts.data) {
  48635. initData(vm);
  48636. } else {
  48637. observe(vm._data = {}, true /* asRootData */);
  48638. }
  48639. if (opts.computed) { initComputed(vm, opts.computed); }
  48640. if (opts.watch && opts.watch !== nativeWatch) {
  48641. initWatch(vm, opts.watch);
  48642. }
  48643. }
  48644. function initProps (vm, propsOptions) {
  48645. var propsData = vm.$options.propsData || {};
  48646. var props = vm._props = {};
  48647. // cache prop keys so that future props updates can iterate using Array
  48648. // instead of dynamic object key enumeration.
  48649. var keys = vm.$options._propKeys = [];
  48650. var isRoot = !vm.$parent;
  48651. // root instance props should be converted
  48652. if (!isRoot) {
  48653. toggleObserving(false);
  48654. }
  48655. var loop = function ( key ) {
  48656. keys.push(key);
  48657. var value = validateProp(key, propsOptions, propsData, vm);
  48658. /* istanbul ignore else */
  48659. {
  48660. var hyphenatedKey = hyphenate(key);
  48661. if (isReservedAttribute(hyphenatedKey) ||
  48662. config.isReservedAttr(hyphenatedKey)) {
  48663. warn(
  48664. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48665. vm
  48666. );
  48667. }
  48668. defineReactive$$1(props, key, value, function () {
  48669. if (!isRoot && !isUpdatingChildComponent) {
  48670. warn(
  48671. "Avoid mutating a prop directly since the value will be " +
  48672. "overwritten whenever the parent component re-renders. " +
  48673. "Instead, use a data or computed property based on the prop's " +
  48674. "value. Prop being mutated: \"" + key + "\"",
  48675. vm
  48676. );
  48677. }
  48678. });
  48679. }
  48680. // static props are already proxied on the component's prototype
  48681. // during Vue.extend(). We only need to proxy props defined at
  48682. // instantiation here.
  48683. if (!(key in vm)) {
  48684. proxy(vm, "_props", key);
  48685. }
  48686. };
  48687. for (var key in propsOptions) loop( key );
  48688. toggleObserving(true);
  48689. }
  48690. function initData (vm) {
  48691. var data = vm.$options.data;
  48692. data = vm._data = typeof data === 'function'
  48693. ? getData(data, vm)
  48694. : data || {};
  48695. if (!isPlainObject(data)) {
  48696. data = {};
  48697. warn(
  48698. 'data functions should return an object:\n' +
  48699. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48700. vm
  48701. );
  48702. }
  48703. // proxy data on instance
  48704. var keys = Object.keys(data);
  48705. var props = vm.$options.props;
  48706. var methods = vm.$options.methods;
  48707. var i = keys.length;
  48708. while (i--) {
  48709. var key = keys[i];
  48710. {
  48711. if (methods && hasOwn(methods, key)) {
  48712. warn(
  48713. ("Method \"" + key + "\" has already been defined as a data property."),
  48714. vm
  48715. );
  48716. }
  48717. }
  48718. if (props && hasOwn(props, key)) {
  48719. warn(
  48720. "The data property \"" + key + "\" is already declared as a prop. " +
  48721. "Use prop default value instead.",
  48722. vm
  48723. );
  48724. } else if (!isReserved(key)) {
  48725. proxy(vm, "_data", key);
  48726. }
  48727. }
  48728. // observe data
  48729. observe(data, true /* asRootData */);
  48730. }
  48731. function getData (data, vm) {
  48732. // #7573 disable dep collection when invoking data getters
  48733. pushTarget();
  48734. try {
  48735. return data.call(vm, vm)
  48736. } catch (e) {
  48737. handleError(e, vm, "data()");
  48738. return {}
  48739. } finally {
  48740. popTarget();
  48741. }
  48742. }
  48743. var computedWatcherOptions = { lazy: true };
  48744. function initComputed (vm, computed) {
  48745. // $flow-disable-line
  48746. var watchers = vm._computedWatchers = Object.create(null);
  48747. // computed properties are just getters during SSR
  48748. var isSSR = isServerRendering();
  48749. for (var key in computed) {
  48750. var userDef = computed[key];
  48751. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48752. if (getter == null) {
  48753. warn(
  48754. ("Getter is missing for computed property \"" + key + "\"."),
  48755. vm
  48756. );
  48757. }
  48758. if (!isSSR) {
  48759. // create internal watcher for the computed property.
  48760. watchers[key] = new Watcher(
  48761. vm,
  48762. getter || noop,
  48763. noop,
  48764. computedWatcherOptions
  48765. );
  48766. }
  48767. // component-defined computed properties are already defined on the
  48768. // component prototype. We only need to define computed properties defined
  48769. // at instantiation here.
  48770. if (!(key in vm)) {
  48771. defineComputed(vm, key, userDef);
  48772. } else {
  48773. if (key in vm.$data) {
  48774. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48775. } else if (vm.$options.props && key in vm.$options.props) {
  48776. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48777. }
  48778. }
  48779. }
  48780. }
  48781. function defineComputed (
  48782. target,
  48783. key,
  48784. userDef
  48785. ) {
  48786. var shouldCache = !isServerRendering();
  48787. if (typeof userDef === 'function') {
  48788. sharedPropertyDefinition.get = shouldCache
  48789. ? createComputedGetter(key)
  48790. : createGetterInvoker(userDef);
  48791. sharedPropertyDefinition.set = noop;
  48792. } else {
  48793. sharedPropertyDefinition.get = userDef.get
  48794. ? shouldCache && userDef.cache !== false
  48795. ? createComputedGetter(key)
  48796. : createGetterInvoker(userDef.get)
  48797. : noop;
  48798. sharedPropertyDefinition.set = userDef.set || noop;
  48799. }
  48800. if (sharedPropertyDefinition.set === noop) {
  48801. sharedPropertyDefinition.set = function () {
  48802. warn(
  48803. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48804. this
  48805. );
  48806. };
  48807. }
  48808. Object.defineProperty(target, key, sharedPropertyDefinition);
  48809. }
  48810. function createComputedGetter (key) {
  48811. return function computedGetter () {
  48812. var watcher = this._computedWatchers && this._computedWatchers[key];
  48813. if (watcher) {
  48814. if (watcher.dirty) {
  48815. watcher.evaluate();
  48816. }
  48817. if (Dep.target) {
  48818. watcher.depend();
  48819. }
  48820. return watcher.value
  48821. }
  48822. }
  48823. }
  48824. function createGetterInvoker(fn) {
  48825. return function computedGetter () {
  48826. return fn.call(this, this)
  48827. }
  48828. }
  48829. function initMethods (vm, methods) {
  48830. var props = vm.$options.props;
  48831. for (var key in methods) {
  48832. {
  48833. if (typeof methods[key] !== 'function') {
  48834. warn(
  48835. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48836. "Did you reference the function correctly?",
  48837. vm
  48838. );
  48839. }
  48840. if (props && hasOwn(props, key)) {
  48841. warn(
  48842. ("Method \"" + key + "\" has already been defined as a prop."),
  48843. vm
  48844. );
  48845. }
  48846. if ((key in vm) && isReserved(key)) {
  48847. warn(
  48848. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48849. "Avoid defining component methods that start with _ or $."
  48850. );
  48851. }
  48852. }
  48853. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48854. }
  48855. }
  48856. function initWatch (vm, watch) {
  48857. for (var key in watch) {
  48858. var handler = watch[key];
  48859. if (Array.isArray(handler)) {
  48860. for (var i = 0; i < handler.length; i++) {
  48861. createWatcher(vm, key, handler[i]);
  48862. }
  48863. } else {
  48864. createWatcher(vm, key, handler);
  48865. }
  48866. }
  48867. }
  48868. function createWatcher (
  48869. vm,
  48870. expOrFn,
  48871. handler,
  48872. options
  48873. ) {
  48874. if (isPlainObject(handler)) {
  48875. options = handler;
  48876. handler = handler.handler;
  48877. }
  48878. if (typeof handler === 'string') {
  48879. handler = vm[handler];
  48880. }
  48881. return vm.$watch(expOrFn, handler, options)
  48882. }
  48883. function stateMixin (Vue) {
  48884. // flow somehow has problems with directly declared definition object
  48885. // when using Object.defineProperty, so we have to procedurally build up
  48886. // the object here.
  48887. var dataDef = {};
  48888. dataDef.get = function () { return this._data };
  48889. var propsDef = {};
  48890. propsDef.get = function () { return this._props };
  48891. {
  48892. dataDef.set = function () {
  48893. warn(
  48894. 'Avoid replacing instance root $data. ' +
  48895. 'Use nested data properties instead.',
  48896. this
  48897. );
  48898. };
  48899. propsDef.set = function () {
  48900. warn("$props is readonly.", this);
  48901. };
  48902. }
  48903. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48904. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48905. Vue.prototype.$set = set;
  48906. Vue.prototype.$delete = del;
  48907. Vue.prototype.$watch = function (
  48908. expOrFn,
  48909. cb,
  48910. options
  48911. ) {
  48912. var vm = this;
  48913. if (isPlainObject(cb)) {
  48914. return createWatcher(vm, expOrFn, cb, options)
  48915. }
  48916. options = options || {};
  48917. options.user = true;
  48918. var watcher = new Watcher(vm, expOrFn, cb, options);
  48919. if (options.immediate) {
  48920. try {
  48921. cb.call(vm, watcher.value);
  48922. } catch (error) {
  48923. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48924. }
  48925. }
  48926. return function unwatchFn () {
  48927. watcher.teardown();
  48928. }
  48929. };
  48930. }
  48931. /* */
  48932. var uid$3 = 0;
  48933. function initMixin (Vue) {
  48934. Vue.prototype._init = function (options) {
  48935. var vm = this;
  48936. // a uid
  48937. vm._uid = uid$3++;
  48938. var startTag, endTag;
  48939. /* istanbul ignore if */
  48940. if (config.performance && mark) {
  48941. startTag = "vue-perf-start:" + (vm._uid);
  48942. endTag = "vue-perf-end:" + (vm._uid);
  48943. mark(startTag);
  48944. }
  48945. // a flag to avoid this being observed
  48946. vm._isVue = true;
  48947. // merge options
  48948. if (options && options._isComponent) {
  48949. // optimize internal component instantiation
  48950. // since dynamic options merging is pretty slow, and none of the
  48951. // internal component options needs special treatment.
  48952. initInternalComponent(vm, options);
  48953. } else {
  48954. vm.$options = mergeOptions(
  48955. resolveConstructorOptions(vm.constructor),
  48956. options || {},
  48957. vm
  48958. );
  48959. }
  48960. /* istanbul ignore else */
  48961. {
  48962. initProxy(vm);
  48963. }
  48964. // expose real self
  48965. vm._self = vm;
  48966. initLifecycle(vm);
  48967. initEvents(vm);
  48968. initRender(vm);
  48969. callHook(vm, 'beforeCreate');
  48970. initInjections(vm); // resolve injections before data/props
  48971. initState(vm);
  48972. initProvide(vm); // resolve provide after data/props
  48973. callHook(vm, 'created');
  48974. /* istanbul ignore if */
  48975. if (config.performance && mark) {
  48976. vm._name = formatComponentName(vm, false);
  48977. mark(endTag);
  48978. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48979. }
  48980. if (vm.$options.el) {
  48981. vm.$mount(vm.$options.el);
  48982. }
  48983. };
  48984. }
  48985. function initInternalComponent (vm, options) {
  48986. var opts = vm.$options = Object.create(vm.constructor.options);
  48987. // doing this because it's faster than dynamic enumeration.
  48988. var parentVnode = options._parentVnode;
  48989. opts.parent = options.parent;
  48990. opts._parentVnode = parentVnode;
  48991. var vnodeComponentOptions = parentVnode.componentOptions;
  48992. opts.propsData = vnodeComponentOptions.propsData;
  48993. opts._parentListeners = vnodeComponentOptions.listeners;
  48994. opts._renderChildren = vnodeComponentOptions.children;
  48995. opts._componentTag = vnodeComponentOptions.tag;
  48996. if (options.render) {
  48997. opts.render = options.render;
  48998. opts.staticRenderFns = options.staticRenderFns;
  48999. }
  49000. }
  49001. function resolveConstructorOptions (Ctor) {
  49002. var options = Ctor.options;
  49003. if (Ctor.super) {
  49004. var superOptions = resolveConstructorOptions(Ctor.super);
  49005. var cachedSuperOptions = Ctor.superOptions;
  49006. if (superOptions !== cachedSuperOptions) {
  49007. // super option changed,
  49008. // need to resolve new options.
  49009. Ctor.superOptions = superOptions;
  49010. // check if there are any late-modified/attached options (#4976)
  49011. var modifiedOptions = resolveModifiedOptions(Ctor);
  49012. // update base extend options
  49013. if (modifiedOptions) {
  49014. extend(Ctor.extendOptions, modifiedOptions);
  49015. }
  49016. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49017. if (options.name) {
  49018. options.components[options.name] = Ctor;
  49019. }
  49020. }
  49021. }
  49022. return options
  49023. }
  49024. function resolveModifiedOptions (Ctor) {
  49025. var modified;
  49026. var latest = Ctor.options;
  49027. var sealed = Ctor.sealedOptions;
  49028. for (var key in latest) {
  49029. if (latest[key] !== sealed[key]) {
  49030. if (!modified) { modified = {}; }
  49031. modified[key] = latest[key];
  49032. }
  49033. }
  49034. return modified
  49035. }
  49036. function Vue (options) {
  49037. if (!(this instanceof Vue)
  49038. ) {
  49039. warn('Vue is a constructor and should be called with the `new` keyword');
  49040. }
  49041. this._init(options);
  49042. }
  49043. initMixin(Vue);
  49044. stateMixin(Vue);
  49045. eventsMixin(Vue);
  49046. lifecycleMixin(Vue);
  49047. renderMixin(Vue);
  49048. /* */
  49049. function initUse (Vue) {
  49050. Vue.use = function (plugin) {
  49051. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49052. if (installedPlugins.indexOf(plugin) > -1) {
  49053. return this
  49054. }
  49055. // additional parameters
  49056. var args = toArray(arguments, 1);
  49057. args.unshift(this);
  49058. if (typeof plugin.install === 'function') {
  49059. plugin.install.apply(plugin, args);
  49060. } else if (typeof plugin === 'function') {
  49061. plugin.apply(null, args);
  49062. }
  49063. installedPlugins.push(plugin);
  49064. return this
  49065. };
  49066. }
  49067. /* */
  49068. function initMixin$1 (Vue) {
  49069. Vue.mixin = function (mixin) {
  49070. this.options = mergeOptions(this.options, mixin);
  49071. return this
  49072. };
  49073. }
  49074. /* */
  49075. function initExtend (Vue) {
  49076. /**
  49077. * Each instance constructor, including Vue, has a unique
  49078. * cid. This enables us to create wrapped "child
  49079. * constructors" for prototypal inheritance and cache them.
  49080. */
  49081. Vue.cid = 0;
  49082. var cid = 1;
  49083. /**
  49084. * Class inheritance
  49085. */
  49086. Vue.extend = function (extendOptions) {
  49087. extendOptions = extendOptions || {};
  49088. var Super = this;
  49089. var SuperId = Super.cid;
  49090. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49091. if (cachedCtors[SuperId]) {
  49092. return cachedCtors[SuperId]
  49093. }
  49094. var name = extendOptions.name || Super.options.name;
  49095. if (name) {
  49096. validateComponentName(name);
  49097. }
  49098. var Sub = function VueComponent (options) {
  49099. this._init(options);
  49100. };
  49101. Sub.prototype = Object.create(Super.prototype);
  49102. Sub.prototype.constructor = Sub;
  49103. Sub.cid = cid++;
  49104. Sub.options = mergeOptions(
  49105. Super.options,
  49106. extendOptions
  49107. );
  49108. Sub['super'] = Super;
  49109. // For props and computed properties, we define the proxy getters on
  49110. // the Vue instances at extension time, on the extended prototype. This
  49111. // avoids Object.defineProperty calls for each instance created.
  49112. if (Sub.options.props) {
  49113. initProps$1(Sub);
  49114. }
  49115. if (Sub.options.computed) {
  49116. initComputed$1(Sub);
  49117. }
  49118. // allow further extension/mixin/plugin usage
  49119. Sub.extend = Super.extend;
  49120. Sub.mixin = Super.mixin;
  49121. Sub.use = Super.use;
  49122. // create asset registers, so extended classes
  49123. // can have their private assets too.
  49124. ASSET_TYPES.forEach(function (type) {
  49125. Sub[type] = Super[type];
  49126. });
  49127. // enable recursive self-lookup
  49128. if (name) {
  49129. Sub.options.components[name] = Sub;
  49130. }
  49131. // keep a reference to the super options at extension time.
  49132. // later at instantiation we can check if Super's options have
  49133. // been updated.
  49134. Sub.superOptions = Super.options;
  49135. Sub.extendOptions = extendOptions;
  49136. Sub.sealedOptions = extend({}, Sub.options);
  49137. // cache constructor
  49138. cachedCtors[SuperId] = Sub;
  49139. return Sub
  49140. };
  49141. }
  49142. function initProps$1 (Comp) {
  49143. var props = Comp.options.props;
  49144. for (var key in props) {
  49145. proxy(Comp.prototype, "_props", key);
  49146. }
  49147. }
  49148. function initComputed$1 (Comp) {
  49149. var computed = Comp.options.computed;
  49150. for (var key in computed) {
  49151. defineComputed(Comp.prototype, key, computed[key]);
  49152. }
  49153. }
  49154. /* */
  49155. function initAssetRegisters (Vue) {
  49156. /**
  49157. * Create asset registration methods.
  49158. */
  49159. ASSET_TYPES.forEach(function (type) {
  49160. Vue[type] = function (
  49161. id,
  49162. definition
  49163. ) {
  49164. if (!definition) {
  49165. return this.options[type + 's'][id]
  49166. } else {
  49167. /* istanbul ignore if */
  49168. if (type === 'component') {
  49169. validateComponentName(id);
  49170. }
  49171. if (type === 'component' && isPlainObject(definition)) {
  49172. definition.name = definition.name || id;
  49173. definition = this.options._base.extend(definition);
  49174. }
  49175. if (type === 'directive' && typeof definition === 'function') {
  49176. definition = { bind: definition, update: definition };
  49177. }
  49178. this.options[type + 's'][id] = definition;
  49179. return definition
  49180. }
  49181. };
  49182. });
  49183. }
  49184. /* */
  49185. function getComponentName (opts) {
  49186. return opts && (opts.Ctor.options.name || opts.tag)
  49187. }
  49188. function matches (pattern, name) {
  49189. if (Array.isArray(pattern)) {
  49190. return pattern.indexOf(name) > -1
  49191. } else if (typeof pattern === 'string') {
  49192. return pattern.split(',').indexOf(name) > -1
  49193. } else if (isRegExp(pattern)) {
  49194. return pattern.test(name)
  49195. }
  49196. /* istanbul ignore next */
  49197. return false
  49198. }
  49199. function pruneCache (keepAliveInstance, filter) {
  49200. var cache = keepAliveInstance.cache;
  49201. var keys = keepAliveInstance.keys;
  49202. var _vnode = keepAliveInstance._vnode;
  49203. for (var key in cache) {
  49204. var cachedNode = cache[key];
  49205. if (cachedNode) {
  49206. var name = getComponentName(cachedNode.componentOptions);
  49207. if (name && !filter(name)) {
  49208. pruneCacheEntry(cache, key, keys, _vnode);
  49209. }
  49210. }
  49211. }
  49212. }
  49213. function pruneCacheEntry (
  49214. cache,
  49215. key,
  49216. keys,
  49217. current
  49218. ) {
  49219. var cached$$1 = cache[key];
  49220. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49221. cached$$1.componentInstance.$destroy();
  49222. }
  49223. cache[key] = null;
  49224. remove(keys, key);
  49225. }
  49226. var patternTypes = [String, RegExp, Array];
  49227. var KeepAlive = {
  49228. name: 'keep-alive',
  49229. abstract: true,
  49230. props: {
  49231. include: patternTypes,
  49232. exclude: patternTypes,
  49233. max: [String, Number]
  49234. },
  49235. created: function created () {
  49236. this.cache = Object.create(null);
  49237. this.keys = [];
  49238. },
  49239. destroyed: function destroyed () {
  49240. for (var key in this.cache) {
  49241. pruneCacheEntry(this.cache, key, this.keys);
  49242. }
  49243. },
  49244. mounted: function mounted () {
  49245. var this$1 = this;
  49246. this.$watch('include', function (val) {
  49247. pruneCache(this$1, function (name) { return matches(val, name); });
  49248. });
  49249. this.$watch('exclude', function (val) {
  49250. pruneCache(this$1, function (name) { return !matches(val, name); });
  49251. });
  49252. },
  49253. render: function render () {
  49254. var slot = this.$slots.default;
  49255. var vnode = getFirstComponentChild(slot);
  49256. var componentOptions = vnode && vnode.componentOptions;
  49257. if (componentOptions) {
  49258. // check pattern
  49259. var name = getComponentName(componentOptions);
  49260. var ref = this;
  49261. var include = ref.include;
  49262. var exclude = ref.exclude;
  49263. if (
  49264. // not included
  49265. (include && (!name || !matches(include, name))) ||
  49266. // excluded
  49267. (exclude && name && matches(exclude, name))
  49268. ) {
  49269. return vnode
  49270. }
  49271. var ref$1 = this;
  49272. var cache = ref$1.cache;
  49273. var keys = ref$1.keys;
  49274. var key = vnode.key == null
  49275. // same constructor may get registered as different local components
  49276. // so cid alone is not enough (#3269)
  49277. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49278. : vnode.key;
  49279. if (cache[key]) {
  49280. vnode.componentInstance = cache[key].componentInstance;
  49281. // make current key freshest
  49282. remove(keys, key);
  49283. keys.push(key);
  49284. } else {
  49285. cache[key] = vnode;
  49286. keys.push(key);
  49287. // prune oldest entry
  49288. if (this.max && keys.length > parseInt(this.max)) {
  49289. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49290. }
  49291. }
  49292. vnode.data.keepAlive = true;
  49293. }
  49294. return vnode || (slot && slot[0])
  49295. }
  49296. };
  49297. var builtInComponents = {
  49298. KeepAlive: KeepAlive
  49299. };
  49300. /* */
  49301. function initGlobalAPI (Vue) {
  49302. // config
  49303. var configDef = {};
  49304. configDef.get = function () { return config; };
  49305. {
  49306. configDef.set = function () {
  49307. warn(
  49308. 'Do not replace the Vue.config object, set individual fields instead.'
  49309. );
  49310. };
  49311. }
  49312. Object.defineProperty(Vue, 'config', configDef);
  49313. // exposed util methods.
  49314. // NOTE: these are not considered part of the public API - avoid relying on
  49315. // them unless you are aware of the risk.
  49316. Vue.util = {
  49317. warn: warn,
  49318. extend: extend,
  49319. mergeOptions: mergeOptions,
  49320. defineReactive: defineReactive$$1
  49321. };
  49322. Vue.set = set;
  49323. Vue.delete = del;
  49324. Vue.nextTick = nextTick;
  49325. // 2.6 explicit observable API
  49326. Vue.observable = function (obj) {
  49327. observe(obj);
  49328. return obj
  49329. };
  49330. Vue.options = Object.create(null);
  49331. ASSET_TYPES.forEach(function (type) {
  49332. Vue.options[type + 's'] = Object.create(null);
  49333. });
  49334. // this is used to identify the "base" constructor to extend all plain-object
  49335. // components with in Weex's multi-instance scenarios.
  49336. Vue.options._base = Vue;
  49337. extend(Vue.options.components, builtInComponents);
  49338. initUse(Vue);
  49339. initMixin$1(Vue);
  49340. initExtend(Vue);
  49341. initAssetRegisters(Vue);
  49342. }
  49343. initGlobalAPI(Vue);
  49344. Object.defineProperty(Vue.prototype, '$isServer', {
  49345. get: isServerRendering
  49346. });
  49347. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49348. get: function get () {
  49349. /* istanbul ignore next */
  49350. return this.$vnode && this.$vnode.ssrContext
  49351. }
  49352. });
  49353. // expose FunctionalRenderContext for ssr runtime helper installation
  49354. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49355. value: FunctionalRenderContext
  49356. });
  49357. Vue.version = '2.6.11';
  49358. /* */
  49359. // these are reserved for web because they are directly compiled away
  49360. // during template compilation
  49361. var isReservedAttr = makeMap('style,class');
  49362. // attributes that should be using props for binding
  49363. var acceptValue = makeMap('input,textarea,option,select,progress');
  49364. var mustUseProp = function (tag, type, attr) {
  49365. return (
  49366. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49367. (attr === 'selected' && tag === 'option') ||
  49368. (attr === 'checked' && tag === 'input') ||
  49369. (attr === 'muted' && tag === 'video')
  49370. )
  49371. };
  49372. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49373. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49374. var convertEnumeratedValue = function (key, value) {
  49375. return isFalsyAttrValue(value) || value === 'false'
  49376. ? 'false'
  49377. // allow arbitrary string value for contenteditable
  49378. : key === 'contenteditable' && isValidContentEditableValue(value)
  49379. ? value
  49380. : 'true'
  49381. };
  49382. var isBooleanAttr = makeMap(
  49383. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49384. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49385. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49386. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49387. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49388. 'truespeed,typemustmatch,visible'
  49389. );
  49390. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49391. var isXlink = function (name) {
  49392. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49393. };
  49394. var getXlinkProp = function (name) {
  49395. return isXlink(name) ? name.slice(6, name.length) : ''
  49396. };
  49397. var isFalsyAttrValue = function (val) {
  49398. return val == null || val === false
  49399. };
  49400. /* */
  49401. function genClassForVnode (vnode) {
  49402. var data = vnode.data;
  49403. var parentNode = vnode;
  49404. var childNode = vnode;
  49405. while (isDef(childNode.componentInstance)) {
  49406. childNode = childNode.componentInstance._vnode;
  49407. if (childNode && childNode.data) {
  49408. data = mergeClassData(childNode.data, data);
  49409. }
  49410. }
  49411. while (isDef(parentNode = parentNode.parent)) {
  49412. if (parentNode && parentNode.data) {
  49413. data = mergeClassData(data, parentNode.data);
  49414. }
  49415. }
  49416. return renderClass(data.staticClass, data.class)
  49417. }
  49418. function mergeClassData (child, parent) {
  49419. return {
  49420. staticClass: concat(child.staticClass, parent.staticClass),
  49421. class: isDef(child.class)
  49422. ? [child.class, parent.class]
  49423. : parent.class
  49424. }
  49425. }
  49426. function renderClass (
  49427. staticClass,
  49428. dynamicClass
  49429. ) {
  49430. if (isDef(staticClass) || isDef(dynamicClass)) {
  49431. return concat(staticClass, stringifyClass(dynamicClass))
  49432. }
  49433. /* istanbul ignore next */
  49434. return ''
  49435. }
  49436. function concat (a, b) {
  49437. return a ? b ? (a + ' ' + b) : a : (b || '')
  49438. }
  49439. function stringifyClass (value) {
  49440. if (Array.isArray(value)) {
  49441. return stringifyArray(value)
  49442. }
  49443. if (isObject(value)) {
  49444. return stringifyObject(value)
  49445. }
  49446. if (typeof value === 'string') {
  49447. return value
  49448. }
  49449. /* istanbul ignore next */
  49450. return ''
  49451. }
  49452. function stringifyArray (value) {
  49453. var res = '';
  49454. var stringified;
  49455. for (var i = 0, l = value.length; i < l; i++) {
  49456. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49457. if (res) { res += ' '; }
  49458. res += stringified;
  49459. }
  49460. }
  49461. return res
  49462. }
  49463. function stringifyObject (value) {
  49464. var res = '';
  49465. for (var key in value) {
  49466. if (value[key]) {
  49467. if (res) { res += ' '; }
  49468. res += key;
  49469. }
  49470. }
  49471. return res
  49472. }
  49473. /* */
  49474. var namespaceMap = {
  49475. svg: 'http://www.w3.org/2000/svg',
  49476. math: 'http://www.w3.org/1998/Math/MathML'
  49477. };
  49478. var isHTMLTag = makeMap(
  49479. 'html,body,base,head,link,meta,style,title,' +
  49480. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49481. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49482. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49483. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49484. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49485. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49486. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49487. 'output,progress,select,textarea,' +
  49488. 'details,dialog,menu,menuitem,summary,' +
  49489. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49490. );
  49491. // this map is intentionally selective, only covering SVG elements that may
  49492. // contain child elements.
  49493. var isSVG = makeMap(
  49494. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49495. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49496. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49497. true
  49498. );
  49499. var isPreTag = function (tag) { return tag === 'pre'; };
  49500. var isReservedTag = function (tag) {
  49501. return isHTMLTag(tag) || isSVG(tag)
  49502. };
  49503. function getTagNamespace (tag) {
  49504. if (isSVG(tag)) {
  49505. return 'svg'
  49506. }
  49507. // basic support for MathML
  49508. // note it doesn't support other MathML elements being component roots
  49509. if (tag === 'math') {
  49510. return 'math'
  49511. }
  49512. }
  49513. var unknownElementCache = Object.create(null);
  49514. function isUnknownElement (tag) {
  49515. /* istanbul ignore if */
  49516. if (!inBrowser) {
  49517. return true
  49518. }
  49519. if (isReservedTag(tag)) {
  49520. return false
  49521. }
  49522. tag = tag.toLowerCase();
  49523. /* istanbul ignore if */
  49524. if (unknownElementCache[tag] != null) {
  49525. return unknownElementCache[tag]
  49526. }
  49527. var el = document.createElement(tag);
  49528. if (tag.indexOf('-') > -1) {
  49529. // http://stackoverflow.com/a/28210364/1070244
  49530. return (unknownElementCache[tag] = (
  49531. el.constructor === window.HTMLUnknownElement ||
  49532. el.constructor === window.HTMLElement
  49533. ))
  49534. } else {
  49535. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49536. }
  49537. }
  49538. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49539. /* */
  49540. /**
  49541. * Query an element selector if it's not an element already.
  49542. */
  49543. function query (el) {
  49544. if (typeof el === 'string') {
  49545. var selected = document.querySelector(el);
  49546. if (!selected) {
  49547. warn(
  49548. 'Cannot find element: ' + el
  49549. );
  49550. return document.createElement('div')
  49551. }
  49552. return selected
  49553. } else {
  49554. return el
  49555. }
  49556. }
  49557. /* */
  49558. function createElement$1 (tagName, vnode) {
  49559. var elm = document.createElement(tagName);
  49560. if (tagName !== 'select') {
  49561. return elm
  49562. }
  49563. // false or null will remove the attribute but undefined will not
  49564. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49565. elm.setAttribute('multiple', 'multiple');
  49566. }
  49567. return elm
  49568. }
  49569. function createElementNS (namespace, tagName) {
  49570. return document.createElementNS(namespaceMap[namespace], tagName)
  49571. }
  49572. function createTextNode (text) {
  49573. return document.createTextNode(text)
  49574. }
  49575. function createComment (text) {
  49576. return document.createComment(text)
  49577. }
  49578. function insertBefore (parentNode, newNode, referenceNode) {
  49579. parentNode.insertBefore(newNode, referenceNode);
  49580. }
  49581. function removeChild (node, child) {
  49582. node.removeChild(child);
  49583. }
  49584. function appendChild (node, child) {
  49585. node.appendChild(child);
  49586. }
  49587. function parentNode (node) {
  49588. return node.parentNode
  49589. }
  49590. function nextSibling (node) {
  49591. return node.nextSibling
  49592. }
  49593. function tagName (node) {
  49594. return node.tagName
  49595. }
  49596. function setTextContent (node, text) {
  49597. node.textContent = text;
  49598. }
  49599. function setStyleScope (node, scopeId) {
  49600. node.setAttribute(scopeId, '');
  49601. }
  49602. var nodeOps = /*#__PURE__*/Object.freeze({
  49603. createElement: createElement$1,
  49604. createElementNS: createElementNS,
  49605. createTextNode: createTextNode,
  49606. createComment: createComment,
  49607. insertBefore: insertBefore,
  49608. removeChild: removeChild,
  49609. appendChild: appendChild,
  49610. parentNode: parentNode,
  49611. nextSibling: nextSibling,
  49612. tagName: tagName,
  49613. setTextContent: setTextContent,
  49614. setStyleScope: setStyleScope
  49615. });
  49616. /* */
  49617. var ref = {
  49618. create: function create (_, vnode) {
  49619. registerRef(vnode);
  49620. },
  49621. update: function update (oldVnode, vnode) {
  49622. if (oldVnode.data.ref !== vnode.data.ref) {
  49623. registerRef(oldVnode, true);
  49624. registerRef(vnode);
  49625. }
  49626. },
  49627. destroy: function destroy (vnode) {
  49628. registerRef(vnode, true);
  49629. }
  49630. };
  49631. function registerRef (vnode, isRemoval) {
  49632. var key = vnode.data.ref;
  49633. if (!isDef(key)) { return }
  49634. var vm = vnode.context;
  49635. var ref = vnode.componentInstance || vnode.elm;
  49636. var refs = vm.$refs;
  49637. if (isRemoval) {
  49638. if (Array.isArray(refs[key])) {
  49639. remove(refs[key], ref);
  49640. } else if (refs[key] === ref) {
  49641. refs[key] = undefined;
  49642. }
  49643. } else {
  49644. if (vnode.data.refInFor) {
  49645. if (!Array.isArray(refs[key])) {
  49646. refs[key] = [ref];
  49647. } else if (refs[key].indexOf(ref) < 0) {
  49648. // $flow-disable-line
  49649. refs[key].push(ref);
  49650. }
  49651. } else {
  49652. refs[key] = ref;
  49653. }
  49654. }
  49655. }
  49656. /**
  49657. * Virtual DOM patching algorithm based on Snabbdom by
  49658. * Simon Friis Vindum (@paldepind)
  49659. * Licensed under the MIT License
  49660. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49661. *
  49662. * modified by Evan You (@yyx990803)
  49663. *
  49664. * Not type-checking this because this file is perf-critical and the cost
  49665. * of making flow understand it is not worth it.
  49666. */
  49667. var emptyNode = new VNode('', {}, []);
  49668. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49669. function sameVnode (a, b) {
  49670. return (
  49671. a.key === b.key && (
  49672. (
  49673. a.tag === b.tag &&
  49674. a.isComment === b.isComment &&
  49675. isDef(a.data) === isDef(b.data) &&
  49676. sameInputType(a, b)
  49677. ) || (
  49678. isTrue(a.isAsyncPlaceholder) &&
  49679. a.asyncFactory === b.asyncFactory &&
  49680. isUndef(b.asyncFactory.error)
  49681. )
  49682. )
  49683. )
  49684. }
  49685. function sameInputType (a, b) {
  49686. if (a.tag !== 'input') { return true }
  49687. var i;
  49688. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49689. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49690. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49691. }
  49692. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49693. var i, key;
  49694. var map = {};
  49695. for (i = beginIdx; i <= endIdx; ++i) {
  49696. key = children[i].key;
  49697. if (isDef(key)) { map[key] = i; }
  49698. }
  49699. return map
  49700. }
  49701. function createPatchFunction (backend) {
  49702. var i, j;
  49703. var cbs = {};
  49704. var modules = backend.modules;
  49705. var nodeOps = backend.nodeOps;
  49706. for (i = 0; i < hooks.length; ++i) {
  49707. cbs[hooks[i]] = [];
  49708. for (j = 0; j < modules.length; ++j) {
  49709. if (isDef(modules[j][hooks[i]])) {
  49710. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49711. }
  49712. }
  49713. }
  49714. function emptyNodeAt (elm) {
  49715. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49716. }
  49717. function createRmCb (childElm, listeners) {
  49718. function remove$$1 () {
  49719. if (--remove$$1.listeners === 0) {
  49720. removeNode(childElm);
  49721. }
  49722. }
  49723. remove$$1.listeners = listeners;
  49724. return remove$$1
  49725. }
  49726. function removeNode (el) {
  49727. var parent = nodeOps.parentNode(el);
  49728. // element may have already been removed due to v-html / v-text
  49729. if (isDef(parent)) {
  49730. nodeOps.removeChild(parent, el);
  49731. }
  49732. }
  49733. function isUnknownElement$$1 (vnode, inVPre) {
  49734. return (
  49735. !inVPre &&
  49736. !vnode.ns &&
  49737. !(
  49738. config.ignoredElements.length &&
  49739. config.ignoredElements.some(function (ignore) {
  49740. return isRegExp(ignore)
  49741. ? ignore.test(vnode.tag)
  49742. : ignore === vnode.tag
  49743. })
  49744. ) &&
  49745. config.isUnknownElement(vnode.tag)
  49746. )
  49747. }
  49748. var creatingElmInVPre = 0;
  49749. function createElm (
  49750. vnode,
  49751. insertedVnodeQueue,
  49752. parentElm,
  49753. refElm,
  49754. nested,
  49755. ownerArray,
  49756. index
  49757. ) {
  49758. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49759. // This vnode was used in a previous render!
  49760. // now it's used as a new node, overwriting its elm would cause
  49761. // potential patch errors down the road when it's used as an insertion
  49762. // reference node. Instead, we clone the node on-demand before creating
  49763. // associated DOM element for it.
  49764. vnode = ownerArray[index] = cloneVNode(vnode);
  49765. }
  49766. vnode.isRootInsert = !nested; // for transition enter check
  49767. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49768. return
  49769. }
  49770. var data = vnode.data;
  49771. var children = vnode.children;
  49772. var tag = vnode.tag;
  49773. if (isDef(tag)) {
  49774. {
  49775. if (data && data.pre) {
  49776. creatingElmInVPre++;
  49777. }
  49778. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49779. warn(
  49780. 'Unknown custom element: <' + tag + '> - did you ' +
  49781. 'register the component correctly? For recursive components, ' +
  49782. 'make sure to provide the "name" option.',
  49783. vnode.context
  49784. );
  49785. }
  49786. }
  49787. vnode.elm = vnode.ns
  49788. ? nodeOps.createElementNS(vnode.ns, tag)
  49789. : nodeOps.createElement(tag, vnode);
  49790. setScope(vnode);
  49791. /* istanbul ignore if */
  49792. {
  49793. createChildren(vnode, children, insertedVnodeQueue);
  49794. if (isDef(data)) {
  49795. invokeCreateHooks(vnode, insertedVnodeQueue);
  49796. }
  49797. insert(parentElm, vnode.elm, refElm);
  49798. }
  49799. if (data && data.pre) {
  49800. creatingElmInVPre--;
  49801. }
  49802. } else if (isTrue(vnode.isComment)) {
  49803. vnode.elm = nodeOps.createComment(vnode.text);
  49804. insert(parentElm, vnode.elm, refElm);
  49805. } else {
  49806. vnode.elm = nodeOps.createTextNode(vnode.text);
  49807. insert(parentElm, vnode.elm, refElm);
  49808. }
  49809. }
  49810. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49811. var i = vnode.data;
  49812. if (isDef(i)) {
  49813. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49814. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49815. i(vnode, false /* hydrating */);
  49816. }
  49817. // after calling the init hook, if the vnode is a child component
  49818. // it should've created a child instance and mounted it. the child
  49819. // component also has set the placeholder vnode's elm.
  49820. // in that case we can just return the element and be done.
  49821. if (isDef(vnode.componentInstance)) {
  49822. initComponent(vnode, insertedVnodeQueue);
  49823. insert(parentElm, vnode.elm, refElm);
  49824. if (isTrue(isReactivated)) {
  49825. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49826. }
  49827. return true
  49828. }
  49829. }
  49830. }
  49831. function initComponent (vnode, insertedVnodeQueue) {
  49832. if (isDef(vnode.data.pendingInsert)) {
  49833. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49834. vnode.data.pendingInsert = null;
  49835. }
  49836. vnode.elm = vnode.componentInstance.$el;
  49837. if (isPatchable(vnode)) {
  49838. invokeCreateHooks(vnode, insertedVnodeQueue);
  49839. setScope(vnode);
  49840. } else {
  49841. // empty component root.
  49842. // skip all element-related modules except for ref (#3455)
  49843. registerRef(vnode);
  49844. // make sure to invoke the insert hook
  49845. insertedVnodeQueue.push(vnode);
  49846. }
  49847. }
  49848. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49849. var i;
  49850. // hack for #4339: a reactivated component with inner transition
  49851. // does not trigger because the inner node's created hooks are not called
  49852. // again. It's not ideal to involve module-specific logic in here but
  49853. // there doesn't seem to be a better way to do it.
  49854. var innerNode = vnode;
  49855. while (innerNode.componentInstance) {
  49856. innerNode = innerNode.componentInstance._vnode;
  49857. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49858. for (i = 0; i < cbs.activate.length; ++i) {
  49859. cbs.activate[i](emptyNode, innerNode);
  49860. }
  49861. insertedVnodeQueue.push(innerNode);
  49862. break
  49863. }
  49864. }
  49865. // unlike a newly created component,
  49866. // a reactivated keep-alive component doesn't insert itself
  49867. insert(parentElm, vnode.elm, refElm);
  49868. }
  49869. function insert (parent, elm, ref$$1) {
  49870. if (isDef(parent)) {
  49871. if (isDef(ref$$1)) {
  49872. if (nodeOps.parentNode(ref$$1) === parent) {
  49873. nodeOps.insertBefore(parent, elm, ref$$1);
  49874. }
  49875. } else {
  49876. nodeOps.appendChild(parent, elm);
  49877. }
  49878. }
  49879. }
  49880. function createChildren (vnode, children, insertedVnodeQueue) {
  49881. if (Array.isArray(children)) {
  49882. {
  49883. checkDuplicateKeys(children);
  49884. }
  49885. for (var i = 0; i < children.length; ++i) {
  49886. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49887. }
  49888. } else if (isPrimitive(vnode.text)) {
  49889. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49890. }
  49891. }
  49892. function isPatchable (vnode) {
  49893. while (vnode.componentInstance) {
  49894. vnode = vnode.componentInstance._vnode;
  49895. }
  49896. return isDef(vnode.tag)
  49897. }
  49898. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49899. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49900. cbs.create[i$1](emptyNode, vnode);
  49901. }
  49902. i = vnode.data.hook; // Reuse variable
  49903. if (isDef(i)) {
  49904. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49905. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49906. }
  49907. }
  49908. // set scope id attribute for scoped CSS.
  49909. // this is implemented as a special case to avoid the overhead
  49910. // of going through the normal attribute patching process.
  49911. function setScope (vnode) {
  49912. var i;
  49913. if (isDef(i = vnode.fnScopeId)) {
  49914. nodeOps.setStyleScope(vnode.elm, i);
  49915. } else {
  49916. var ancestor = vnode;
  49917. while (ancestor) {
  49918. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49919. nodeOps.setStyleScope(vnode.elm, i);
  49920. }
  49921. ancestor = ancestor.parent;
  49922. }
  49923. }
  49924. // for slot content they should also get the scopeId from the host instance.
  49925. if (isDef(i = activeInstance) &&
  49926. i !== vnode.context &&
  49927. i !== vnode.fnContext &&
  49928. isDef(i = i.$options._scopeId)
  49929. ) {
  49930. nodeOps.setStyleScope(vnode.elm, i);
  49931. }
  49932. }
  49933. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49934. for (; startIdx <= endIdx; ++startIdx) {
  49935. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49936. }
  49937. }
  49938. function invokeDestroyHook (vnode) {
  49939. var i, j;
  49940. var data = vnode.data;
  49941. if (isDef(data)) {
  49942. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49943. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49944. }
  49945. if (isDef(i = vnode.children)) {
  49946. for (j = 0; j < vnode.children.length; ++j) {
  49947. invokeDestroyHook(vnode.children[j]);
  49948. }
  49949. }
  49950. }
  49951. function removeVnodes (vnodes, startIdx, endIdx) {
  49952. for (; startIdx <= endIdx; ++startIdx) {
  49953. var ch = vnodes[startIdx];
  49954. if (isDef(ch)) {
  49955. if (isDef(ch.tag)) {
  49956. removeAndInvokeRemoveHook(ch);
  49957. invokeDestroyHook(ch);
  49958. } else { // Text node
  49959. removeNode(ch.elm);
  49960. }
  49961. }
  49962. }
  49963. }
  49964. function removeAndInvokeRemoveHook (vnode, rm) {
  49965. if (isDef(rm) || isDef(vnode.data)) {
  49966. var i;
  49967. var listeners = cbs.remove.length + 1;
  49968. if (isDef(rm)) {
  49969. // we have a recursively passed down rm callback
  49970. // increase the listeners count
  49971. rm.listeners += listeners;
  49972. } else {
  49973. // directly removing
  49974. rm = createRmCb(vnode.elm, listeners);
  49975. }
  49976. // recursively invoke hooks on child component root node
  49977. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49978. removeAndInvokeRemoveHook(i, rm);
  49979. }
  49980. for (i = 0; i < cbs.remove.length; ++i) {
  49981. cbs.remove[i](vnode, rm);
  49982. }
  49983. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49984. i(vnode, rm);
  49985. } else {
  49986. rm();
  49987. }
  49988. } else {
  49989. removeNode(vnode.elm);
  49990. }
  49991. }
  49992. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49993. var oldStartIdx = 0;
  49994. var newStartIdx = 0;
  49995. var oldEndIdx = oldCh.length - 1;
  49996. var oldStartVnode = oldCh[0];
  49997. var oldEndVnode = oldCh[oldEndIdx];
  49998. var newEndIdx = newCh.length - 1;
  49999. var newStartVnode = newCh[0];
  50000. var newEndVnode = newCh[newEndIdx];
  50001. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50002. // removeOnly is a special flag used only by <transition-group>
  50003. // to ensure removed elements stay in correct relative positions
  50004. // during leaving transitions
  50005. var canMove = !removeOnly;
  50006. {
  50007. checkDuplicateKeys(newCh);
  50008. }
  50009. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50010. if (isUndef(oldStartVnode)) {
  50011. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50012. } else if (isUndef(oldEndVnode)) {
  50013. oldEndVnode = oldCh[--oldEndIdx];
  50014. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50015. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50016. oldStartVnode = oldCh[++oldStartIdx];
  50017. newStartVnode = newCh[++newStartIdx];
  50018. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50019. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50020. oldEndVnode = oldCh[--oldEndIdx];
  50021. newEndVnode = newCh[--newEndIdx];
  50022. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50023. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50024. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50025. oldStartVnode = oldCh[++oldStartIdx];
  50026. newEndVnode = newCh[--newEndIdx];
  50027. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50028. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50029. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50030. oldEndVnode = oldCh[--oldEndIdx];
  50031. newStartVnode = newCh[++newStartIdx];
  50032. } else {
  50033. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50034. idxInOld = isDef(newStartVnode.key)
  50035. ? oldKeyToIdx[newStartVnode.key]
  50036. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50037. if (isUndef(idxInOld)) { // New element
  50038. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50039. } else {
  50040. vnodeToMove = oldCh[idxInOld];
  50041. if (sameVnode(vnodeToMove, newStartVnode)) {
  50042. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50043. oldCh[idxInOld] = undefined;
  50044. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50045. } else {
  50046. // same key but different element. treat as new element
  50047. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50048. }
  50049. }
  50050. newStartVnode = newCh[++newStartIdx];
  50051. }
  50052. }
  50053. if (oldStartIdx > oldEndIdx) {
  50054. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50055. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50056. } else if (newStartIdx > newEndIdx) {
  50057. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50058. }
  50059. }
  50060. function checkDuplicateKeys (children) {
  50061. var seenKeys = {};
  50062. for (var i = 0; i < children.length; i++) {
  50063. var vnode = children[i];
  50064. var key = vnode.key;
  50065. if (isDef(key)) {
  50066. if (seenKeys[key]) {
  50067. warn(
  50068. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50069. vnode.context
  50070. );
  50071. } else {
  50072. seenKeys[key] = true;
  50073. }
  50074. }
  50075. }
  50076. }
  50077. function findIdxInOld (node, oldCh, start, end) {
  50078. for (var i = start; i < end; i++) {
  50079. var c = oldCh[i];
  50080. if (isDef(c) && sameVnode(node, c)) { return i }
  50081. }
  50082. }
  50083. function patchVnode (
  50084. oldVnode,
  50085. vnode,
  50086. insertedVnodeQueue,
  50087. ownerArray,
  50088. index,
  50089. removeOnly
  50090. ) {
  50091. if (oldVnode === vnode) {
  50092. return
  50093. }
  50094. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50095. // clone reused vnode
  50096. vnode = ownerArray[index] = cloneVNode(vnode);
  50097. }
  50098. var elm = vnode.elm = oldVnode.elm;
  50099. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50100. if (isDef(vnode.asyncFactory.resolved)) {
  50101. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50102. } else {
  50103. vnode.isAsyncPlaceholder = true;
  50104. }
  50105. return
  50106. }
  50107. // reuse element for static trees.
  50108. // note we only do this if the vnode is cloned -
  50109. // if the new node is not cloned it means the render functions have been
  50110. // reset by the hot-reload-api and we need to do a proper re-render.
  50111. if (isTrue(vnode.isStatic) &&
  50112. isTrue(oldVnode.isStatic) &&
  50113. vnode.key === oldVnode.key &&
  50114. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50115. ) {
  50116. vnode.componentInstance = oldVnode.componentInstance;
  50117. return
  50118. }
  50119. var i;
  50120. var data = vnode.data;
  50121. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50122. i(oldVnode, vnode);
  50123. }
  50124. var oldCh = oldVnode.children;
  50125. var ch = vnode.children;
  50126. if (isDef(data) && isPatchable(vnode)) {
  50127. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50128. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50129. }
  50130. if (isUndef(vnode.text)) {
  50131. if (isDef(oldCh) && isDef(ch)) {
  50132. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50133. } else if (isDef(ch)) {
  50134. {
  50135. checkDuplicateKeys(ch);
  50136. }
  50137. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50138. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50139. } else if (isDef(oldCh)) {
  50140. removeVnodes(oldCh, 0, oldCh.length - 1);
  50141. } else if (isDef(oldVnode.text)) {
  50142. nodeOps.setTextContent(elm, '');
  50143. }
  50144. } else if (oldVnode.text !== vnode.text) {
  50145. nodeOps.setTextContent(elm, vnode.text);
  50146. }
  50147. if (isDef(data)) {
  50148. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50149. }
  50150. }
  50151. function invokeInsertHook (vnode, queue, initial) {
  50152. // delay insert hooks for component root nodes, invoke them after the
  50153. // element is really inserted
  50154. if (isTrue(initial) && isDef(vnode.parent)) {
  50155. vnode.parent.data.pendingInsert = queue;
  50156. } else {
  50157. for (var i = 0; i < queue.length; ++i) {
  50158. queue[i].data.hook.insert(queue[i]);
  50159. }
  50160. }
  50161. }
  50162. var hydrationBailed = false;
  50163. // list of modules that can skip create hook during hydration because they
  50164. // are already rendered on the client or has no need for initialization
  50165. // Note: style is excluded because it relies on initial clone for future
  50166. // deep updates (#7063).
  50167. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50168. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50169. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50170. var i;
  50171. var tag = vnode.tag;
  50172. var data = vnode.data;
  50173. var children = vnode.children;
  50174. inVPre = inVPre || (data && data.pre);
  50175. vnode.elm = elm;
  50176. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50177. vnode.isAsyncPlaceholder = true;
  50178. return true
  50179. }
  50180. // assert node match
  50181. {
  50182. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50183. return false
  50184. }
  50185. }
  50186. if (isDef(data)) {
  50187. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50188. if (isDef(i = vnode.componentInstance)) {
  50189. // child component. it should have hydrated its own tree.
  50190. initComponent(vnode, insertedVnodeQueue);
  50191. return true
  50192. }
  50193. }
  50194. if (isDef(tag)) {
  50195. if (isDef(children)) {
  50196. // empty element, allow client to pick up and populate children
  50197. if (!elm.hasChildNodes()) {
  50198. createChildren(vnode, children, insertedVnodeQueue);
  50199. } else {
  50200. // v-html and domProps: innerHTML
  50201. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50202. if (i !== elm.innerHTML) {
  50203. /* istanbul ignore if */
  50204. if (typeof console !== 'undefined' &&
  50205. !hydrationBailed
  50206. ) {
  50207. hydrationBailed = true;
  50208. console.warn('Parent: ', elm);
  50209. console.warn('server innerHTML: ', i);
  50210. console.warn('client innerHTML: ', elm.innerHTML);
  50211. }
  50212. return false
  50213. }
  50214. } else {
  50215. // iterate and compare children lists
  50216. var childrenMatch = true;
  50217. var childNode = elm.firstChild;
  50218. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50219. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50220. childrenMatch = false;
  50221. break
  50222. }
  50223. childNode = childNode.nextSibling;
  50224. }
  50225. // if childNode is not null, it means the actual childNodes list is
  50226. // longer than the virtual children list.
  50227. if (!childrenMatch || childNode) {
  50228. /* istanbul ignore if */
  50229. if (typeof console !== 'undefined' &&
  50230. !hydrationBailed
  50231. ) {
  50232. hydrationBailed = true;
  50233. console.warn('Parent: ', elm);
  50234. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50235. }
  50236. return false
  50237. }
  50238. }
  50239. }
  50240. }
  50241. if (isDef(data)) {
  50242. var fullInvoke = false;
  50243. for (var key in data) {
  50244. if (!isRenderedModule(key)) {
  50245. fullInvoke = true;
  50246. invokeCreateHooks(vnode, insertedVnodeQueue);
  50247. break
  50248. }
  50249. }
  50250. if (!fullInvoke && data['class']) {
  50251. // ensure collecting deps for deep class bindings for future updates
  50252. traverse(data['class']);
  50253. }
  50254. }
  50255. } else if (elm.data !== vnode.text) {
  50256. elm.data = vnode.text;
  50257. }
  50258. return true
  50259. }
  50260. function assertNodeMatch (node, vnode, inVPre) {
  50261. if (isDef(vnode.tag)) {
  50262. return vnode.tag.indexOf('vue-component') === 0 || (
  50263. !isUnknownElement$$1(vnode, inVPre) &&
  50264. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50265. )
  50266. } else {
  50267. return node.nodeType === (vnode.isComment ? 8 : 3)
  50268. }
  50269. }
  50270. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50271. if (isUndef(vnode)) {
  50272. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50273. return
  50274. }
  50275. var isInitialPatch = false;
  50276. var insertedVnodeQueue = [];
  50277. if (isUndef(oldVnode)) {
  50278. // empty mount (likely as component), create new root element
  50279. isInitialPatch = true;
  50280. createElm(vnode, insertedVnodeQueue);
  50281. } else {
  50282. var isRealElement = isDef(oldVnode.nodeType);
  50283. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50284. // patch existing root node
  50285. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50286. } else {
  50287. if (isRealElement) {
  50288. // mounting to a real element
  50289. // check if this is server-rendered content and if we can perform
  50290. // a successful hydration.
  50291. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50292. oldVnode.removeAttribute(SSR_ATTR);
  50293. hydrating = true;
  50294. }
  50295. if (isTrue(hydrating)) {
  50296. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50297. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50298. return oldVnode
  50299. } else {
  50300. warn(
  50301. 'The client-side rendered virtual DOM tree is not matching ' +
  50302. 'server-rendered content. This is likely caused by incorrect ' +
  50303. 'HTML markup, for example nesting block-level elements inside ' +
  50304. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50305. 'full client-side render.'
  50306. );
  50307. }
  50308. }
  50309. // either not server-rendered, or hydration failed.
  50310. // create an empty node and replace it
  50311. oldVnode = emptyNodeAt(oldVnode);
  50312. }
  50313. // replacing existing element
  50314. var oldElm = oldVnode.elm;
  50315. var parentElm = nodeOps.parentNode(oldElm);
  50316. // create new node
  50317. createElm(
  50318. vnode,
  50319. insertedVnodeQueue,
  50320. // extremely rare edge case: do not insert if old element is in a
  50321. // leaving transition. Only happens when combining transition +
  50322. // keep-alive + HOCs. (#4590)
  50323. oldElm._leaveCb ? null : parentElm,
  50324. nodeOps.nextSibling(oldElm)
  50325. );
  50326. // update parent placeholder node element, recursively
  50327. if (isDef(vnode.parent)) {
  50328. var ancestor = vnode.parent;
  50329. var patchable = isPatchable(vnode);
  50330. while (ancestor) {
  50331. for (var i = 0; i < cbs.destroy.length; ++i) {
  50332. cbs.destroy[i](ancestor);
  50333. }
  50334. ancestor.elm = vnode.elm;
  50335. if (patchable) {
  50336. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50337. cbs.create[i$1](emptyNode, ancestor);
  50338. }
  50339. // #6513
  50340. // invoke insert hooks that may have been merged by create hooks.
  50341. // e.g. for directives that uses the "inserted" hook.
  50342. var insert = ancestor.data.hook.insert;
  50343. if (insert.merged) {
  50344. // start at index 1 to avoid re-invoking component mounted hook
  50345. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50346. insert.fns[i$2]();
  50347. }
  50348. }
  50349. } else {
  50350. registerRef(ancestor);
  50351. }
  50352. ancestor = ancestor.parent;
  50353. }
  50354. }
  50355. // destroy old node
  50356. if (isDef(parentElm)) {
  50357. removeVnodes([oldVnode], 0, 0);
  50358. } else if (isDef(oldVnode.tag)) {
  50359. invokeDestroyHook(oldVnode);
  50360. }
  50361. }
  50362. }
  50363. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50364. return vnode.elm
  50365. }
  50366. }
  50367. /* */
  50368. var directives = {
  50369. create: updateDirectives,
  50370. update: updateDirectives,
  50371. destroy: function unbindDirectives (vnode) {
  50372. updateDirectives(vnode, emptyNode);
  50373. }
  50374. };
  50375. function updateDirectives (oldVnode, vnode) {
  50376. if (oldVnode.data.directives || vnode.data.directives) {
  50377. _update(oldVnode, vnode);
  50378. }
  50379. }
  50380. function _update (oldVnode, vnode) {
  50381. var isCreate = oldVnode === emptyNode;
  50382. var isDestroy = vnode === emptyNode;
  50383. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50384. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50385. var dirsWithInsert = [];
  50386. var dirsWithPostpatch = [];
  50387. var key, oldDir, dir;
  50388. for (key in newDirs) {
  50389. oldDir = oldDirs[key];
  50390. dir = newDirs[key];
  50391. if (!oldDir) {
  50392. // new directive, bind
  50393. callHook$1(dir, 'bind', vnode, oldVnode);
  50394. if (dir.def && dir.def.inserted) {
  50395. dirsWithInsert.push(dir);
  50396. }
  50397. } else {
  50398. // existing directive, update
  50399. dir.oldValue = oldDir.value;
  50400. dir.oldArg = oldDir.arg;
  50401. callHook$1(dir, 'update', vnode, oldVnode);
  50402. if (dir.def && dir.def.componentUpdated) {
  50403. dirsWithPostpatch.push(dir);
  50404. }
  50405. }
  50406. }
  50407. if (dirsWithInsert.length) {
  50408. var callInsert = function () {
  50409. for (var i = 0; i < dirsWithInsert.length; i++) {
  50410. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50411. }
  50412. };
  50413. if (isCreate) {
  50414. mergeVNodeHook(vnode, 'insert', callInsert);
  50415. } else {
  50416. callInsert();
  50417. }
  50418. }
  50419. if (dirsWithPostpatch.length) {
  50420. mergeVNodeHook(vnode, 'postpatch', function () {
  50421. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50422. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50423. }
  50424. });
  50425. }
  50426. if (!isCreate) {
  50427. for (key in oldDirs) {
  50428. if (!newDirs[key]) {
  50429. // no longer present, unbind
  50430. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50431. }
  50432. }
  50433. }
  50434. }
  50435. var emptyModifiers = Object.create(null);
  50436. function normalizeDirectives$1 (
  50437. dirs,
  50438. vm
  50439. ) {
  50440. var res = Object.create(null);
  50441. if (!dirs) {
  50442. // $flow-disable-line
  50443. return res
  50444. }
  50445. var i, dir;
  50446. for (i = 0; i < dirs.length; i++) {
  50447. dir = dirs[i];
  50448. if (!dir.modifiers) {
  50449. // $flow-disable-line
  50450. dir.modifiers = emptyModifiers;
  50451. }
  50452. res[getRawDirName(dir)] = dir;
  50453. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50454. }
  50455. // $flow-disable-line
  50456. return res
  50457. }
  50458. function getRawDirName (dir) {
  50459. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50460. }
  50461. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50462. var fn = dir.def && dir.def[hook];
  50463. if (fn) {
  50464. try {
  50465. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50466. } catch (e) {
  50467. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50468. }
  50469. }
  50470. }
  50471. var baseModules = [
  50472. ref,
  50473. directives
  50474. ];
  50475. /* */
  50476. function updateAttrs (oldVnode, vnode) {
  50477. var opts = vnode.componentOptions;
  50478. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50479. return
  50480. }
  50481. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50482. return
  50483. }
  50484. var key, cur, old;
  50485. var elm = vnode.elm;
  50486. var oldAttrs = oldVnode.data.attrs || {};
  50487. var attrs = vnode.data.attrs || {};
  50488. // clone observed objects, as the user probably wants to mutate it
  50489. if (isDef(attrs.__ob__)) {
  50490. attrs = vnode.data.attrs = extend({}, attrs);
  50491. }
  50492. for (key in attrs) {
  50493. cur = attrs[key];
  50494. old = oldAttrs[key];
  50495. if (old !== cur) {
  50496. setAttr(elm, key, cur);
  50497. }
  50498. }
  50499. // #4391: in IE9, setting type can reset value for input[type=radio]
  50500. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50501. /* istanbul ignore if */
  50502. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50503. setAttr(elm, 'value', attrs.value);
  50504. }
  50505. for (key in oldAttrs) {
  50506. if (isUndef(attrs[key])) {
  50507. if (isXlink(key)) {
  50508. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50509. } else if (!isEnumeratedAttr(key)) {
  50510. elm.removeAttribute(key);
  50511. }
  50512. }
  50513. }
  50514. }
  50515. function setAttr (el, key, value) {
  50516. if (el.tagName.indexOf('-') > -1) {
  50517. baseSetAttr(el, key, value);
  50518. } else if (isBooleanAttr(key)) {
  50519. // set attribute for blank value
  50520. // e.g. <option disabled>Select one</option>
  50521. if (isFalsyAttrValue(value)) {
  50522. el.removeAttribute(key);
  50523. } else {
  50524. // technically allowfullscreen is a boolean attribute for <iframe>,
  50525. // but Flash expects a value of "true" when used on <embed> tag
  50526. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50527. ? 'true'
  50528. : key;
  50529. el.setAttribute(key, value);
  50530. }
  50531. } else if (isEnumeratedAttr(key)) {
  50532. el.setAttribute(key, convertEnumeratedValue(key, value));
  50533. } else if (isXlink(key)) {
  50534. if (isFalsyAttrValue(value)) {
  50535. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50536. } else {
  50537. el.setAttributeNS(xlinkNS, key, value);
  50538. }
  50539. } else {
  50540. baseSetAttr(el, key, value);
  50541. }
  50542. }
  50543. function baseSetAttr (el, key, value) {
  50544. if (isFalsyAttrValue(value)) {
  50545. el.removeAttribute(key);
  50546. } else {
  50547. // #7138: IE10 & 11 fires input event when setting placeholder on
  50548. // <textarea>... block the first input event and remove the blocker
  50549. // immediately.
  50550. /* istanbul ignore if */
  50551. if (
  50552. isIE && !isIE9 &&
  50553. el.tagName === 'TEXTAREA' &&
  50554. key === 'placeholder' && value !== '' && !el.__ieph
  50555. ) {
  50556. var blocker = function (e) {
  50557. e.stopImmediatePropagation();
  50558. el.removeEventListener('input', blocker);
  50559. };
  50560. el.addEventListener('input', blocker);
  50561. // $flow-disable-line
  50562. el.__ieph = true; /* IE placeholder patched */
  50563. }
  50564. el.setAttribute(key, value);
  50565. }
  50566. }
  50567. var attrs = {
  50568. create: updateAttrs,
  50569. update: updateAttrs
  50570. };
  50571. /* */
  50572. function updateClass (oldVnode, vnode) {
  50573. var el = vnode.elm;
  50574. var data = vnode.data;
  50575. var oldData = oldVnode.data;
  50576. if (
  50577. isUndef(data.staticClass) &&
  50578. isUndef(data.class) && (
  50579. isUndef(oldData) || (
  50580. isUndef(oldData.staticClass) &&
  50581. isUndef(oldData.class)
  50582. )
  50583. )
  50584. ) {
  50585. return
  50586. }
  50587. var cls = genClassForVnode(vnode);
  50588. // handle transition classes
  50589. var transitionClass = el._transitionClasses;
  50590. if (isDef(transitionClass)) {
  50591. cls = concat(cls, stringifyClass(transitionClass));
  50592. }
  50593. // set the class
  50594. if (cls !== el._prevClass) {
  50595. el.setAttribute('class', cls);
  50596. el._prevClass = cls;
  50597. }
  50598. }
  50599. var klass = {
  50600. create: updateClass,
  50601. update: updateClass
  50602. };
  50603. /* */
  50604. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50605. function parseFilters (exp) {
  50606. var inSingle = false;
  50607. var inDouble = false;
  50608. var inTemplateString = false;
  50609. var inRegex = false;
  50610. var curly = 0;
  50611. var square = 0;
  50612. var paren = 0;
  50613. var lastFilterIndex = 0;
  50614. var c, prev, i, expression, filters;
  50615. for (i = 0; i < exp.length; i++) {
  50616. prev = c;
  50617. c = exp.charCodeAt(i);
  50618. if (inSingle) {
  50619. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50620. } else if (inDouble) {
  50621. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50622. } else if (inTemplateString) {
  50623. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50624. } else if (inRegex) {
  50625. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50626. } else if (
  50627. c === 0x7C && // pipe
  50628. exp.charCodeAt(i + 1) !== 0x7C &&
  50629. exp.charCodeAt(i - 1) !== 0x7C &&
  50630. !curly && !square && !paren
  50631. ) {
  50632. if (expression === undefined) {
  50633. // first filter, end of expression
  50634. lastFilterIndex = i + 1;
  50635. expression = exp.slice(0, i).trim();
  50636. } else {
  50637. pushFilter();
  50638. }
  50639. } else {
  50640. switch (c) {
  50641. case 0x22: inDouble = true; break // "
  50642. case 0x27: inSingle = true; break // '
  50643. case 0x60: inTemplateString = true; break // `
  50644. case 0x28: paren++; break // (
  50645. case 0x29: paren--; break // )
  50646. case 0x5B: square++; break // [
  50647. case 0x5D: square--; break // ]
  50648. case 0x7B: curly++; break // {
  50649. case 0x7D: curly--; break // }
  50650. }
  50651. if (c === 0x2f) { // /
  50652. var j = i - 1;
  50653. var p = (void 0);
  50654. // find first non-whitespace prev char
  50655. for (; j >= 0; j--) {
  50656. p = exp.charAt(j);
  50657. if (p !== ' ') { break }
  50658. }
  50659. if (!p || !validDivisionCharRE.test(p)) {
  50660. inRegex = true;
  50661. }
  50662. }
  50663. }
  50664. }
  50665. if (expression === undefined) {
  50666. expression = exp.slice(0, i).trim();
  50667. } else if (lastFilterIndex !== 0) {
  50668. pushFilter();
  50669. }
  50670. function pushFilter () {
  50671. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50672. lastFilterIndex = i + 1;
  50673. }
  50674. if (filters) {
  50675. for (i = 0; i < filters.length; i++) {
  50676. expression = wrapFilter(expression, filters[i]);
  50677. }
  50678. }
  50679. return expression
  50680. }
  50681. function wrapFilter (exp, filter) {
  50682. var i = filter.indexOf('(');
  50683. if (i < 0) {
  50684. // _f: resolveFilter
  50685. return ("_f(\"" + filter + "\")(" + exp + ")")
  50686. } else {
  50687. var name = filter.slice(0, i);
  50688. var args = filter.slice(i + 1);
  50689. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50690. }
  50691. }
  50692. /* */
  50693. /* eslint-disable no-unused-vars */
  50694. function baseWarn (msg, range) {
  50695. console.error(("[Vue compiler]: " + msg));
  50696. }
  50697. /* eslint-enable no-unused-vars */
  50698. function pluckModuleFunction (
  50699. modules,
  50700. key
  50701. ) {
  50702. return modules
  50703. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50704. : []
  50705. }
  50706. function addProp (el, name, value, range, dynamic) {
  50707. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50708. el.plain = false;
  50709. }
  50710. function addAttr (el, name, value, range, dynamic) {
  50711. var attrs = dynamic
  50712. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50713. : (el.attrs || (el.attrs = []));
  50714. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50715. el.plain = false;
  50716. }
  50717. // add a raw attr (use this in preTransforms)
  50718. function addRawAttr (el, name, value, range) {
  50719. el.attrsMap[name] = value;
  50720. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50721. }
  50722. function addDirective (
  50723. el,
  50724. name,
  50725. rawName,
  50726. value,
  50727. arg,
  50728. isDynamicArg,
  50729. modifiers,
  50730. range
  50731. ) {
  50732. (el.directives || (el.directives = [])).push(rangeSetItem({
  50733. name: name,
  50734. rawName: rawName,
  50735. value: value,
  50736. arg: arg,
  50737. isDynamicArg: isDynamicArg,
  50738. modifiers: modifiers
  50739. }, range));
  50740. el.plain = false;
  50741. }
  50742. function prependModifierMarker (symbol, name, dynamic) {
  50743. return dynamic
  50744. ? ("_p(" + name + ",\"" + symbol + "\")")
  50745. : symbol + name // mark the event as captured
  50746. }
  50747. function addHandler (
  50748. el,
  50749. name,
  50750. value,
  50751. modifiers,
  50752. important,
  50753. warn,
  50754. range,
  50755. dynamic
  50756. ) {
  50757. modifiers = modifiers || emptyObject;
  50758. // warn prevent and passive modifier
  50759. /* istanbul ignore if */
  50760. if (
  50761. warn &&
  50762. modifiers.prevent && modifiers.passive
  50763. ) {
  50764. warn(
  50765. 'passive and prevent can\'t be used together. ' +
  50766. 'Passive handler can\'t prevent default event.',
  50767. range
  50768. );
  50769. }
  50770. // normalize click.right and click.middle since they don't actually fire
  50771. // this is technically browser-specific, but at least for now browsers are
  50772. // the only target envs that have right/middle clicks.
  50773. if (modifiers.right) {
  50774. if (dynamic) {
  50775. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50776. } else if (name === 'click') {
  50777. name = 'contextmenu';
  50778. delete modifiers.right;
  50779. }
  50780. } else if (modifiers.middle) {
  50781. if (dynamic) {
  50782. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50783. } else if (name === 'click') {
  50784. name = 'mouseup';
  50785. }
  50786. }
  50787. // check capture modifier
  50788. if (modifiers.capture) {
  50789. delete modifiers.capture;
  50790. name = prependModifierMarker('!', name, dynamic);
  50791. }
  50792. if (modifiers.once) {
  50793. delete modifiers.once;
  50794. name = prependModifierMarker('~', name, dynamic);
  50795. }
  50796. /* istanbul ignore if */
  50797. if (modifiers.passive) {
  50798. delete modifiers.passive;
  50799. name = prependModifierMarker('&', name, dynamic);
  50800. }
  50801. var events;
  50802. if (modifiers.native) {
  50803. delete modifiers.native;
  50804. events = el.nativeEvents || (el.nativeEvents = {});
  50805. } else {
  50806. events = el.events || (el.events = {});
  50807. }
  50808. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50809. if (modifiers !== emptyObject) {
  50810. newHandler.modifiers = modifiers;
  50811. }
  50812. var handlers = events[name];
  50813. /* istanbul ignore if */
  50814. if (Array.isArray(handlers)) {
  50815. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50816. } else if (handlers) {
  50817. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50818. } else {
  50819. events[name] = newHandler;
  50820. }
  50821. el.plain = false;
  50822. }
  50823. function getRawBindingAttr (
  50824. el,
  50825. name
  50826. ) {
  50827. return el.rawAttrsMap[':' + name] ||
  50828. el.rawAttrsMap['v-bind:' + name] ||
  50829. el.rawAttrsMap[name]
  50830. }
  50831. function getBindingAttr (
  50832. el,
  50833. name,
  50834. getStatic
  50835. ) {
  50836. var dynamicValue =
  50837. getAndRemoveAttr(el, ':' + name) ||
  50838. getAndRemoveAttr(el, 'v-bind:' + name);
  50839. if (dynamicValue != null) {
  50840. return parseFilters(dynamicValue)
  50841. } else if (getStatic !== false) {
  50842. var staticValue = getAndRemoveAttr(el, name);
  50843. if (staticValue != null) {
  50844. return JSON.stringify(staticValue)
  50845. }
  50846. }
  50847. }
  50848. // note: this only removes the attr from the Array (attrsList) so that it
  50849. // doesn't get processed by processAttrs.
  50850. // By default it does NOT remove it from the map (attrsMap) because the map is
  50851. // needed during codegen.
  50852. function getAndRemoveAttr (
  50853. el,
  50854. name,
  50855. removeFromMap
  50856. ) {
  50857. var val;
  50858. if ((val = el.attrsMap[name]) != null) {
  50859. var list = el.attrsList;
  50860. for (var i = 0, l = list.length; i < l; i++) {
  50861. if (list[i].name === name) {
  50862. list.splice(i, 1);
  50863. break
  50864. }
  50865. }
  50866. }
  50867. if (removeFromMap) {
  50868. delete el.attrsMap[name];
  50869. }
  50870. return val
  50871. }
  50872. function getAndRemoveAttrByRegex (
  50873. el,
  50874. name
  50875. ) {
  50876. var list = el.attrsList;
  50877. for (var i = 0, l = list.length; i < l; i++) {
  50878. var attr = list[i];
  50879. if (name.test(attr.name)) {
  50880. list.splice(i, 1);
  50881. return attr
  50882. }
  50883. }
  50884. }
  50885. function rangeSetItem (
  50886. item,
  50887. range
  50888. ) {
  50889. if (range) {
  50890. if (range.start != null) {
  50891. item.start = range.start;
  50892. }
  50893. if (range.end != null) {
  50894. item.end = range.end;
  50895. }
  50896. }
  50897. return item
  50898. }
  50899. /* */
  50900. /**
  50901. * Cross-platform code generation for component v-model
  50902. */
  50903. function genComponentModel (
  50904. el,
  50905. value,
  50906. modifiers
  50907. ) {
  50908. var ref = modifiers || {};
  50909. var number = ref.number;
  50910. var trim = ref.trim;
  50911. var baseValueExpression = '$$v';
  50912. var valueExpression = baseValueExpression;
  50913. if (trim) {
  50914. valueExpression =
  50915. "(typeof " + baseValueExpression + " === 'string'" +
  50916. "? " + baseValueExpression + ".trim()" +
  50917. ": " + baseValueExpression + ")";
  50918. }
  50919. if (number) {
  50920. valueExpression = "_n(" + valueExpression + ")";
  50921. }
  50922. var assignment = genAssignmentCode(value, valueExpression);
  50923. el.model = {
  50924. value: ("(" + value + ")"),
  50925. expression: JSON.stringify(value),
  50926. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50927. };
  50928. }
  50929. /**
  50930. * Cross-platform codegen helper for generating v-model value assignment code.
  50931. */
  50932. function genAssignmentCode (
  50933. value,
  50934. assignment
  50935. ) {
  50936. var res = parseModel(value);
  50937. if (res.key === null) {
  50938. return (value + "=" + assignment)
  50939. } else {
  50940. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50941. }
  50942. }
  50943. /**
  50944. * Parse a v-model expression into a base path and a final key segment.
  50945. * Handles both dot-path and possible square brackets.
  50946. *
  50947. * Possible cases:
  50948. *
  50949. * - test
  50950. * - test[key]
  50951. * - test[test1[key]]
  50952. * - test["a"][key]
  50953. * - xxx.test[a[a].test1[key]]
  50954. * - test.xxx.a["asa"][test1[key]]
  50955. *
  50956. */
  50957. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50958. function parseModel (val) {
  50959. // Fix https://github.com/vuejs/vue/pull/7730
  50960. // allow v-model="obj.val " (trailing whitespace)
  50961. val = val.trim();
  50962. len = val.length;
  50963. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50964. index$1 = val.lastIndexOf('.');
  50965. if (index$1 > -1) {
  50966. return {
  50967. exp: val.slice(0, index$1),
  50968. key: '"' + val.slice(index$1 + 1) + '"'
  50969. }
  50970. } else {
  50971. return {
  50972. exp: val,
  50973. key: null
  50974. }
  50975. }
  50976. }
  50977. str = val;
  50978. index$1 = expressionPos = expressionEndPos = 0;
  50979. while (!eof()) {
  50980. chr = next();
  50981. /* istanbul ignore if */
  50982. if (isStringStart(chr)) {
  50983. parseString(chr);
  50984. } else if (chr === 0x5B) {
  50985. parseBracket(chr);
  50986. }
  50987. }
  50988. return {
  50989. exp: val.slice(0, expressionPos),
  50990. key: val.slice(expressionPos + 1, expressionEndPos)
  50991. }
  50992. }
  50993. function next () {
  50994. return str.charCodeAt(++index$1)
  50995. }
  50996. function eof () {
  50997. return index$1 >= len
  50998. }
  50999. function isStringStart (chr) {
  51000. return chr === 0x22 || chr === 0x27
  51001. }
  51002. function parseBracket (chr) {
  51003. var inBracket = 1;
  51004. expressionPos = index$1;
  51005. while (!eof()) {
  51006. chr = next();
  51007. if (isStringStart(chr)) {
  51008. parseString(chr);
  51009. continue
  51010. }
  51011. if (chr === 0x5B) { inBracket++; }
  51012. if (chr === 0x5D) { inBracket--; }
  51013. if (inBracket === 0) {
  51014. expressionEndPos = index$1;
  51015. break
  51016. }
  51017. }
  51018. }
  51019. function parseString (chr) {
  51020. var stringQuote = chr;
  51021. while (!eof()) {
  51022. chr = next();
  51023. if (chr === stringQuote) {
  51024. break
  51025. }
  51026. }
  51027. }
  51028. /* */
  51029. var warn$1;
  51030. // in some cases, the event used has to be determined at runtime
  51031. // so we used some reserved tokens during compile.
  51032. var RANGE_TOKEN = '__r';
  51033. var CHECKBOX_RADIO_TOKEN = '__c';
  51034. function model (
  51035. el,
  51036. dir,
  51037. _warn
  51038. ) {
  51039. warn$1 = _warn;
  51040. var value = dir.value;
  51041. var modifiers = dir.modifiers;
  51042. var tag = el.tag;
  51043. var type = el.attrsMap.type;
  51044. {
  51045. // inputs with type="file" are read only and setting the input's
  51046. // value will throw an error.
  51047. if (tag === 'input' && type === 'file') {
  51048. warn$1(
  51049. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51050. "File inputs are read only. Use a v-on:change listener instead.",
  51051. el.rawAttrsMap['v-model']
  51052. );
  51053. }
  51054. }
  51055. if (el.component) {
  51056. genComponentModel(el, value, modifiers);
  51057. // component v-model doesn't need extra runtime
  51058. return false
  51059. } else if (tag === 'select') {
  51060. genSelect(el, value, modifiers);
  51061. } else if (tag === 'input' && type === 'checkbox') {
  51062. genCheckboxModel(el, value, modifiers);
  51063. } else if (tag === 'input' && type === 'radio') {
  51064. genRadioModel(el, value, modifiers);
  51065. } else if (tag === 'input' || tag === 'textarea') {
  51066. genDefaultModel(el, value, modifiers);
  51067. } else if (!config.isReservedTag(tag)) {
  51068. genComponentModel(el, value, modifiers);
  51069. // component v-model doesn't need extra runtime
  51070. return false
  51071. } else {
  51072. warn$1(
  51073. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51074. "v-model is not supported on this element type. " +
  51075. 'If you are working with contenteditable, it\'s recommended to ' +
  51076. 'wrap a library dedicated for that purpose inside a custom component.',
  51077. el.rawAttrsMap['v-model']
  51078. );
  51079. }
  51080. // ensure runtime directive metadata
  51081. return true
  51082. }
  51083. function genCheckboxModel (
  51084. el,
  51085. value,
  51086. modifiers
  51087. ) {
  51088. var number = modifiers && modifiers.number;
  51089. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51090. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51091. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51092. addProp(el, 'checked',
  51093. "Array.isArray(" + value + ")" +
  51094. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51095. trueValueBinding === 'true'
  51096. ? (":(" + value + ")")
  51097. : (":_q(" + value + "," + trueValueBinding + ")")
  51098. )
  51099. );
  51100. addHandler(el, 'change',
  51101. "var $$a=" + value + "," +
  51102. '$$el=$event.target,' +
  51103. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51104. 'if(Array.isArray($$a)){' +
  51105. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51106. '$$i=_i($$a,$$v);' +
  51107. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51108. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51109. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51110. null, true
  51111. );
  51112. }
  51113. function genRadioModel (
  51114. el,
  51115. value,
  51116. modifiers
  51117. ) {
  51118. var number = modifiers && modifiers.number;
  51119. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51120. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51121. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51122. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51123. }
  51124. function genSelect (
  51125. el,
  51126. value,
  51127. modifiers
  51128. ) {
  51129. var number = modifiers && modifiers.number;
  51130. var selectedVal = "Array.prototype.filter" +
  51131. ".call($event.target.options,function(o){return o.selected})" +
  51132. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51133. "return " + (number ? '_n(val)' : 'val') + "})";
  51134. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51135. var code = "var $$selectedVal = " + selectedVal + ";";
  51136. code = code + " " + (genAssignmentCode(value, assignment));
  51137. addHandler(el, 'change', code, null, true);
  51138. }
  51139. function genDefaultModel (
  51140. el,
  51141. value,
  51142. modifiers
  51143. ) {
  51144. var type = el.attrsMap.type;
  51145. // warn if v-bind:value conflicts with v-model
  51146. // except for inputs with v-bind:type
  51147. {
  51148. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51149. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51150. if (value$1 && !typeBinding) {
  51151. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51152. warn$1(
  51153. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51154. 'because the latter already expands to a value binding internally',
  51155. el.rawAttrsMap[binding]
  51156. );
  51157. }
  51158. }
  51159. var ref = modifiers || {};
  51160. var lazy = ref.lazy;
  51161. var number = ref.number;
  51162. var trim = ref.trim;
  51163. var needCompositionGuard = !lazy && type !== 'range';
  51164. var event = lazy
  51165. ? 'change'
  51166. : type === 'range'
  51167. ? RANGE_TOKEN
  51168. : 'input';
  51169. var valueExpression = '$event.target.value';
  51170. if (trim) {
  51171. valueExpression = "$event.target.value.trim()";
  51172. }
  51173. if (number) {
  51174. valueExpression = "_n(" + valueExpression + ")";
  51175. }
  51176. var code = genAssignmentCode(value, valueExpression);
  51177. if (needCompositionGuard) {
  51178. code = "if($event.target.composing)return;" + code;
  51179. }
  51180. addProp(el, 'value', ("(" + value + ")"));
  51181. addHandler(el, event, code, null, true);
  51182. if (trim || number) {
  51183. addHandler(el, 'blur', '$forceUpdate()');
  51184. }
  51185. }
  51186. /* */
  51187. // normalize v-model event tokens that can only be determined at runtime.
  51188. // it's important to place the event as the first in the array because
  51189. // the whole point is ensuring the v-model callback gets called before
  51190. // user-attached handlers.
  51191. function normalizeEvents (on) {
  51192. /* istanbul ignore if */
  51193. if (isDef(on[RANGE_TOKEN])) {
  51194. // IE input[type=range] only supports `change` event
  51195. var event = isIE ? 'change' : 'input';
  51196. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51197. delete on[RANGE_TOKEN];
  51198. }
  51199. // This was originally intended to fix #4521 but no longer necessary
  51200. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51201. /* istanbul ignore if */
  51202. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51203. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51204. delete on[CHECKBOX_RADIO_TOKEN];
  51205. }
  51206. }
  51207. var target$1;
  51208. function createOnceHandler$1 (event, handler, capture) {
  51209. var _target = target$1; // save current target element in closure
  51210. return function onceHandler () {
  51211. var res = handler.apply(null, arguments);
  51212. if (res !== null) {
  51213. remove$2(event, onceHandler, capture, _target);
  51214. }
  51215. }
  51216. }
  51217. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51218. // implementation and does not fire microtasks in between event propagation, so
  51219. // safe to exclude.
  51220. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51221. function add$1 (
  51222. name,
  51223. handler,
  51224. capture,
  51225. passive
  51226. ) {
  51227. // async edge case #6566: inner click event triggers patch, event handler
  51228. // attached to outer element during patch, and triggered again. This
  51229. // happens because browsers fire microtask ticks between event propagation.
  51230. // the solution is simple: we save the timestamp when a handler is attached,
  51231. // and the handler would only fire if the event passed to it was fired
  51232. // AFTER it was attached.
  51233. if (useMicrotaskFix) {
  51234. var attachedTimestamp = currentFlushTimestamp;
  51235. var original = handler;
  51236. handler = original._wrapper = function (e) {
  51237. if (
  51238. // no bubbling, should always fire.
  51239. // this is just a safety net in case event.timeStamp is unreliable in
  51240. // certain weird environments...
  51241. e.target === e.currentTarget ||
  51242. // event is fired after handler attachment
  51243. e.timeStamp >= attachedTimestamp ||
  51244. // bail for environments that have buggy event.timeStamp implementations
  51245. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51246. // #9681 QtWebEngine event.timeStamp is negative value
  51247. e.timeStamp <= 0 ||
  51248. // #9448 bail if event is fired in another document in a multi-page
  51249. // electron/nw.js app, since event.timeStamp will be using a different
  51250. // starting reference
  51251. e.target.ownerDocument !== document
  51252. ) {
  51253. return original.apply(this, arguments)
  51254. }
  51255. };
  51256. }
  51257. target$1.addEventListener(
  51258. name,
  51259. handler,
  51260. supportsPassive
  51261. ? { capture: capture, passive: passive }
  51262. : capture
  51263. );
  51264. }
  51265. function remove$2 (
  51266. name,
  51267. handler,
  51268. capture,
  51269. _target
  51270. ) {
  51271. (_target || target$1).removeEventListener(
  51272. name,
  51273. handler._wrapper || handler,
  51274. capture
  51275. );
  51276. }
  51277. function updateDOMListeners (oldVnode, vnode) {
  51278. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51279. return
  51280. }
  51281. var on = vnode.data.on || {};
  51282. var oldOn = oldVnode.data.on || {};
  51283. target$1 = vnode.elm;
  51284. normalizeEvents(on);
  51285. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51286. target$1 = undefined;
  51287. }
  51288. var events = {
  51289. create: updateDOMListeners,
  51290. update: updateDOMListeners
  51291. };
  51292. /* */
  51293. var svgContainer;
  51294. function updateDOMProps (oldVnode, vnode) {
  51295. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51296. return
  51297. }
  51298. var key, cur;
  51299. var elm = vnode.elm;
  51300. var oldProps = oldVnode.data.domProps || {};
  51301. var props = vnode.data.domProps || {};
  51302. // clone observed objects, as the user probably wants to mutate it
  51303. if (isDef(props.__ob__)) {
  51304. props = vnode.data.domProps = extend({}, props);
  51305. }
  51306. for (key in oldProps) {
  51307. if (!(key in props)) {
  51308. elm[key] = '';
  51309. }
  51310. }
  51311. for (key in props) {
  51312. cur = props[key];
  51313. // ignore children if the node has textContent or innerHTML,
  51314. // as these will throw away existing DOM nodes and cause removal errors
  51315. // on subsequent patches (#3360)
  51316. if (key === 'textContent' || key === 'innerHTML') {
  51317. if (vnode.children) { vnode.children.length = 0; }
  51318. if (cur === oldProps[key]) { continue }
  51319. // #6601 work around Chrome version <= 55 bug where single textNode
  51320. // replaced by innerHTML/textContent retains its parentNode property
  51321. if (elm.childNodes.length === 1) {
  51322. elm.removeChild(elm.childNodes[0]);
  51323. }
  51324. }
  51325. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51326. // store value as _value as well since
  51327. // non-string values will be stringified
  51328. elm._value = cur;
  51329. // avoid resetting cursor position when value is the same
  51330. var strCur = isUndef(cur) ? '' : String(cur);
  51331. if (shouldUpdateValue(elm, strCur)) {
  51332. elm.value = strCur;
  51333. }
  51334. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51335. // IE doesn't support innerHTML for SVG elements
  51336. svgContainer = svgContainer || document.createElement('div');
  51337. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51338. var svg = svgContainer.firstChild;
  51339. while (elm.firstChild) {
  51340. elm.removeChild(elm.firstChild);
  51341. }
  51342. while (svg.firstChild) {
  51343. elm.appendChild(svg.firstChild);
  51344. }
  51345. } else if (
  51346. // skip the update if old and new VDOM state is the same.
  51347. // `value` is handled separately because the DOM value may be temporarily
  51348. // out of sync with VDOM state due to focus, composition and modifiers.
  51349. // This #4521 by skipping the unnecesarry `checked` update.
  51350. cur !== oldProps[key]
  51351. ) {
  51352. // some property updates can throw
  51353. // e.g. `value` on <progress> w/ non-finite value
  51354. try {
  51355. elm[key] = cur;
  51356. } catch (e) {}
  51357. }
  51358. }
  51359. }
  51360. // check platforms/web/util/attrs.js acceptValue
  51361. function shouldUpdateValue (elm, checkVal) {
  51362. return (!elm.composing && (
  51363. elm.tagName === 'OPTION' ||
  51364. isNotInFocusAndDirty(elm, checkVal) ||
  51365. isDirtyWithModifiers(elm, checkVal)
  51366. ))
  51367. }
  51368. function isNotInFocusAndDirty (elm, checkVal) {
  51369. // return true when textbox (.number and .trim) loses focus and its value is
  51370. // not equal to the updated value
  51371. var notInFocus = true;
  51372. // #6157
  51373. // work around IE bug when accessing document.activeElement in an iframe
  51374. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51375. return notInFocus && elm.value !== checkVal
  51376. }
  51377. function isDirtyWithModifiers (elm, newVal) {
  51378. var value = elm.value;
  51379. var modifiers = elm._vModifiers; // injected by v-model runtime
  51380. if (isDef(modifiers)) {
  51381. if (modifiers.number) {
  51382. return toNumber(value) !== toNumber(newVal)
  51383. }
  51384. if (modifiers.trim) {
  51385. return value.trim() !== newVal.trim()
  51386. }
  51387. }
  51388. return value !== newVal
  51389. }
  51390. var domProps = {
  51391. create: updateDOMProps,
  51392. update: updateDOMProps
  51393. };
  51394. /* */
  51395. var parseStyleText = cached(function (cssText) {
  51396. var res = {};
  51397. var listDelimiter = /;(?![^(]*\))/g;
  51398. var propertyDelimiter = /:(.+)/;
  51399. cssText.split(listDelimiter).forEach(function (item) {
  51400. if (item) {
  51401. var tmp = item.split(propertyDelimiter);
  51402. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51403. }
  51404. });
  51405. return res
  51406. });
  51407. // merge static and dynamic style data on the same vnode
  51408. function normalizeStyleData (data) {
  51409. var style = normalizeStyleBinding(data.style);
  51410. // static style is pre-processed into an object during compilation
  51411. // and is always a fresh object, so it's safe to merge into it
  51412. return data.staticStyle
  51413. ? extend(data.staticStyle, style)
  51414. : style
  51415. }
  51416. // normalize possible array / string values into Object
  51417. function normalizeStyleBinding (bindingStyle) {
  51418. if (Array.isArray(bindingStyle)) {
  51419. return toObject(bindingStyle)
  51420. }
  51421. if (typeof bindingStyle === 'string') {
  51422. return parseStyleText(bindingStyle)
  51423. }
  51424. return bindingStyle
  51425. }
  51426. /**
  51427. * parent component style should be after child's
  51428. * so that parent component's style could override it
  51429. */
  51430. function getStyle (vnode, checkChild) {
  51431. var res = {};
  51432. var styleData;
  51433. if (checkChild) {
  51434. var childNode = vnode;
  51435. while (childNode.componentInstance) {
  51436. childNode = childNode.componentInstance._vnode;
  51437. if (
  51438. childNode && childNode.data &&
  51439. (styleData = normalizeStyleData(childNode.data))
  51440. ) {
  51441. extend(res, styleData);
  51442. }
  51443. }
  51444. }
  51445. if ((styleData = normalizeStyleData(vnode.data))) {
  51446. extend(res, styleData);
  51447. }
  51448. var parentNode = vnode;
  51449. while ((parentNode = parentNode.parent)) {
  51450. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51451. extend(res, styleData);
  51452. }
  51453. }
  51454. return res
  51455. }
  51456. /* */
  51457. var cssVarRE = /^--/;
  51458. var importantRE = /\s*!important$/;
  51459. var setProp = function (el, name, val) {
  51460. /* istanbul ignore if */
  51461. if (cssVarRE.test(name)) {
  51462. el.style.setProperty(name, val);
  51463. } else if (importantRE.test(val)) {
  51464. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51465. } else {
  51466. var normalizedName = normalize(name);
  51467. if (Array.isArray(val)) {
  51468. // Support values array created by autoprefixer, e.g.
  51469. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51470. // Set them one by one, and the browser will only set those it can recognize
  51471. for (var i = 0, len = val.length; i < len; i++) {
  51472. el.style[normalizedName] = val[i];
  51473. }
  51474. } else {
  51475. el.style[normalizedName] = val;
  51476. }
  51477. }
  51478. };
  51479. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51480. var emptyStyle;
  51481. var normalize = cached(function (prop) {
  51482. emptyStyle = emptyStyle || document.createElement('div').style;
  51483. prop = camelize(prop);
  51484. if (prop !== 'filter' && (prop in emptyStyle)) {
  51485. return prop
  51486. }
  51487. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51488. for (var i = 0; i < vendorNames.length; i++) {
  51489. var name = vendorNames[i] + capName;
  51490. if (name in emptyStyle) {
  51491. return name
  51492. }
  51493. }
  51494. });
  51495. function updateStyle (oldVnode, vnode) {
  51496. var data = vnode.data;
  51497. var oldData = oldVnode.data;
  51498. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51499. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51500. ) {
  51501. return
  51502. }
  51503. var cur, name;
  51504. var el = vnode.elm;
  51505. var oldStaticStyle = oldData.staticStyle;
  51506. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51507. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51508. var oldStyle = oldStaticStyle || oldStyleBinding;
  51509. var style = normalizeStyleBinding(vnode.data.style) || {};
  51510. // store normalized style under a different key for next diff
  51511. // make sure to clone it if it's reactive, since the user likely wants
  51512. // to mutate it.
  51513. vnode.data.normalizedStyle = isDef(style.__ob__)
  51514. ? extend({}, style)
  51515. : style;
  51516. var newStyle = getStyle(vnode, true);
  51517. for (name in oldStyle) {
  51518. if (isUndef(newStyle[name])) {
  51519. setProp(el, name, '');
  51520. }
  51521. }
  51522. for (name in newStyle) {
  51523. cur = newStyle[name];
  51524. if (cur !== oldStyle[name]) {
  51525. // ie9 setting to null has no effect, must use empty string
  51526. setProp(el, name, cur == null ? '' : cur);
  51527. }
  51528. }
  51529. }
  51530. var style = {
  51531. create: updateStyle,
  51532. update: updateStyle
  51533. };
  51534. /* */
  51535. var whitespaceRE = /\s+/;
  51536. /**
  51537. * Add class with compatibility for SVG since classList is not supported on
  51538. * SVG elements in IE
  51539. */
  51540. function addClass (el, cls) {
  51541. /* istanbul ignore if */
  51542. if (!cls || !(cls = cls.trim())) {
  51543. return
  51544. }
  51545. /* istanbul ignore else */
  51546. if (el.classList) {
  51547. if (cls.indexOf(' ') > -1) {
  51548. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51549. } else {
  51550. el.classList.add(cls);
  51551. }
  51552. } else {
  51553. var cur = " " + (el.getAttribute('class') || '') + " ";
  51554. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51555. el.setAttribute('class', (cur + cls).trim());
  51556. }
  51557. }
  51558. }
  51559. /**
  51560. * Remove class with compatibility for SVG since classList is not supported on
  51561. * SVG elements in IE
  51562. */
  51563. function removeClass (el, cls) {
  51564. /* istanbul ignore if */
  51565. if (!cls || !(cls = cls.trim())) {
  51566. return
  51567. }
  51568. /* istanbul ignore else */
  51569. if (el.classList) {
  51570. if (cls.indexOf(' ') > -1) {
  51571. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51572. } else {
  51573. el.classList.remove(cls);
  51574. }
  51575. if (!el.classList.length) {
  51576. el.removeAttribute('class');
  51577. }
  51578. } else {
  51579. var cur = " " + (el.getAttribute('class') || '') + " ";
  51580. var tar = ' ' + cls + ' ';
  51581. while (cur.indexOf(tar) >= 0) {
  51582. cur = cur.replace(tar, ' ');
  51583. }
  51584. cur = cur.trim();
  51585. if (cur) {
  51586. el.setAttribute('class', cur);
  51587. } else {
  51588. el.removeAttribute('class');
  51589. }
  51590. }
  51591. }
  51592. /* */
  51593. function resolveTransition (def$$1) {
  51594. if (!def$$1) {
  51595. return
  51596. }
  51597. /* istanbul ignore else */
  51598. if (typeof def$$1 === 'object') {
  51599. var res = {};
  51600. if (def$$1.css !== false) {
  51601. extend(res, autoCssTransition(def$$1.name || 'v'));
  51602. }
  51603. extend(res, def$$1);
  51604. return res
  51605. } else if (typeof def$$1 === 'string') {
  51606. return autoCssTransition(def$$1)
  51607. }
  51608. }
  51609. var autoCssTransition = cached(function (name) {
  51610. return {
  51611. enterClass: (name + "-enter"),
  51612. enterToClass: (name + "-enter-to"),
  51613. enterActiveClass: (name + "-enter-active"),
  51614. leaveClass: (name + "-leave"),
  51615. leaveToClass: (name + "-leave-to"),
  51616. leaveActiveClass: (name + "-leave-active")
  51617. }
  51618. });
  51619. var hasTransition = inBrowser && !isIE9;
  51620. var TRANSITION = 'transition';
  51621. var ANIMATION = 'animation';
  51622. // Transition property/event sniffing
  51623. var transitionProp = 'transition';
  51624. var transitionEndEvent = 'transitionend';
  51625. var animationProp = 'animation';
  51626. var animationEndEvent = 'animationend';
  51627. if (hasTransition) {
  51628. /* istanbul ignore if */
  51629. if (window.ontransitionend === undefined &&
  51630. window.onwebkittransitionend !== undefined
  51631. ) {
  51632. transitionProp = 'WebkitTransition';
  51633. transitionEndEvent = 'webkitTransitionEnd';
  51634. }
  51635. if (window.onanimationend === undefined &&
  51636. window.onwebkitanimationend !== undefined
  51637. ) {
  51638. animationProp = 'WebkitAnimation';
  51639. animationEndEvent = 'webkitAnimationEnd';
  51640. }
  51641. }
  51642. // binding to window is necessary to make hot reload work in IE in strict mode
  51643. var raf = inBrowser
  51644. ? window.requestAnimationFrame
  51645. ? window.requestAnimationFrame.bind(window)
  51646. : setTimeout
  51647. : /* istanbul ignore next */ function (fn) { return fn(); };
  51648. function nextFrame (fn) {
  51649. raf(function () {
  51650. raf(fn);
  51651. });
  51652. }
  51653. function addTransitionClass (el, cls) {
  51654. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51655. if (transitionClasses.indexOf(cls) < 0) {
  51656. transitionClasses.push(cls);
  51657. addClass(el, cls);
  51658. }
  51659. }
  51660. function removeTransitionClass (el, cls) {
  51661. if (el._transitionClasses) {
  51662. remove(el._transitionClasses, cls);
  51663. }
  51664. removeClass(el, cls);
  51665. }
  51666. function whenTransitionEnds (
  51667. el,
  51668. expectedType,
  51669. cb
  51670. ) {
  51671. var ref = getTransitionInfo(el, expectedType);
  51672. var type = ref.type;
  51673. var timeout = ref.timeout;
  51674. var propCount = ref.propCount;
  51675. if (!type) { return cb() }
  51676. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51677. var ended = 0;
  51678. var end = function () {
  51679. el.removeEventListener(event, onEnd);
  51680. cb();
  51681. };
  51682. var onEnd = function (e) {
  51683. if (e.target === el) {
  51684. if (++ended >= propCount) {
  51685. end();
  51686. }
  51687. }
  51688. };
  51689. setTimeout(function () {
  51690. if (ended < propCount) {
  51691. end();
  51692. }
  51693. }, timeout + 1);
  51694. el.addEventListener(event, onEnd);
  51695. }
  51696. var transformRE = /\b(transform|all)(,|$)/;
  51697. function getTransitionInfo (el, expectedType) {
  51698. var styles = window.getComputedStyle(el);
  51699. // JSDOM may return undefined for transition properties
  51700. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51701. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51702. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51703. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51704. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51705. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51706. var type;
  51707. var timeout = 0;
  51708. var propCount = 0;
  51709. /* istanbul ignore if */
  51710. if (expectedType === TRANSITION) {
  51711. if (transitionTimeout > 0) {
  51712. type = TRANSITION;
  51713. timeout = transitionTimeout;
  51714. propCount = transitionDurations.length;
  51715. }
  51716. } else if (expectedType === ANIMATION) {
  51717. if (animationTimeout > 0) {
  51718. type = ANIMATION;
  51719. timeout = animationTimeout;
  51720. propCount = animationDurations.length;
  51721. }
  51722. } else {
  51723. timeout = Math.max(transitionTimeout, animationTimeout);
  51724. type = timeout > 0
  51725. ? transitionTimeout > animationTimeout
  51726. ? TRANSITION
  51727. : ANIMATION
  51728. : null;
  51729. propCount = type
  51730. ? type === TRANSITION
  51731. ? transitionDurations.length
  51732. : animationDurations.length
  51733. : 0;
  51734. }
  51735. var hasTransform =
  51736. type === TRANSITION &&
  51737. transformRE.test(styles[transitionProp + 'Property']);
  51738. return {
  51739. type: type,
  51740. timeout: timeout,
  51741. propCount: propCount,
  51742. hasTransform: hasTransform
  51743. }
  51744. }
  51745. function getTimeout (delays, durations) {
  51746. /* istanbul ignore next */
  51747. while (delays.length < durations.length) {
  51748. delays = delays.concat(delays);
  51749. }
  51750. return Math.max.apply(null, durations.map(function (d, i) {
  51751. return toMs(d) + toMs(delays[i])
  51752. }))
  51753. }
  51754. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51755. // in a locale-dependent way, using a comma instead of a dot.
  51756. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51757. // as a floor function) causing unexpected behaviors
  51758. function toMs (s) {
  51759. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51760. }
  51761. /* */
  51762. function enter (vnode, toggleDisplay) {
  51763. var el = vnode.elm;
  51764. // call leave callback now
  51765. if (isDef(el._leaveCb)) {
  51766. el._leaveCb.cancelled = true;
  51767. el._leaveCb();
  51768. }
  51769. var data = resolveTransition(vnode.data.transition);
  51770. if (isUndef(data)) {
  51771. return
  51772. }
  51773. /* istanbul ignore if */
  51774. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51775. return
  51776. }
  51777. var css = data.css;
  51778. var type = data.type;
  51779. var enterClass = data.enterClass;
  51780. var enterToClass = data.enterToClass;
  51781. var enterActiveClass = data.enterActiveClass;
  51782. var appearClass = data.appearClass;
  51783. var appearToClass = data.appearToClass;
  51784. var appearActiveClass = data.appearActiveClass;
  51785. var beforeEnter = data.beforeEnter;
  51786. var enter = data.enter;
  51787. var afterEnter = data.afterEnter;
  51788. var enterCancelled = data.enterCancelled;
  51789. var beforeAppear = data.beforeAppear;
  51790. var appear = data.appear;
  51791. var afterAppear = data.afterAppear;
  51792. var appearCancelled = data.appearCancelled;
  51793. var duration = data.duration;
  51794. // activeInstance will always be the <transition> component managing this
  51795. // transition. One edge case to check is when the <transition> is placed
  51796. // as the root node of a child component. In that case we need to check
  51797. // <transition>'s parent for appear check.
  51798. var context = activeInstance;
  51799. var transitionNode = activeInstance.$vnode;
  51800. while (transitionNode && transitionNode.parent) {
  51801. context = transitionNode.context;
  51802. transitionNode = transitionNode.parent;
  51803. }
  51804. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51805. if (isAppear && !appear && appear !== '') {
  51806. return
  51807. }
  51808. var startClass = isAppear && appearClass
  51809. ? appearClass
  51810. : enterClass;
  51811. var activeClass = isAppear && appearActiveClass
  51812. ? appearActiveClass
  51813. : enterActiveClass;
  51814. var toClass = isAppear && appearToClass
  51815. ? appearToClass
  51816. : enterToClass;
  51817. var beforeEnterHook = isAppear
  51818. ? (beforeAppear || beforeEnter)
  51819. : beforeEnter;
  51820. var enterHook = isAppear
  51821. ? (typeof appear === 'function' ? appear : enter)
  51822. : enter;
  51823. var afterEnterHook = isAppear
  51824. ? (afterAppear || afterEnter)
  51825. : afterEnter;
  51826. var enterCancelledHook = isAppear
  51827. ? (appearCancelled || enterCancelled)
  51828. : enterCancelled;
  51829. var explicitEnterDuration = toNumber(
  51830. isObject(duration)
  51831. ? duration.enter
  51832. : duration
  51833. );
  51834. if (explicitEnterDuration != null) {
  51835. checkDuration(explicitEnterDuration, 'enter', vnode);
  51836. }
  51837. var expectsCSS = css !== false && !isIE9;
  51838. var userWantsControl = getHookArgumentsLength(enterHook);
  51839. var cb = el._enterCb = once(function () {
  51840. if (expectsCSS) {
  51841. removeTransitionClass(el, toClass);
  51842. removeTransitionClass(el, activeClass);
  51843. }
  51844. if (cb.cancelled) {
  51845. if (expectsCSS) {
  51846. removeTransitionClass(el, startClass);
  51847. }
  51848. enterCancelledHook && enterCancelledHook(el);
  51849. } else {
  51850. afterEnterHook && afterEnterHook(el);
  51851. }
  51852. el._enterCb = null;
  51853. });
  51854. if (!vnode.data.show) {
  51855. // remove pending leave element on enter by injecting an insert hook
  51856. mergeVNodeHook(vnode, 'insert', function () {
  51857. var parent = el.parentNode;
  51858. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51859. if (pendingNode &&
  51860. pendingNode.tag === vnode.tag &&
  51861. pendingNode.elm._leaveCb
  51862. ) {
  51863. pendingNode.elm._leaveCb();
  51864. }
  51865. enterHook && enterHook(el, cb);
  51866. });
  51867. }
  51868. // start enter transition
  51869. beforeEnterHook && beforeEnterHook(el);
  51870. if (expectsCSS) {
  51871. addTransitionClass(el, startClass);
  51872. addTransitionClass(el, activeClass);
  51873. nextFrame(function () {
  51874. removeTransitionClass(el, startClass);
  51875. if (!cb.cancelled) {
  51876. addTransitionClass(el, toClass);
  51877. if (!userWantsControl) {
  51878. if (isValidDuration(explicitEnterDuration)) {
  51879. setTimeout(cb, explicitEnterDuration);
  51880. } else {
  51881. whenTransitionEnds(el, type, cb);
  51882. }
  51883. }
  51884. }
  51885. });
  51886. }
  51887. if (vnode.data.show) {
  51888. toggleDisplay && toggleDisplay();
  51889. enterHook && enterHook(el, cb);
  51890. }
  51891. if (!expectsCSS && !userWantsControl) {
  51892. cb();
  51893. }
  51894. }
  51895. function leave (vnode, rm) {
  51896. var el = vnode.elm;
  51897. // call enter callback now
  51898. if (isDef(el._enterCb)) {
  51899. el._enterCb.cancelled = true;
  51900. el._enterCb();
  51901. }
  51902. var data = resolveTransition(vnode.data.transition);
  51903. if (isUndef(data) || el.nodeType !== 1) {
  51904. return rm()
  51905. }
  51906. /* istanbul ignore if */
  51907. if (isDef(el._leaveCb)) {
  51908. return
  51909. }
  51910. var css = data.css;
  51911. var type = data.type;
  51912. var leaveClass = data.leaveClass;
  51913. var leaveToClass = data.leaveToClass;
  51914. var leaveActiveClass = data.leaveActiveClass;
  51915. var beforeLeave = data.beforeLeave;
  51916. var leave = data.leave;
  51917. var afterLeave = data.afterLeave;
  51918. var leaveCancelled = data.leaveCancelled;
  51919. var delayLeave = data.delayLeave;
  51920. var duration = data.duration;
  51921. var expectsCSS = css !== false && !isIE9;
  51922. var userWantsControl = getHookArgumentsLength(leave);
  51923. var explicitLeaveDuration = toNumber(
  51924. isObject(duration)
  51925. ? duration.leave
  51926. : duration
  51927. );
  51928. if (isDef(explicitLeaveDuration)) {
  51929. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51930. }
  51931. var cb = el._leaveCb = once(function () {
  51932. if (el.parentNode && el.parentNode._pending) {
  51933. el.parentNode._pending[vnode.key] = null;
  51934. }
  51935. if (expectsCSS) {
  51936. removeTransitionClass(el, leaveToClass);
  51937. removeTransitionClass(el, leaveActiveClass);
  51938. }
  51939. if (cb.cancelled) {
  51940. if (expectsCSS) {
  51941. removeTransitionClass(el, leaveClass);
  51942. }
  51943. leaveCancelled && leaveCancelled(el);
  51944. } else {
  51945. rm();
  51946. afterLeave && afterLeave(el);
  51947. }
  51948. el._leaveCb = null;
  51949. });
  51950. if (delayLeave) {
  51951. delayLeave(performLeave);
  51952. } else {
  51953. performLeave();
  51954. }
  51955. function performLeave () {
  51956. // the delayed leave may have already been cancelled
  51957. if (cb.cancelled) {
  51958. return
  51959. }
  51960. // record leaving element
  51961. if (!vnode.data.show && el.parentNode) {
  51962. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51963. }
  51964. beforeLeave && beforeLeave(el);
  51965. if (expectsCSS) {
  51966. addTransitionClass(el, leaveClass);
  51967. addTransitionClass(el, leaveActiveClass);
  51968. nextFrame(function () {
  51969. removeTransitionClass(el, leaveClass);
  51970. if (!cb.cancelled) {
  51971. addTransitionClass(el, leaveToClass);
  51972. if (!userWantsControl) {
  51973. if (isValidDuration(explicitLeaveDuration)) {
  51974. setTimeout(cb, explicitLeaveDuration);
  51975. } else {
  51976. whenTransitionEnds(el, type, cb);
  51977. }
  51978. }
  51979. }
  51980. });
  51981. }
  51982. leave && leave(el, cb);
  51983. if (!expectsCSS && !userWantsControl) {
  51984. cb();
  51985. }
  51986. }
  51987. }
  51988. // only used in dev mode
  51989. function checkDuration (val, name, vnode) {
  51990. if (typeof val !== 'number') {
  51991. warn(
  51992. "<transition> explicit " + name + " duration is not a valid number - " +
  51993. "got " + (JSON.stringify(val)) + ".",
  51994. vnode.context
  51995. );
  51996. } else if (isNaN(val)) {
  51997. warn(
  51998. "<transition> explicit " + name + " duration is NaN - " +
  51999. 'the duration expression might be incorrect.',
  52000. vnode.context
  52001. );
  52002. }
  52003. }
  52004. function isValidDuration (val) {
  52005. return typeof val === 'number' && !isNaN(val)
  52006. }
  52007. /**
  52008. * Normalize a transition hook's argument length. The hook may be:
  52009. * - a merged hook (invoker) with the original in .fns
  52010. * - a wrapped component method (check ._length)
  52011. * - a plain function (.length)
  52012. */
  52013. function getHookArgumentsLength (fn) {
  52014. if (isUndef(fn)) {
  52015. return false
  52016. }
  52017. var invokerFns = fn.fns;
  52018. if (isDef(invokerFns)) {
  52019. // invoker
  52020. return getHookArgumentsLength(
  52021. Array.isArray(invokerFns)
  52022. ? invokerFns[0]
  52023. : invokerFns
  52024. )
  52025. } else {
  52026. return (fn._length || fn.length) > 1
  52027. }
  52028. }
  52029. function _enter (_, vnode) {
  52030. if (vnode.data.show !== true) {
  52031. enter(vnode);
  52032. }
  52033. }
  52034. var transition = inBrowser ? {
  52035. create: _enter,
  52036. activate: _enter,
  52037. remove: function remove$$1 (vnode, rm) {
  52038. /* istanbul ignore else */
  52039. if (vnode.data.show !== true) {
  52040. leave(vnode, rm);
  52041. } else {
  52042. rm();
  52043. }
  52044. }
  52045. } : {};
  52046. var platformModules = [
  52047. attrs,
  52048. klass,
  52049. events,
  52050. domProps,
  52051. style,
  52052. transition
  52053. ];
  52054. /* */
  52055. // the directive module should be applied last, after all
  52056. // built-in modules have been applied.
  52057. var modules = platformModules.concat(baseModules);
  52058. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52059. /**
  52060. * Not type checking this file because flow doesn't like attaching
  52061. * properties to Elements.
  52062. */
  52063. /* istanbul ignore if */
  52064. if (isIE9) {
  52065. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52066. document.addEventListener('selectionchange', function () {
  52067. var el = document.activeElement;
  52068. if (el && el.vmodel) {
  52069. trigger(el, 'input');
  52070. }
  52071. });
  52072. }
  52073. var directive = {
  52074. inserted: function inserted (el, binding, vnode, oldVnode) {
  52075. if (vnode.tag === 'select') {
  52076. // #6903
  52077. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52078. mergeVNodeHook(vnode, 'postpatch', function () {
  52079. directive.componentUpdated(el, binding, vnode);
  52080. });
  52081. } else {
  52082. setSelected(el, binding, vnode.context);
  52083. }
  52084. el._vOptions = [].map.call(el.options, getValue);
  52085. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52086. el._vModifiers = binding.modifiers;
  52087. if (!binding.modifiers.lazy) {
  52088. el.addEventListener('compositionstart', onCompositionStart);
  52089. el.addEventListener('compositionend', onCompositionEnd);
  52090. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52091. // switching focus before confirming composition choice
  52092. // this also fixes the issue where some browsers e.g. iOS Chrome
  52093. // fires "change" instead of "input" on autocomplete.
  52094. el.addEventListener('change', onCompositionEnd);
  52095. /* istanbul ignore if */
  52096. if (isIE9) {
  52097. el.vmodel = true;
  52098. }
  52099. }
  52100. }
  52101. },
  52102. componentUpdated: function componentUpdated (el, binding, vnode) {
  52103. if (vnode.tag === 'select') {
  52104. setSelected(el, binding, vnode.context);
  52105. // in case the options rendered by v-for have changed,
  52106. // it's possible that the value is out-of-sync with the rendered options.
  52107. // detect such cases and filter out values that no longer has a matching
  52108. // option in the DOM.
  52109. var prevOptions = el._vOptions;
  52110. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52111. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52112. // trigger change event if
  52113. // no matching option found for at least one value
  52114. var needReset = el.multiple
  52115. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52116. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52117. if (needReset) {
  52118. trigger(el, 'change');
  52119. }
  52120. }
  52121. }
  52122. }
  52123. };
  52124. function setSelected (el, binding, vm) {
  52125. actuallySetSelected(el, binding, vm);
  52126. /* istanbul ignore if */
  52127. if (isIE || isEdge) {
  52128. setTimeout(function () {
  52129. actuallySetSelected(el, binding, vm);
  52130. }, 0);
  52131. }
  52132. }
  52133. function actuallySetSelected (el, binding, vm) {
  52134. var value = binding.value;
  52135. var isMultiple = el.multiple;
  52136. if (isMultiple && !Array.isArray(value)) {
  52137. warn(
  52138. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52139. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52140. vm
  52141. );
  52142. return
  52143. }
  52144. var selected, option;
  52145. for (var i = 0, l = el.options.length; i < l; i++) {
  52146. option = el.options[i];
  52147. if (isMultiple) {
  52148. selected = looseIndexOf(value, getValue(option)) > -1;
  52149. if (option.selected !== selected) {
  52150. option.selected = selected;
  52151. }
  52152. } else {
  52153. if (looseEqual(getValue(option), value)) {
  52154. if (el.selectedIndex !== i) {
  52155. el.selectedIndex = i;
  52156. }
  52157. return
  52158. }
  52159. }
  52160. }
  52161. if (!isMultiple) {
  52162. el.selectedIndex = -1;
  52163. }
  52164. }
  52165. function hasNoMatchingOption (value, options) {
  52166. return options.every(function (o) { return !looseEqual(o, value); })
  52167. }
  52168. function getValue (option) {
  52169. return '_value' in option
  52170. ? option._value
  52171. : option.value
  52172. }
  52173. function onCompositionStart (e) {
  52174. e.target.composing = true;
  52175. }
  52176. function onCompositionEnd (e) {
  52177. // prevent triggering an input event for no reason
  52178. if (!e.target.composing) { return }
  52179. e.target.composing = false;
  52180. trigger(e.target, 'input');
  52181. }
  52182. function trigger (el, type) {
  52183. var e = document.createEvent('HTMLEvents');
  52184. e.initEvent(type, true, true);
  52185. el.dispatchEvent(e);
  52186. }
  52187. /* */
  52188. // recursively search for possible transition defined inside the component root
  52189. function locateNode (vnode) {
  52190. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52191. ? locateNode(vnode.componentInstance._vnode)
  52192. : vnode
  52193. }
  52194. var show = {
  52195. bind: function bind (el, ref, vnode) {
  52196. var value = ref.value;
  52197. vnode = locateNode(vnode);
  52198. var transition$$1 = vnode.data && vnode.data.transition;
  52199. var originalDisplay = el.__vOriginalDisplay =
  52200. el.style.display === 'none' ? '' : el.style.display;
  52201. if (value && transition$$1) {
  52202. vnode.data.show = true;
  52203. enter(vnode, function () {
  52204. el.style.display = originalDisplay;
  52205. });
  52206. } else {
  52207. el.style.display = value ? originalDisplay : 'none';
  52208. }
  52209. },
  52210. update: function update (el, ref, vnode) {
  52211. var value = ref.value;
  52212. var oldValue = ref.oldValue;
  52213. /* istanbul ignore if */
  52214. if (!value === !oldValue) { return }
  52215. vnode = locateNode(vnode);
  52216. var transition$$1 = vnode.data && vnode.data.transition;
  52217. if (transition$$1) {
  52218. vnode.data.show = true;
  52219. if (value) {
  52220. enter(vnode, function () {
  52221. el.style.display = el.__vOriginalDisplay;
  52222. });
  52223. } else {
  52224. leave(vnode, function () {
  52225. el.style.display = 'none';
  52226. });
  52227. }
  52228. } else {
  52229. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52230. }
  52231. },
  52232. unbind: function unbind (
  52233. el,
  52234. binding,
  52235. vnode,
  52236. oldVnode,
  52237. isDestroy
  52238. ) {
  52239. if (!isDestroy) {
  52240. el.style.display = el.__vOriginalDisplay;
  52241. }
  52242. }
  52243. };
  52244. var platformDirectives = {
  52245. model: directive,
  52246. show: show
  52247. };
  52248. /* */
  52249. var transitionProps = {
  52250. name: String,
  52251. appear: Boolean,
  52252. css: Boolean,
  52253. mode: String,
  52254. type: String,
  52255. enterClass: String,
  52256. leaveClass: String,
  52257. enterToClass: String,
  52258. leaveToClass: String,
  52259. enterActiveClass: String,
  52260. leaveActiveClass: String,
  52261. appearClass: String,
  52262. appearActiveClass: String,
  52263. appearToClass: String,
  52264. duration: [Number, String, Object]
  52265. };
  52266. // in case the child is also an abstract component, e.g. <keep-alive>
  52267. // we want to recursively retrieve the real component to be rendered
  52268. function getRealChild (vnode) {
  52269. var compOptions = vnode && vnode.componentOptions;
  52270. if (compOptions && compOptions.Ctor.options.abstract) {
  52271. return getRealChild(getFirstComponentChild(compOptions.children))
  52272. } else {
  52273. return vnode
  52274. }
  52275. }
  52276. function extractTransitionData (comp) {
  52277. var data = {};
  52278. var options = comp.$options;
  52279. // props
  52280. for (var key in options.propsData) {
  52281. data[key] = comp[key];
  52282. }
  52283. // events.
  52284. // extract listeners and pass them directly to the transition methods
  52285. var listeners = options._parentListeners;
  52286. for (var key$1 in listeners) {
  52287. data[camelize(key$1)] = listeners[key$1];
  52288. }
  52289. return data
  52290. }
  52291. function placeholder (h, rawChild) {
  52292. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52293. return h('keep-alive', {
  52294. props: rawChild.componentOptions.propsData
  52295. })
  52296. }
  52297. }
  52298. function hasParentTransition (vnode) {
  52299. while ((vnode = vnode.parent)) {
  52300. if (vnode.data.transition) {
  52301. return true
  52302. }
  52303. }
  52304. }
  52305. function isSameChild (child, oldChild) {
  52306. return oldChild.key === child.key && oldChild.tag === child.tag
  52307. }
  52308. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52309. var isVShowDirective = function (d) { return d.name === 'show'; };
  52310. var Transition = {
  52311. name: 'transition',
  52312. props: transitionProps,
  52313. abstract: true,
  52314. render: function render (h) {
  52315. var this$1 = this;
  52316. var children = this.$slots.default;
  52317. if (!children) {
  52318. return
  52319. }
  52320. // filter out text nodes (possible whitespaces)
  52321. children = children.filter(isNotTextNode);
  52322. /* istanbul ignore if */
  52323. if (!children.length) {
  52324. return
  52325. }
  52326. // warn multiple elements
  52327. if (children.length > 1) {
  52328. warn(
  52329. '<transition> can only be used on a single element. Use ' +
  52330. '<transition-group> for lists.',
  52331. this.$parent
  52332. );
  52333. }
  52334. var mode = this.mode;
  52335. // warn invalid mode
  52336. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52337. ) {
  52338. warn(
  52339. 'invalid <transition> mode: ' + mode,
  52340. this.$parent
  52341. );
  52342. }
  52343. var rawChild = children[0];
  52344. // if this is a component root node and the component's
  52345. // parent container node also has transition, skip.
  52346. if (hasParentTransition(this.$vnode)) {
  52347. return rawChild
  52348. }
  52349. // apply transition data to child
  52350. // use getRealChild() to ignore abstract components e.g. keep-alive
  52351. var child = getRealChild(rawChild);
  52352. /* istanbul ignore if */
  52353. if (!child) {
  52354. return rawChild
  52355. }
  52356. if (this._leaving) {
  52357. return placeholder(h, rawChild)
  52358. }
  52359. // ensure a key that is unique to the vnode type and to this transition
  52360. // component instance. This key will be used to remove pending leaving nodes
  52361. // during entering.
  52362. var id = "__transition-" + (this._uid) + "-";
  52363. child.key = child.key == null
  52364. ? child.isComment
  52365. ? id + 'comment'
  52366. : id + child.tag
  52367. : isPrimitive(child.key)
  52368. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52369. : child.key;
  52370. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52371. var oldRawChild = this._vnode;
  52372. var oldChild = getRealChild(oldRawChild);
  52373. // mark v-show
  52374. // so that the transition module can hand over the control to the directive
  52375. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52376. child.data.show = true;
  52377. }
  52378. if (
  52379. oldChild &&
  52380. oldChild.data &&
  52381. !isSameChild(child, oldChild) &&
  52382. !isAsyncPlaceholder(oldChild) &&
  52383. // #6687 component root is a comment node
  52384. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52385. ) {
  52386. // replace old child transition data with fresh one
  52387. // important for dynamic transitions!
  52388. var oldData = oldChild.data.transition = extend({}, data);
  52389. // handle transition mode
  52390. if (mode === 'out-in') {
  52391. // return placeholder node and queue update when leave finishes
  52392. this._leaving = true;
  52393. mergeVNodeHook(oldData, 'afterLeave', function () {
  52394. this$1._leaving = false;
  52395. this$1.$forceUpdate();
  52396. });
  52397. return placeholder(h, rawChild)
  52398. } else if (mode === 'in-out') {
  52399. if (isAsyncPlaceholder(child)) {
  52400. return oldRawChild
  52401. }
  52402. var delayedLeave;
  52403. var performLeave = function () { delayedLeave(); };
  52404. mergeVNodeHook(data, 'afterEnter', performLeave);
  52405. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52406. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52407. }
  52408. }
  52409. return rawChild
  52410. }
  52411. };
  52412. /* */
  52413. var props = extend({
  52414. tag: String,
  52415. moveClass: String
  52416. }, transitionProps);
  52417. delete props.mode;
  52418. var TransitionGroup = {
  52419. props: props,
  52420. beforeMount: function beforeMount () {
  52421. var this$1 = this;
  52422. var update = this._update;
  52423. this._update = function (vnode, hydrating) {
  52424. var restoreActiveInstance = setActiveInstance(this$1);
  52425. // force removing pass
  52426. this$1.__patch__(
  52427. this$1._vnode,
  52428. this$1.kept,
  52429. false, // hydrating
  52430. true // removeOnly (!important, avoids unnecessary moves)
  52431. );
  52432. this$1._vnode = this$1.kept;
  52433. restoreActiveInstance();
  52434. update.call(this$1, vnode, hydrating);
  52435. };
  52436. },
  52437. render: function render (h) {
  52438. var tag = this.tag || this.$vnode.data.tag || 'span';
  52439. var map = Object.create(null);
  52440. var prevChildren = this.prevChildren = this.children;
  52441. var rawChildren = this.$slots.default || [];
  52442. var children = this.children = [];
  52443. var transitionData = extractTransitionData(this);
  52444. for (var i = 0; i < rawChildren.length; i++) {
  52445. var c = rawChildren[i];
  52446. if (c.tag) {
  52447. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52448. children.push(c);
  52449. map[c.key] = c
  52450. ;(c.data || (c.data = {})).transition = transitionData;
  52451. } else {
  52452. var opts = c.componentOptions;
  52453. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52454. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52455. }
  52456. }
  52457. }
  52458. if (prevChildren) {
  52459. var kept = [];
  52460. var removed = [];
  52461. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52462. var c$1 = prevChildren[i$1];
  52463. c$1.data.transition = transitionData;
  52464. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52465. if (map[c$1.key]) {
  52466. kept.push(c$1);
  52467. } else {
  52468. removed.push(c$1);
  52469. }
  52470. }
  52471. this.kept = h(tag, null, kept);
  52472. this.removed = removed;
  52473. }
  52474. return h(tag, null, children)
  52475. },
  52476. updated: function updated () {
  52477. var children = this.prevChildren;
  52478. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52479. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52480. return
  52481. }
  52482. // we divide the work into three loops to avoid mixing DOM reads and writes
  52483. // in each iteration - which helps prevent layout thrashing.
  52484. children.forEach(callPendingCbs);
  52485. children.forEach(recordPosition);
  52486. children.forEach(applyTranslation);
  52487. // force reflow to put everything in position
  52488. // assign to this to avoid being removed in tree-shaking
  52489. // $flow-disable-line
  52490. this._reflow = document.body.offsetHeight;
  52491. children.forEach(function (c) {
  52492. if (c.data.moved) {
  52493. var el = c.elm;
  52494. var s = el.style;
  52495. addTransitionClass(el, moveClass);
  52496. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52497. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52498. if (e && e.target !== el) {
  52499. return
  52500. }
  52501. if (!e || /transform$/.test(e.propertyName)) {
  52502. el.removeEventListener(transitionEndEvent, cb);
  52503. el._moveCb = null;
  52504. removeTransitionClass(el, moveClass);
  52505. }
  52506. });
  52507. }
  52508. });
  52509. },
  52510. methods: {
  52511. hasMove: function hasMove (el, moveClass) {
  52512. /* istanbul ignore if */
  52513. if (!hasTransition) {
  52514. return false
  52515. }
  52516. /* istanbul ignore if */
  52517. if (this._hasMove) {
  52518. return this._hasMove
  52519. }
  52520. // Detect whether an element with the move class applied has
  52521. // CSS transitions. Since the element may be inside an entering
  52522. // transition at this very moment, we make a clone of it and remove
  52523. // all other transition classes applied to ensure only the move class
  52524. // is applied.
  52525. var clone = el.cloneNode();
  52526. if (el._transitionClasses) {
  52527. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52528. }
  52529. addClass(clone, moveClass);
  52530. clone.style.display = 'none';
  52531. this.$el.appendChild(clone);
  52532. var info = getTransitionInfo(clone);
  52533. this.$el.removeChild(clone);
  52534. return (this._hasMove = info.hasTransform)
  52535. }
  52536. }
  52537. };
  52538. function callPendingCbs (c) {
  52539. /* istanbul ignore if */
  52540. if (c.elm._moveCb) {
  52541. c.elm._moveCb();
  52542. }
  52543. /* istanbul ignore if */
  52544. if (c.elm._enterCb) {
  52545. c.elm._enterCb();
  52546. }
  52547. }
  52548. function recordPosition (c) {
  52549. c.data.newPos = c.elm.getBoundingClientRect();
  52550. }
  52551. function applyTranslation (c) {
  52552. var oldPos = c.data.pos;
  52553. var newPos = c.data.newPos;
  52554. var dx = oldPos.left - newPos.left;
  52555. var dy = oldPos.top - newPos.top;
  52556. if (dx || dy) {
  52557. c.data.moved = true;
  52558. var s = c.elm.style;
  52559. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52560. s.transitionDuration = '0s';
  52561. }
  52562. }
  52563. var platformComponents = {
  52564. Transition: Transition,
  52565. TransitionGroup: TransitionGroup
  52566. };
  52567. /* */
  52568. // install platform specific utils
  52569. Vue.config.mustUseProp = mustUseProp;
  52570. Vue.config.isReservedTag = isReservedTag;
  52571. Vue.config.isReservedAttr = isReservedAttr;
  52572. Vue.config.getTagNamespace = getTagNamespace;
  52573. Vue.config.isUnknownElement = isUnknownElement;
  52574. // install platform runtime directives & components
  52575. extend(Vue.options.directives, platformDirectives);
  52576. extend(Vue.options.components, platformComponents);
  52577. // install platform patch function
  52578. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52579. // public mount method
  52580. Vue.prototype.$mount = function (
  52581. el,
  52582. hydrating
  52583. ) {
  52584. el = el && inBrowser ? query(el) : undefined;
  52585. return mountComponent(this, el, hydrating)
  52586. };
  52587. // devtools global hook
  52588. /* istanbul ignore next */
  52589. if (inBrowser) {
  52590. setTimeout(function () {
  52591. if (config.devtools) {
  52592. if (devtools) {
  52593. devtools.emit('init', Vue);
  52594. } else {
  52595. console[console.info ? 'info' : 'log'](
  52596. 'Download the Vue Devtools extension for a better development experience:\n' +
  52597. 'https://github.com/vuejs/vue-devtools'
  52598. );
  52599. }
  52600. }
  52601. if (config.productionTip !== false &&
  52602. typeof console !== 'undefined'
  52603. ) {
  52604. console[console.info ? 'info' : 'log'](
  52605. "You are running Vue in development mode.\n" +
  52606. "Make sure to turn on production mode when deploying for production.\n" +
  52607. "See more tips at https://vuejs.org/guide/deployment.html"
  52608. );
  52609. }
  52610. }, 0);
  52611. }
  52612. /* */
  52613. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52614. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52615. var buildRegex = cached(function (delimiters) {
  52616. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52617. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52618. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52619. });
  52620. function parseText (
  52621. text,
  52622. delimiters
  52623. ) {
  52624. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52625. if (!tagRE.test(text)) {
  52626. return
  52627. }
  52628. var tokens = [];
  52629. var rawTokens = [];
  52630. var lastIndex = tagRE.lastIndex = 0;
  52631. var match, index, tokenValue;
  52632. while ((match = tagRE.exec(text))) {
  52633. index = match.index;
  52634. // push text token
  52635. if (index > lastIndex) {
  52636. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52637. tokens.push(JSON.stringify(tokenValue));
  52638. }
  52639. // tag token
  52640. var exp = parseFilters(match[1].trim());
  52641. tokens.push(("_s(" + exp + ")"));
  52642. rawTokens.push({ '@binding': exp });
  52643. lastIndex = index + match[0].length;
  52644. }
  52645. if (lastIndex < text.length) {
  52646. rawTokens.push(tokenValue = text.slice(lastIndex));
  52647. tokens.push(JSON.stringify(tokenValue));
  52648. }
  52649. return {
  52650. expression: tokens.join('+'),
  52651. tokens: rawTokens
  52652. }
  52653. }
  52654. /* */
  52655. function transformNode (el, options) {
  52656. var warn = options.warn || baseWarn;
  52657. var staticClass = getAndRemoveAttr(el, 'class');
  52658. if (staticClass) {
  52659. var res = parseText(staticClass, options.delimiters);
  52660. if (res) {
  52661. warn(
  52662. "class=\"" + staticClass + "\": " +
  52663. 'Interpolation inside attributes has been removed. ' +
  52664. 'Use v-bind or the colon shorthand instead. For example, ' +
  52665. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52666. el.rawAttrsMap['class']
  52667. );
  52668. }
  52669. }
  52670. if (staticClass) {
  52671. el.staticClass = JSON.stringify(staticClass);
  52672. }
  52673. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52674. if (classBinding) {
  52675. el.classBinding = classBinding;
  52676. }
  52677. }
  52678. function genData (el) {
  52679. var data = '';
  52680. if (el.staticClass) {
  52681. data += "staticClass:" + (el.staticClass) + ",";
  52682. }
  52683. if (el.classBinding) {
  52684. data += "class:" + (el.classBinding) + ",";
  52685. }
  52686. return data
  52687. }
  52688. var klass$1 = {
  52689. staticKeys: ['staticClass'],
  52690. transformNode: transformNode,
  52691. genData: genData
  52692. };
  52693. /* */
  52694. function transformNode$1 (el, options) {
  52695. var warn = options.warn || baseWarn;
  52696. var staticStyle = getAndRemoveAttr(el, 'style');
  52697. if (staticStyle) {
  52698. /* istanbul ignore if */
  52699. {
  52700. var res = parseText(staticStyle, options.delimiters);
  52701. if (res) {
  52702. warn(
  52703. "style=\"" + staticStyle + "\": " +
  52704. 'Interpolation inside attributes has been removed. ' +
  52705. 'Use v-bind or the colon shorthand instead. For example, ' +
  52706. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52707. el.rawAttrsMap['style']
  52708. );
  52709. }
  52710. }
  52711. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52712. }
  52713. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52714. if (styleBinding) {
  52715. el.styleBinding = styleBinding;
  52716. }
  52717. }
  52718. function genData$1 (el) {
  52719. var data = '';
  52720. if (el.staticStyle) {
  52721. data += "staticStyle:" + (el.staticStyle) + ",";
  52722. }
  52723. if (el.styleBinding) {
  52724. data += "style:(" + (el.styleBinding) + "),";
  52725. }
  52726. return data
  52727. }
  52728. var style$1 = {
  52729. staticKeys: ['staticStyle'],
  52730. transformNode: transformNode$1,
  52731. genData: genData$1
  52732. };
  52733. /* */
  52734. var decoder;
  52735. var he = {
  52736. decode: function decode (html) {
  52737. decoder = decoder || document.createElement('div');
  52738. decoder.innerHTML = html;
  52739. return decoder.textContent
  52740. }
  52741. };
  52742. /* */
  52743. var isUnaryTag = makeMap(
  52744. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52745. 'link,meta,param,source,track,wbr'
  52746. );
  52747. // Elements that you can, intentionally, leave open
  52748. // (and which close themselves)
  52749. var canBeLeftOpenTag = makeMap(
  52750. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52751. );
  52752. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52753. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52754. var isNonPhrasingTag = makeMap(
  52755. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52756. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52757. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52758. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52759. 'title,tr,track'
  52760. );
  52761. /**
  52762. * Not type-checking this file because it's mostly vendor code.
  52763. */
  52764. // Regular Expressions for parsing tags and attributes
  52765. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52766. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52767. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52768. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52769. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52770. var startTagClose = /^\s*(\/?)>/;
  52771. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52772. var doctype = /^<!DOCTYPE [^>]+>/i;
  52773. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52774. var comment = /^<!\--/;
  52775. var conditionalComment = /^<!\[/;
  52776. // Special Elements (can contain anything)
  52777. var isPlainTextElement = makeMap('script,style,textarea', true);
  52778. var reCache = {};
  52779. var decodingMap = {
  52780. '&lt;': '<',
  52781. '&gt;': '>',
  52782. '&quot;': '"',
  52783. '&amp;': '&',
  52784. '&#10;': '\n',
  52785. '&#9;': '\t',
  52786. '&#39;': "'"
  52787. };
  52788. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52789. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52790. // #5992
  52791. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52792. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52793. function decodeAttr (value, shouldDecodeNewlines) {
  52794. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52795. return value.replace(re, function (match) { return decodingMap[match]; })
  52796. }
  52797. function parseHTML (html, options) {
  52798. var stack = [];
  52799. var expectHTML = options.expectHTML;
  52800. var isUnaryTag$$1 = options.isUnaryTag || no;
  52801. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52802. var index = 0;
  52803. var last, lastTag;
  52804. while (html) {
  52805. last = html;
  52806. // Make sure we're not in a plaintext content element like script/style
  52807. if (!lastTag || !isPlainTextElement(lastTag)) {
  52808. var textEnd = html.indexOf('<');
  52809. if (textEnd === 0) {
  52810. // Comment:
  52811. if (comment.test(html)) {
  52812. var commentEnd = html.indexOf('-->');
  52813. if (commentEnd >= 0) {
  52814. if (options.shouldKeepComment) {
  52815. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52816. }
  52817. advance(commentEnd + 3);
  52818. continue
  52819. }
  52820. }
  52821. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52822. if (conditionalComment.test(html)) {
  52823. var conditionalEnd = html.indexOf(']>');
  52824. if (conditionalEnd >= 0) {
  52825. advance(conditionalEnd + 2);
  52826. continue
  52827. }
  52828. }
  52829. // Doctype:
  52830. var doctypeMatch = html.match(doctype);
  52831. if (doctypeMatch) {
  52832. advance(doctypeMatch[0].length);
  52833. continue
  52834. }
  52835. // End tag:
  52836. var endTagMatch = html.match(endTag);
  52837. if (endTagMatch) {
  52838. var curIndex = index;
  52839. advance(endTagMatch[0].length);
  52840. parseEndTag(endTagMatch[1], curIndex, index);
  52841. continue
  52842. }
  52843. // Start tag:
  52844. var startTagMatch = parseStartTag();
  52845. if (startTagMatch) {
  52846. handleStartTag(startTagMatch);
  52847. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52848. advance(1);
  52849. }
  52850. continue
  52851. }
  52852. }
  52853. var text = (void 0), rest = (void 0), next = (void 0);
  52854. if (textEnd >= 0) {
  52855. rest = html.slice(textEnd);
  52856. while (
  52857. !endTag.test(rest) &&
  52858. !startTagOpen.test(rest) &&
  52859. !comment.test(rest) &&
  52860. !conditionalComment.test(rest)
  52861. ) {
  52862. // < in plain text, be forgiving and treat it as text
  52863. next = rest.indexOf('<', 1);
  52864. if (next < 0) { break }
  52865. textEnd += next;
  52866. rest = html.slice(textEnd);
  52867. }
  52868. text = html.substring(0, textEnd);
  52869. }
  52870. if (textEnd < 0) {
  52871. text = html;
  52872. }
  52873. if (text) {
  52874. advance(text.length);
  52875. }
  52876. if (options.chars && text) {
  52877. options.chars(text, index - text.length, index);
  52878. }
  52879. } else {
  52880. var endTagLength = 0;
  52881. var stackedTag = lastTag.toLowerCase();
  52882. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52883. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52884. endTagLength = endTag.length;
  52885. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52886. text = text
  52887. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52888. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52889. }
  52890. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52891. text = text.slice(1);
  52892. }
  52893. if (options.chars) {
  52894. options.chars(text);
  52895. }
  52896. return ''
  52897. });
  52898. index += html.length - rest$1.length;
  52899. html = rest$1;
  52900. parseEndTag(stackedTag, index - endTagLength, index);
  52901. }
  52902. if (html === last) {
  52903. options.chars && options.chars(html);
  52904. if (!stack.length && options.warn) {
  52905. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52906. }
  52907. break
  52908. }
  52909. }
  52910. // Clean up any remaining tags
  52911. parseEndTag();
  52912. function advance (n) {
  52913. index += n;
  52914. html = html.substring(n);
  52915. }
  52916. function parseStartTag () {
  52917. var start = html.match(startTagOpen);
  52918. if (start) {
  52919. var match = {
  52920. tagName: start[1],
  52921. attrs: [],
  52922. start: index
  52923. };
  52924. advance(start[0].length);
  52925. var end, attr;
  52926. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52927. attr.start = index;
  52928. advance(attr[0].length);
  52929. attr.end = index;
  52930. match.attrs.push(attr);
  52931. }
  52932. if (end) {
  52933. match.unarySlash = end[1];
  52934. advance(end[0].length);
  52935. match.end = index;
  52936. return match
  52937. }
  52938. }
  52939. }
  52940. function handleStartTag (match) {
  52941. var tagName = match.tagName;
  52942. var unarySlash = match.unarySlash;
  52943. if (expectHTML) {
  52944. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52945. parseEndTag(lastTag);
  52946. }
  52947. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52948. parseEndTag(tagName);
  52949. }
  52950. }
  52951. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52952. var l = match.attrs.length;
  52953. var attrs = new Array(l);
  52954. for (var i = 0; i < l; i++) {
  52955. var args = match.attrs[i];
  52956. var value = args[3] || args[4] || args[5] || '';
  52957. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52958. ? options.shouldDecodeNewlinesForHref
  52959. : options.shouldDecodeNewlines;
  52960. attrs[i] = {
  52961. name: args[1],
  52962. value: decodeAttr(value, shouldDecodeNewlines)
  52963. };
  52964. if (options.outputSourceRange) {
  52965. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52966. attrs[i].end = args.end;
  52967. }
  52968. }
  52969. if (!unary) {
  52970. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52971. lastTag = tagName;
  52972. }
  52973. if (options.start) {
  52974. options.start(tagName, attrs, unary, match.start, match.end);
  52975. }
  52976. }
  52977. function parseEndTag (tagName, start, end) {
  52978. var pos, lowerCasedTagName;
  52979. if (start == null) { start = index; }
  52980. if (end == null) { end = index; }
  52981. // Find the closest opened tag of the same type
  52982. if (tagName) {
  52983. lowerCasedTagName = tagName.toLowerCase();
  52984. for (pos = stack.length - 1; pos >= 0; pos--) {
  52985. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52986. break
  52987. }
  52988. }
  52989. } else {
  52990. // If no tag name is provided, clean shop
  52991. pos = 0;
  52992. }
  52993. if (pos >= 0) {
  52994. // Close all the open elements, up the stack
  52995. for (var i = stack.length - 1; i >= pos; i--) {
  52996. if (i > pos || !tagName &&
  52997. options.warn
  52998. ) {
  52999. options.warn(
  53000. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53001. { start: stack[i].start, end: stack[i].end }
  53002. );
  53003. }
  53004. if (options.end) {
  53005. options.end(stack[i].tag, start, end);
  53006. }
  53007. }
  53008. // Remove the open elements from the stack
  53009. stack.length = pos;
  53010. lastTag = pos && stack[pos - 1].tag;
  53011. } else if (lowerCasedTagName === 'br') {
  53012. if (options.start) {
  53013. options.start(tagName, [], true, start, end);
  53014. }
  53015. } else if (lowerCasedTagName === 'p') {
  53016. if (options.start) {
  53017. options.start(tagName, [], false, start, end);
  53018. }
  53019. if (options.end) {
  53020. options.end(tagName, start, end);
  53021. }
  53022. }
  53023. }
  53024. }
  53025. /* */
  53026. var onRE = /^@|^v-on:/;
  53027. var dirRE = /^v-|^@|^:|^#/;
  53028. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53029. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53030. var stripParensRE = /^\(|\)$/g;
  53031. var dynamicArgRE = /^\[.*\]$/;
  53032. var argRE = /:(.*)$/;
  53033. var bindRE = /^:|^\.|^v-bind:/;
  53034. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53035. var slotRE = /^v-slot(:|$)|^#/;
  53036. var lineBreakRE = /[\r\n]/;
  53037. var whitespaceRE$1 = /\s+/g;
  53038. var invalidAttributeRE = /[\s"'<>\/=]/;
  53039. var decodeHTMLCached = cached(he.decode);
  53040. var emptySlotScopeToken = "_empty_";
  53041. // configurable state
  53042. var warn$2;
  53043. var delimiters;
  53044. var transforms;
  53045. var preTransforms;
  53046. var postTransforms;
  53047. var platformIsPreTag;
  53048. var platformMustUseProp;
  53049. var platformGetTagNamespace;
  53050. var maybeComponent;
  53051. function createASTElement (
  53052. tag,
  53053. attrs,
  53054. parent
  53055. ) {
  53056. return {
  53057. type: 1,
  53058. tag: tag,
  53059. attrsList: attrs,
  53060. attrsMap: makeAttrsMap(attrs),
  53061. rawAttrsMap: {},
  53062. parent: parent,
  53063. children: []
  53064. }
  53065. }
  53066. /**
  53067. * Convert HTML string to AST.
  53068. */
  53069. function parse (
  53070. template,
  53071. options
  53072. ) {
  53073. warn$2 = options.warn || baseWarn;
  53074. platformIsPreTag = options.isPreTag || no;
  53075. platformMustUseProp = options.mustUseProp || no;
  53076. platformGetTagNamespace = options.getTagNamespace || no;
  53077. var isReservedTag = options.isReservedTag || no;
  53078. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53079. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53080. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53081. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53082. delimiters = options.delimiters;
  53083. var stack = [];
  53084. var preserveWhitespace = options.preserveWhitespace !== false;
  53085. var whitespaceOption = options.whitespace;
  53086. var root;
  53087. var currentParent;
  53088. var inVPre = false;
  53089. var inPre = false;
  53090. var warned = false;
  53091. function warnOnce (msg, range) {
  53092. if (!warned) {
  53093. warned = true;
  53094. warn$2(msg, range);
  53095. }
  53096. }
  53097. function closeElement (element) {
  53098. trimEndingWhitespace(element);
  53099. if (!inVPre && !element.processed) {
  53100. element = processElement(element, options);
  53101. }
  53102. // tree management
  53103. if (!stack.length && element !== root) {
  53104. // allow root elements with v-if, v-else-if and v-else
  53105. if (root.if && (element.elseif || element.else)) {
  53106. {
  53107. checkRootConstraints(element);
  53108. }
  53109. addIfCondition(root, {
  53110. exp: element.elseif,
  53111. block: element
  53112. });
  53113. } else {
  53114. warnOnce(
  53115. "Component template should contain exactly one root element. " +
  53116. "If you are using v-if on multiple elements, " +
  53117. "use v-else-if to chain them instead.",
  53118. { start: element.start }
  53119. );
  53120. }
  53121. }
  53122. if (currentParent && !element.forbidden) {
  53123. if (element.elseif || element.else) {
  53124. processIfConditions(element, currentParent);
  53125. } else {
  53126. if (element.slotScope) {
  53127. // scoped slot
  53128. // keep it in the children list so that v-else(-if) conditions can
  53129. // find it as the prev node.
  53130. var name = element.slotTarget || '"default"'
  53131. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53132. }
  53133. currentParent.children.push(element);
  53134. element.parent = currentParent;
  53135. }
  53136. }
  53137. // final children cleanup
  53138. // filter out scoped slots
  53139. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53140. // remove trailing whitespace node again
  53141. trimEndingWhitespace(element);
  53142. // check pre state
  53143. if (element.pre) {
  53144. inVPre = false;
  53145. }
  53146. if (platformIsPreTag(element.tag)) {
  53147. inPre = false;
  53148. }
  53149. // apply post-transforms
  53150. for (var i = 0; i < postTransforms.length; i++) {
  53151. postTransforms[i](element, options);
  53152. }
  53153. }
  53154. function trimEndingWhitespace (el) {
  53155. // remove trailing whitespace node
  53156. if (!inPre) {
  53157. var lastNode;
  53158. while (
  53159. (lastNode = el.children[el.children.length - 1]) &&
  53160. lastNode.type === 3 &&
  53161. lastNode.text === ' '
  53162. ) {
  53163. el.children.pop();
  53164. }
  53165. }
  53166. }
  53167. function checkRootConstraints (el) {
  53168. if (el.tag === 'slot' || el.tag === 'template') {
  53169. warnOnce(
  53170. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53171. 'contain multiple nodes.',
  53172. { start: el.start }
  53173. );
  53174. }
  53175. if (el.attrsMap.hasOwnProperty('v-for')) {
  53176. warnOnce(
  53177. 'Cannot use v-for on stateful component root element because ' +
  53178. 'it renders multiple elements.',
  53179. el.rawAttrsMap['v-for']
  53180. );
  53181. }
  53182. }
  53183. parseHTML(template, {
  53184. warn: warn$2,
  53185. expectHTML: options.expectHTML,
  53186. isUnaryTag: options.isUnaryTag,
  53187. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53188. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53189. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53190. shouldKeepComment: options.comments,
  53191. outputSourceRange: options.outputSourceRange,
  53192. start: function start (tag, attrs, unary, start$1, end) {
  53193. // check namespace.
  53194. // inherit parent ns if there is one
  53195. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53196. // handle IE svg bug
  53197. /* istanbul ignore if */
  53198. if (isIE && ns === 'svg') {
  53199. attrs = guardIESVGBug(attrs);
  53200. }
  53201. var element = createASTElement(tag, attrs, currentParent);
  53202. if (ns) {
  53203. element.ns = ns;
  53204. }
  53205. {
  53206. if (options.outputSourceRange) {
  53207. element.start = start$1;
  53208. element.end = end;
  53209. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53210. cumulated[attr.name] = attr;
  53211. return cumulated
  53212. }, {});
  53213. }
  53214. attrs.forEach(function (attr) {
  53215. if (invalidAttributeRE.test(attr.name)) {
  53216. warn$2(
  53217. "Invalid dynamic argument expression: attribute names cannot contain " +
  53218. "spaces, quotes, <, >, / or =.",
  53219. {
  53220. start: attr.start + attr.name.indexOf("["),
  53221. end: attr.start + attr.name.length
  53222. }
  53223. );
  53224. }
  53225. });
  53226. }
  53227. if (isForbiddenTag(element) && !isServerRendering()) {
  53228. element.forbidden = true;
  53229. warn$2(
  53230. 'Templates should only be responsible for mapping the state to the ' +
  53231. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53232. "<" + tag + ">" + ', as they will not be parsed.',
  53233. { start: element.start }
  53234. );
  53235. }
  53236. // apply pre-transforms
  53237. for (var i = 0; i < preTransforms.length; i++) {
  53238. element = preTransforms[i](element, options) || element;
  53239. }
  53240. if (!inVPre) {
  53241. processPre(element);
  53242. if (element.pre) {
  53243. inVPre = true;
  53244. }
  53245. }
  53246. if (platformIsPreTag(element.tag)) {
  53247. inPre = true;
  53248. }
  53249. if (inVPre) {
  53250. processRawAttrs(element);
  53251. } else if (!element.processed) {
  53252. // structural directives
  53253. processFor(element);
  53254. processIf(element);
  53255. processOnce(element);
  53256. }
  53257. if (!root) {
  53258. root = element;
  53259. {
  53260. checkRootConstraints(root);
  53261. }
  53262. }
  53263. if (!unary) {
  53264. currentParent = element;
  53265. stack.push(element);
  53266. } else {
  53267. closeElement(element);
  53268. }
  53269. },
  53270. end: function end (tag, start, end$1) {
  53271. var element = stack[stack.length - 1];
  53272. // pop stack
  53273. stack.length -= 1;
  53274. currentParent = stack[stack.length - 1];
  53275. if (options.outputSourceRange) {
  53276. element.end = end$1;
  53277. }
  53278. closeElement(element);
  53279. },
  53280. chars: function chars (text, start, end) {
  53281. if (!currentParent) {
  53282. {
  53283. if (text === template) {
  53284. warnOnce(
  53285. 'Component template requires a root element, rather than just text.',
  53286. { start: start }
  53287. );
  53288. } else if ((text = text.trim())) {
  53289. warnOnce(
  53290. ("text \"" + text + "\" outside root element will be ignored."),
  53291. { start: start }
  53292. );
  53293. }
  53294. }
  53295. return
  53296. }
  53297. // IE textarea placeholder bug
  53298. /* istanbul ignore if */
  53299. if (isIE &&
  53300. currentParent.tag === 'textarea' &&
  53301. currentParent.attrsMap.placeholder === text
  53302. ) {
  53303. return
  53304. }
  53305. var children = currentParent.children;
  53306. if (inPre || text.trim()) {
  53307. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53308. } else if (!children.length) {
  53309. // remove the whitespace-only node right after an opening tag
  53310. text = '';
  53311. } else if (whitespaceOption) {
  53312. if (whitespaceOption === 'condense') {
  53313. // in condense mode, remove the whitespace node if it contains
  53314. // line break, otherwise condense to a single space
  53315. text = lineBreakRE.test(text) ? '' : ' ';
  53316. } else {
  53317. text = ' ';
  53318. }
  53319. } else {
  53320. text = preserveWhitespace ? ' ' : '';
  53321. }
  53322. if (text) {
  53323. if (!inPre && whitespaceOption === 'condense') {
  53324. // condense consecutive whitespaces into single space
  53325. text = text.replace(whitespaceRE$1, ' ');
  53326. }
  53327. var res;
  53328. var child;
  53329. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53330. child = {
  53331. type: 2,
  53332. expression: res.expression,
  53333. tokens: res.tokens,
  53334. text: text
  53335. };
  53336. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53337. child = {
  53338. type: 3,
  53339. text: text
  53340. };
  53341. }
  53342. if (child) {
  53343. if (options.outputSourceRange) {
  53344. child.start = start;
  53345. child.end = end;
  53346. }
  53347. children.push(child);
  53348. }
  53349. }
  53350. },
  53351. comment: function comment (text, start, end) {
  53352. // adding anyting as a sibling to the root node is forbidden
  53353. // comments should still be allowed, but ignored
  53354. if (currentParent) {
  53355. var child = {
  53356. type: 3,
  53357. text: text,
  53358. isComment: true
  53359. };
  53360. if (options.outputSourceRange) {
  53361. child.start = start;
  53362. child.end = end;
  53363. }
  53364. currentParent.children.push(child);
  53365. }
  53366. }
  53367. });
  53368. return root
  53369. }
  53370. function processPre (el) {
  53371. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53372. el.pre = true;
  53373. }
  53374. }
  53375. function processRawAttrs (el) {
  53376. var list = el.attrsList;
  53377. var len = list.length;
  53378. if (len) {
  53379. var attrs = el.attrs = new Array(len);
  53380. for (var i = 0; i < len; i++) {
  53381. attrs[i] = {
  53382. name: list[i].name,
  53383. value: JSON.stringify(list[i].value)
  53384. };
  53385. if (list[i].start != null) {
  53386. attrs[i].start = list[i].start;
  53387. attrs[i].end = list[i].end;
  53388. }
  53389. }
  53390. } else if (!el.pre) {
  53391. // non root node in pre blocks with no attributes
  53392. el.plain = true;
  53393. }
  53394. }
  53395. function processElement (
  53396. element,
  53397. options
  53398. ) {
  53399. processKey(element);
  53400. // determine whether this is a plain element after
  53401. // removing structural attributes
  53402. element.plain = (
  53403. !element.key &&
  53404. !element.scopedSlots &&
  53405. !element.attrsList.length
  53406. );
  53407. processRef(element);
  53408. processSlotContent(element);
  53409. processSlotOutlet(element);
  53410. processComponent(element);
  53411. for (var i = 0; i < transforms.length; i++) {
  53412. element = transforms[i](element, options) || element;
  53413. }
  53414. processAttrs(element);
  53415. return element
  53416. }
  53417. function processKey (el) {
  53418. var exp = getBindingAttr(el, 'key');
  53419. if (exp) {
  53420. {
  53421. if (el.tag === 'template') {
  53422. warn$2(
  53423. "<template> cannot be keyed. Place the key on real elements instead.",
  53424. getRawBindingAttr(el, 'key')
  53425. );
  53426. }
  53427. if (el.for) {
  53428. var iterator = el.iterator2 || el.iterator1;
  53429. var parent = el.parent;
  53430. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53431. warn$2(
  53432. "Do not use v-for index as key on <transition-group> children, " +
  53433. "this is the same as not using keys.",
  53434. getRawBindingAttr(el, 'key'),
  53435. true /* tip */
  53436. );
  53437. }
  53438. }
  53439. }
  53440. el.key = exp;
  53441. }
  53442. }
  53443. function processRef (el) {
  53444. var ref = getBindingAttr(el, 'ref');
  53445. if (ref) {
  53446. el.ref = ref;
  53447. el.refInFor = checkInFor(el);
  53448. }
  53449. }
  53450. function processFor (el) {
  53451. var exp;
  53452. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53453. var res = parseFor(exp);
  53454. if (res) {
  53455. extend(el, res);
  53456. } else {
  53457. warn$2(
  53458. ("Invalid v-for expression: " + exp),
  53459. el.rawAttrsMap['v-for']
  53460. );
  53461. }
  53462. }
  53463. }
  53464. function parseFor (exp) {
  53465. var inMatch = exp.match(forAliasRE);
  53466. if (!inMatch) { return }
  53467. var res = {};
  53468. res.for = inMatch[2].trim();
  53469. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53470. var iteratorMatch = alias.match(forIteratorRE);
  53471. if (iteratorMatch) {
  53472. res.alias = alias.replace(forIteratorRE, '').trim();
  53473. res.iterator1 = iteratorMatch[1].trim();
  53474. if (iteratorMatch[2]) {
  53475. res.iterator2 = iteratorMatch[2].trim();
  53476. }
  53477. } else {
  53478. res.alias = alias;
  53479. }
  53480. return res
  53481. }
  53482. function processIf (el) {
  53483. var exp = getAndRemoveAttr(el, 'v-if');
  53484. if (exp) {
  53485. el.if = exp;
  53486. addIfCondition(el, {
  53487. exp: exp,
  53488. block: el
  53489. });
  53490. } else {
  53491. if (getAndRemoveAttr(el, 'v-else') != null) {
  53492. el.else = true;
  53493. }
  53494. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53495. if (elseif) {
  53496. el.elseif = elseif;
  53497. }
  53498. }
  53499. }
  53500. function processIfConditions (el, parent) {
  53501. var prev = findPrevElement(parent.children);
  53502. if (prev && prev.if) {
  53503. addIfCondition(prev, {
  53504. exp: el.elseif,
  53505. block: el
  53506. });
  53507. } else {
  53508. warn$2(
  53509. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53510. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53511. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53512. );
  53513. }
  53514. }
  53515. function findPrevElement (children) {
  53516. var i = children.length;
  53517. while (i--) {
  53518. if (children[i].type === 1) {
  53519. return children[i]
  53520. } else {
  53521. if (children[i].text !== ' ') {
  53522. warn$2(
  53523. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53524. "will be ignored.",
  53525. children[i]
  53526. );
  53527. }
  53528. children.pop();
  53529. }
  53530. }
  53531. }
  53532. function addIfCondition (el, condition) {
  53533. if (!el.ifConditions) {
  53534. el.ifConditions = [];
  53535. }
  53536. el.ifConditions.push(condition);
  53537. }
  53538. function processOnce (el) {
  53539. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53540. if (once$$1 != null) {
  53541. el.once = true;
  53542. }
  53543. }
  53544. // handle content being passed to a component as slot,
  53545. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53546. function processSlotContent (el) {
  53547. var slotScope;
  53548. if (el.tag === 'template') {
  53549. slotScope = getAndRemoveAttr(el, 'scope');
  53550. /* istanbul ignore if */
  53551. if (slotScope) {
  53552. warn$2(
  53553. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53554. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53555. "can also be used on plain elements in addition to <template> to " +
  53556. "denote scoped slots.",
  53557. el.rawAttrsMap['scope'],
  53558. true
  53559. );
  53560. }
  53561. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53562. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53563. /* istanbul ignore if */
  53564. if (el.attrsMap['v-for']) {
  53565. warn$2(
  53566. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53567. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53568. "scoped slot to make it clearer.",
  53569. el.rawAttrsMap['slot-scope'],
  53570. true
  53571. );
  53572. }
  53573. el.slotScope = slotScope;
  53574. }
  53575. // slot="xxx"
  53576. var slotTarget = getBindingAttr(el, 'slot');
  53577. if (slotTarget) {
  53578. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53579. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53580. // preserve slot as an attribute for native shadow DOM compat
  53581. // only for non-scoped slots.
  53582. if (el.tag !== 'template' && !el.slotScope) {
  53583. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53584. }
  53585. }
  53586. // 2.6 v-slot syntax
  53587. {
  53588. if (el.tag === 'template') {
  53589. // v-slot on <template>
  53590. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53591. if (slotBinding) {
  53592. {
  53593. if (el.slotTarget || el.slotScope) {
  53594. warn$2(
  53595. "Unexpected mixed usage of different slot syntaxes.",
  53596. el
  53597. );
  53598. }
  53599. if (el.parent && !maybeComponent(el.parent)) {
  53600. warn$2(
  53601. "<template v-slot> can only appear at the root level inside " +
  53602. "the receiving component",
  53603. el
  53604. );
  53605. }
  53606. }
  53607. var ref = getSlotName(slotBinding);
  53608. var name = ref.name;
  53609. var dynamic = ref.dynamic;
  53610. el.slotTarget = name;
  53611. el.slotTargetDynamic = dynamic;
  53612. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53613. }
  53614. } else {
  53615. // v-slot on component, denotes default slot
  53616. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53617. if (slotBinding$1) {
  53618. {
  53619. if (!maybeComponent(el)) {
  53620. warn$2(
  53621. "v-slot can only be used on components or <template>.",
  53622. slotBinding$1
  53623. );
  53624. }
  53625. if (el.slotScope || el.slotTarget) {
  53626. warn$2(
  53627. "Unexpected mixed usage of different slot syntaxes.",
  53628. el
  53629. );
  53630. }
  53631. if (el.scopedSlots) {
  53632. warn$2(
  53633. "To avoid scope ambiguity, the default slot should also use " +
  53634. "<template> syntax when there are other named slots.",
  53635. slotBinding$1
  53636. );
  53637. }
  53638. }
  53639. // add the component's children to its default slot
  53640. var slots = el.scopedSlots || (el.scopedSlots = {});
  53641. var ref$1 = getSlotName(slotBinding$1);
  53642. var name$1 = ref$1.name;
  53643. var dynamic$1 = ref$1.dynamic;
  53644. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53645. slotContainer.slotTarget = name$1;
  53646. slotContainer.slotTargetDynamic = dynamic$1;
  53647. slotContainer.children = el.children.filter(function (c) {
  53648. if (!c.slotScope) {
  53649. c.parent = slotContainer;
  53650. return true
  53651. }
  53652. });
  53653. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53654. // remove children as they are returned from scopedSlots now
  53655. el.children = [];
  53656. // mark el non-plain so data gets generated
  53657. el.plain = false;
  53658. }
  53659. }
  53660. }
  53661. }
  53662. function getSlotName (binding) {
  53663. var name = binding.name.replace(slotRE, '');
  53664. if (!name) {
  53665. if (binding.name[0] !== '#') {
  53666. name = 'default';
  53667. } else {
  53668. warn$2(
  53669. "v-slot shorthand syntax requires a slot name.",
  53670. binding
  53671. );
  53672. }
  53673. }
  53674. return dynamicArgRE.test(name)
  53675. // dynamic [name]
  53676. ? { name: name.slice(1, -1), dynamic: true }
  53677. // static name
  53678. : { name: ("\"" + name + "\""), dynamic: false }
  53679. }
  53680. // handle <slot/> outlets
  53681. function processSlotOutlet (el) {
  53682. if (el.tag === 'slot') {
  53683. el.slotName = getBindingAttr(el, 'name');
  53684. if (el.key) {
  53685. warn$2(
  53686. "`key` does not work on <slot> because slots are abstract outlets " +
  53687. "and can possibly expand into multiple elements. " +
  53688. "Use the key on a wrapping element instead.",
  53689. getRawBindingAttr(el, 'key')
  53690. );
  53691. }
  53692. }
  53693. }
  53694. function processComponent (el) {
  53695. var binding;
  53696. if ((binding = getBindingAttr(el, 'is'))) {
  53697. el.component = binding;
  53698. }
  53699. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53700. el.inlineTemplate = true;
  53701. }
  53702. }
  53703. function processAttrs (el) {
  53704. var list = el.attrsList;
  53705. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53706. for (i = 0, l = list.length; i < l; i++) {
  53707. name = rawName = list[i].name;
  53708. value = list[i].value;
  53709. if (dirRE.test(name)) {
  53710. // mark element as dynamic
  53711. el.hasBindings = true;
  53712. // modifiers
  53713. modifiers = parseModifiers(name.replace(dirRE, ''));
  53714. // support .foo shorthand syntax for the .prop modifier
  53715. if (modifiers) {
  53716. name = name.replace(modifierRE, '');
  53717. }
  53718. if (bindRE.test(name)) { // v-bind
  53719. name = name.replace(bindRE, '');
  53720. value = parseFilters(value);
  53721. isDynamic = dynamicArgRE.test(name);
  53722. if (isDynamic) {
  53723. name = name.slice(1, -1);
  53724. }
  53725. if (
  53726. value.trim().length === 0
  53727. ) {
  53728. warn$2(
  53729. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53730. );
  53731. }
  53732. if (modifiers) {
  53733. if (modifiers.prop && !isDynamic) {
  53734. name = camelize(name);
  53735. if (name === 'innerHtml') { name = 'innerHTML'; }
  53736. }
  53737. if (modifiers.camel && !isDynamic) {
  53738. name = camelize(name);
  53739. }
  53740. if (modifiers.sync) {
  53741. syncGen = genAssignmentCode(value, "$event");
  53742. if (!isDynamic) {
  53743. addHandler(
  53744. el,
  53745. ("update:" + (camelize(name))),
  53746. syncGen,
  53747. null,
  53748. false,
  53749. warn$2,
  53750. list[i]
  53751. );
  53752. if (hyphenate(name) !== camelize(name)) {
  53753. addHandler(
  53754. el,
  53755. ("update:" + (hyphenate(name))),
  53756. syncGen,
  53757. null,
  53758. false,
  53759. warn$2,
  53760. list[i]
  53761. );
  53762. }
  53763. } else {
  53764. // handler w/ dynamic event name
  53765. addHandler(
  53766. el,
  53767. ("\"update:\"+(" + name + ")"),
  53768. syncGen,
  53769. null,
  53770. false,
  53771. warn$2,
  53772. list[i],
  53773. true // dynamic
  53774. );
  53775. }
  53776. }
  53777. }
  53778. if ((modifiers && modifiers.prop) || (
  53779. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53780. )) {
  53781. addProp(el, name, value, list[i], isDynamic);
  53782. } else {
  53783. addAttr(el, name, value, list[i], isDynamic);
  53784. }
  53785. } else if (onRE.test(name)) { // v-on
  53786. name = name.replace(onRE, '');
  53787. isDynamic = dynamicArgRE.test(name);
  53788. if (isDynamic) {
  53789. name = name.slice(1, -1);
  53790. }
  53791. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53792. } else { // normal directives
  53793. name = name.replace(dirRE, '');
  53794. // parse arg
  53795. var argMatch = name.match(argRE);
  53796. var arg = argMatch && argMatch[1];
  53797. isDynamic = false;
  53798. if (arg) {
  53799. name = name.slice(0, -(arg.length + 1));
  53800. if (dynamicArgRE.test(arg)) {
  53801. arg = arg.slice(1, -1);
  53802. isDynamic = true;
  53803. }
  53804. }
  53805. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53806. if (name === 'model') {
  53807. checkForAliasModel(el, value);
  53808. }
  53809. }
  53810. } else {
  53811. // literal attribute
  53812. {
  53813. var res = parseText(value, delimiters);
  53814. if (res) {
  53815. warn$2(
  53816. name + "=\"" + value + "\": " +
  53817. 'Interpolation inside attributes has been removed. ' +
  53818. 'Use v-bind or the colon shorthand instead. For example, ' +
  53819. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53820. list[i]
  53821. );
  53822. }
  53823. }
  53824. addAttr(el, name, JSON.stringify(value), list[i]);
  53825. // #6887 firefox doesn't update muted state if set via attribute
  53826. // even immediately after element creation
  53827. if (!el.component &&
  53828. name === 'muted' &&
  53829. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53830. addProp(el, name, 'true', list[i]);
  53831. }
  53832. }
  53833. }
  53834. }
  53835. function checkInFor (el) {
  53836. var parent = el;
  53837. while (parent) {
  53838. if (parent.for !== undefined) {
  53839. return true
  53840. }
  53841. parent = parent.parent;
  53842. }
  53843. return false
  53844. }
  53845. function parseModifiers (name) {
  53846. var match = name.match(modifierRE);
  53847. if (match) {
  53848. var ret = {};
  53849. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53850. return ret
  53851. }
  53852. }
  53853. function makeAttrsMap (attrs) {
  53854. var map = {};
  53855. for (var i = 0, l = attrs.length; i < l; i++) {
  53856. if (
  53857. map[attrs[i].name] && !isIE && !isEdge
  53858. ) {
  53859. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53860. }
  53861. map[attrs[i].name] = attrs[i].value;
  53862. }
  53863. return map
  53864. }
  53865. // for script (e.g. type="x/template") or style, do not decode content
  53866. function isTextTag (el) {
  53867. return el.tag === 'script' || el.tag === 'style'
  53868. }
  53869. function isForbiddenTag (el) {
  53870. return (
  53871. el.tag === 'style' ||
  53872. (el.tag === 'script' && (
  53873. !el.attrsMap.type ||
  53874. el.attrsMap.type === 'text/javascript'
  53875. ))
  53876. )
  53877. }
  53878. var ieNSBug = /^xmlns:NS\d+/;
  53879. var ieNSPrefix = /^NS\d+:/;
  53880. /* istanbul ignore next */
  53881. function guardIESVGBug (attrs) {
  53882. var res = [];
  53883. for (var i = 0; i < attrs.length; i++) {
  53884. var attr = attrs[i];
  53885. if (!ieNSBug.test(attr.name)) {
  53886. attr.name = attr.name.replace(ieNSPrefix, '');
  53887. res.push(attr);
  53888. }
  53889. }
  53890. return res
  53891. }
  53892. function checkForAliasModel (el, value) {
  53893. var _el = el;
  53894. while (_el) {
  53895. if (_el.for && _el.alias === value) {
  53896. warn$2(
  53897. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53898. "You are binding v-model directly to a v-for iteration alias. " +
  53899. "This will not be able to modify the v-for source array because " +
  53900. "writing to the alias is like modifying a function local variable. " +
  53901. "Consider using an array of objects and use v-model on an object property instead.",
  53902. el.rawAttrsMap['v-model']
  53903. );
  53904. }
  53905. _el = _el.parent;
  53906. }
  53907. }
  53908. /* */
  53909. function preTransformNode (el, options) {
  53910. if (el.tag === 'input') {
  53911. var map = el.attrsMap;
  53912. if (!map['v-model']) {
  53913. return
  53914. }
  53915. var typeBinding;
  53916. if (map[':type'] || map['v-bind:type']) {
  53917. typeBinding = getBindingAttr(el, 'type');
  53918. }
  53919. if (!map.type && !typeBinding && map['v-bind']) {
  53920. typeBinding = "(" + (map['v-bind']) + ").type";
  53921. }
  53922. if (typeBinding) {
  53923. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53924. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53925. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53926. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53927. // 1. checkbox
  53928. var branch0 = cloneASTElement(el);
  53929. // process for on the main node
  53930. processFor(branch0);
  53931. addRawAttr(branch0, 'type', 'checkbox');
  53932. processElement(branch0, options);
  53933. branch0.processed = true; // prevent it from double-processed
  53934. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53935. addIfCondition(branch0, {
  53936. exp: branch0.if,
  53937. block: branch0
  53938. });
  53939. // 2. add radio else-if condition
  53940. var branch1 = cloneASTElement(el);
  53941. getAndRemoveAttr(branch1, 'v-for', true);
  53942. addRawAttr(branch1, 'type', 'radio');
  53943. processElement(branch1, options);
  53944. addIfCondition(branch0, {
  53945. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53946. block: branch1
  53947. });
  53948. // 3. other
  53949. var branch2 = cloneASTElement(el);
  53950. getAndRemoveAttr(branch2, 'v-for', true);
  53951. addRawAttr(branch2, ':type', typeBinding);
  53952. processElement(branch2, options);
  53953. addIfCondition(branch0, {
  53954. exp: ifCondition,
  53955. block: branch2
  53956. });
  53957. if (hasElse) {
  53958. branch0.else = true;
  53959. } else if (elseIfCondition) {
  53960. branch0.elseif = elseIfCondition;
  53961. }
  53962. return branch0
  53963. }
  53964. }
  53965. }
  53966. function cloneASTElement (el) {
  53967. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53968. }
  53969. var model$1 = {
  53970. preTransformNode: preTransformNode
  53971. };
  53972. var modules$1 = [
  53973. klass$1,
  53974. style$1,
  53975. model$1
  53976. ];
  53977. /* */
  53978. function text (el, dir) {
  53979. if (dir.value) {
  53980. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53981. }
  53982. }
  53983. /* */
  53984. function html (el, dir) {
  53985. if (dir.value) {
  53986. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53987. }
  53988. }
  53989. var directives$1 = {
  53990. model: model,
  53991. text: text,
  53992. html: html
  53993. };
  53994. /* */
  53995. var baseOptions = {
  53996. expectHTML: true,
  53997. modules: modules$1,
  53998. directives: directives$1,
  53999. isPreTag: isPreTag,
  54000. isUnaryTag: isUnaryTag,
  54001. mustUseProp: mustUseProp,
  54002. canBeLeftOpenTag: canBeLeftOpenTag,
  54003. isReservedTag: isReservedTag,
  54004. getTagNamespace: getTagNamespace,
  54005. staticKeys: genStaticKeys(modules$1)
  54006. };
  54007. /* */
  54008. var isStaticKey;
  54009. var isPlatformReservedTag;
  54010. var genStaticKeysCached = cached(genStaticKeys$1);
  54011. /**
  54012. * Goal of the optimizer: walk the generated template AST tree
  54013. * and detect sub-trees that are purely static, i.e. parts of
  54014. * the DOM that never needs to change.
  54015. *
  54016. * Once we detect these sub-trees, we can:
  54017. *
  54018. * 1. Hoist them into constants, so that we no longer need to
  54019. * create fresh nodes for them on each re-render;
  54020. * 2. Completely skip them in the patching process.
  54021. */
  54022. function optimize (root, options) {
  54023. if (!root) { return }
  54024. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54025. isPlatformReservedTag = options.isReservedTag || no;
  54026. // first pass: mark all non-static nodes.
  54027. markStatic$1(root);
  54028. // second pass: mark static roots.
  54029. markStaticRoots(root, false);
  54030. }
  54031. function genStaticKeys$1 (keys) {
  54032. return makeMap(
  54033. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54034. (keys ? ',' + keys : '')
  54035. )
  54036. }
  54037. function markStatic$1 (node) {
  54038. node.static = isStatic(node);
  54039. if (node.type === 1) {
  54040. // do not make component slot content static. this avoids
  54041. // 1. components not able to mutate slot nodes
  54042. // 2. static slot content fails for hot-reloading
  54043. if (
  54044. !isPlatformReservedTag(node.tag) &&
  54045. node.tag !== 'slot' &&
  54046. node.attrsMap['inline-template'] == null
  54047. ) {
  54048. return
  54049. }
  54050. for (var i = 0, l = node.children.length; i < l; i++) {
  54051. var child = node.children[i];
  54052. markStatic$1(child);
  54053. if (!child.static) {
  54054. node.static = false;
  54055. }
  54056. }
  54057. if (node.ifConditions) {
  54058. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54059. var block = node.ifConditions[i$1].block;
  54060. markStatic$1(block);
  54061. if (!block.static) {
  54062. node.static = false;
  54063. }
  54064. }
  54065. }
  54066. }
  54067. }
  54068. function markStaticRoots (node, isInFor) {
  54069. if (node.type === 1) {
  54070. if (node.static || node.once) {
  54071. node.staticInFor = isInFor;
  54072. }
  54073. // For a node to qualify as a static root, it should have children that
  54074. // are not just static text. Otherwise the cost of hoisting out will
  54075. // outweigh the benefits and it's better off to just always render it fresh.
  54076. if (node.static && node.children.length && !(
  54077. node.children.length === 1 &&
  54078. node.children[0].type === 3
  54079. )) {
  54080. node.staticRoot = true;
  54081. return
  54082. } else {
  54083. node.staticRoot = false;
  54084. }
  54085. if (node.children) {
  54086. for (var i = 0, l = node.children.length; i < l; i++) {
  54087. markStaticRoots(node.children[i], isInFor || !!node.for);
  54088. }
  54089. }
  54090. if (node.ifConditions) {
  54091. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54092. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54093. }
  54094. }
  54095. }
  54096. }
  54097. function isStatic (node) {
  54098. if (node.type === 2) { // expression
  54099. return false
  54100. }
  54101. if (node.type === 3) { // text
  54102. return true
  54103. }
  54104. return !!(node.pre || (
  54105. !node.hasBindings && // no dynamic bindings
  54106. !node.if && !node.for && // not v-if or v-for or v-else
  54107. !isBuiltInTag(node.tag) && // not a built-in
  54108. isPlatformReservedTag(node.tag) && // not a component
  54109. !isDirectChildOfTemplateFor(node) &&
  54110. Object.keys(node).every(isStaticKey)
  54111. ))
  54112. }
  54113. function isDirectChildOfTemplateFor (node) {
  54114. while (node.parent) {
  54115. node = node.parent;
  54116. if (node.tag !== 'template') {
  54117. return false
  54118. }
  54119. if (node.for) {
  54120. return true
  54121. }
  54122. }
  54123. return false
  54124. }
  54125. /* */
  54126. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54127. var fnInvokeRE = /\([^)]*?\);*$/;
  54128. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54129. // KeyboardEvent.keyCode aliases
  54130. var keyCodes = {
  54131. esc: 27,
  54132. tab: 9,
  54133. enter: 13,
  54134. space: 32,
  54135. up: 38,
  54136. left: 37,
  54137. right: 39,
  54138. down: 40,
  54139. 'delete': [8, 46]
  54140. };
  54141. // KeyboardEvent.key aliases
  54142. var keyNames = {
  54143. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54144. esc: ['Esc', 'Escape'],
  54145. tab: 'Tab',
  54146. enter: 'Enter',
  54147. // #9112: IE11 uses `Spacebar` for Space key name.
  54148. space: [' ', 'Spacebar'],
  54149. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54150. up: ['Up', 'ArrowUp'],
  54151. left: ['Left', 'ArrowLeft'],
  54152. right: ['Right', 'ArrowRight'],
  54153. down: ['Down', 'ArrowDown'],
  54154. // #9112: IE11 uses `Del` for Delete key name.
  54155. 'delete': ['Backspace', 'Delete', 'Del']
  54156. };
  54157. // #4868: modifiers that prevent the execution of the listener
  54158. // need to explicitly return null so that we can determine whether to remove
  54159. // the listener for .once
  54160. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54161. var modifierCode = {
  54162. stop: '$event.stopPropagation();',
  54163. prevent: '$event.preventDefault();',
  54164. self: genGuard("$event.target !== $event.currentTarget"),
  54165. ctrl: genGuard("!$event.ctrlKey"),
  54166. shift: genGuard("!$event.shiftKey"),
  54167. alt: genGuard("!$event.altKey"),
  54168. meta: genGuard("!$event.metaKey"),
  54169. left: genGuard("'button' in $event && $event.button !== 0"),
  54170. middle: genGuard("'button' in $event && $event.button !== 1"),
  54171. right: genGuard("'button' in $event && $event.button !== 2")
  54172. };
  54173. function genHandlers (
  54174. events,
  54175. isNative
  54176. ) {
  54177. var prefix = isNative ? 'nativeOn:' : 'on:';
  54178. var staticHandlers = "";
  54179. var dynamicHandlers = "";
  54180. for (var name in events) {
  54181. var handlerCode = genHandler(events[name]);
  54182. if (events[name] && events[name].dynamic) {
  54183. dynamicHandlers += name + "," + handlerCode + ",";
  54184. } else {
  54185. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54186. }
  54187. }
  54188. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54189. if (dynamicHandlers) {
  54190. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54191. } else {
  54192. return prefix + staticHandlers
  54193. }
  54194. }
  54195. function genHandler (handler) {
  54196. if (!handler) {
  54197. return 'function(){}'
  54198. }
  54199. if (Array.isArray(handler)) {
  54200. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54201. }
  54202. var isMethodPath = simplePathRE.test(handler.value);
  54203. var isFunctionExpression = fnExpRE.test(handler.value);
  54204. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54205. if (!handler.modifiers) {
  54206. if (isMethodPath || isFunctionExpression) {
  54207. return handler.value
  54208. }
  54209. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54210. } else {
  54211. var code = '';
  54212. var genModifierCode = '';
  54213. var keys = [];
  54214. for (var key in handler.modifiers) {
  54215. if (modifierCode[key]) {
  54216. genModifierCode += modifierCode[key];
  54217. // left/right
  54218. if (keyCodes[key]) {
  54219. keys.push(key);
  54220. }
  54221. } else if (key === 'exact') {
  54222. var modifiers = (handler.modifiers);
  54223. genModifierCode += genGuard(
  54224. ['ctrl', 'shift', 'alt', 'meta']
  54225. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54226. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54227. .join('||')
  54228. );
  54229. } else {
  54230. keys.push(key);
  54231. }
  54232. }
  54233. if (keys.length) {
  54234. code += genKeyFilter(keys);
  54235. }
  54236. // Make sure modifiers like prevent and stop get executed after key filtering
  54237. if (genModifierCode) {
  54238. code += genModifierCode;
  54239. }
  54240. var handlerCode = isMethodPath
  54241. ? ("return " + (handler.value) + "($event)")
  54242. : isFunctionExpression
  54243. ? ("return (" + (handler.value) + ")($event)")
  54244. : isFunctionInvocation
  54245. ? ("return " + (handler.value))
  54246. : handler.value;
  54247. return ("function($event){" + code + handlerCode + "}")
  54248. }
  54249. }
  54250. function genKeyFilter (keys) {
  54251. return (
  54252. // make sure the key filters only apply to KeyboardEvents
  54253. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54254. // key events that do not have keyCode property...
  54255. "if(!$event.type.indexOf('key')&&" +
  54256. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54257. )
  54258. }
  54259. function genFilterCode (key) {
  54260. var keyVal = parseInt(key, 10);
  54261. if (keyVal) {
  54262. return ("$event.keyCode!==" + keyVal)
  54263. }
  54264. var keyCode = keyCodes[key];
  54265. var keyName = keyNames[key];
  54266. return (
  54267. "_k($event.keyCode," +
  54268. (JSON.stringify(key)) + "," +
  54269. (JSON.stringify(keyCode)) + "," +
  54270. "$event.key," +
  54271. "" + (JSON.stringify(keyName)) +
  54272. ")"
  54273. )
  54274. }
  54275. /* */
  54276. function on (el, dir) {
  54277. if (dir.modifiers) {
  54278. warn("v-on without argument does not support modifiers.");
  54279. }
  54280. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54281. }
  54282. /* */
  54283. function bind$1 (el, dir) {
  54284. el.wrapData = function (code) {
  54285. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54286. };
  54287. }
  54288. /* */
  54289. var baseDirectives = {
  54290. on: on,
  54291. bind: bind$1,
  54292. cloak: noop
  54293. };
  54294. /* */
  54295. var CodegenState = function CodegenState (options) {
  54296. this.options = options;
  54297. this.warn = options.warn || baseWarn;
  54298. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54299. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54300. this.directives = extend(extend({}, baseDirectives), options.directives);
  54301. var isReservedTag = options.isReservedTag || no;
  54302. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54303. this.onceId = 0;
  54304. this.staticRenderFns = [];
  54305. this.pre = false;
  54306. };
  54307. function generate (
  54308. ast,
  54309. options
  54310. ) {
  54311. var state = new CodegenState(options);
  54312. var code = ast ? genElement(ast, state) : '_c("div")';
  54313. return {
  54314. render: ("with(this){return " + code + "}"),
  54315. staticRenderFns: state.staticRenderFns
  54316. }
  54317. }
  54318. function genElement (el, state) {
  54319. if (el.parent) {
  54320. el.pre = el.pre || el.parent.pre;
  54321. }
  54322. if (el.staticRoot && !el.staticProcessed) {
  54323. return genStatic(el, state)
  54324. } else if (el.once && !el.onceProcessed) {
  54325. return genOnce(el, state)
  54326. } else if (el.for && !el.forProcessed) {
  54327. return genFor(el, state)
  54328. } else if (el.if && !el.ifProcessed) {
  54329. return genIf(el, state)
  54330. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54331. return genChildren(el, state) || 'void 0'
  54332. } else if (el.tag === 'slot') {
  54333. return genSlot(el, state)
  54334. } else {
  54335. // component or element
  54336. var code;
  54337. if (el.component) {
  54338. code = genComponent(el.component, el, state);
  54339. } else {
  54340. var data;
  54341. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54342. data = genData$2(el, state);
  54343. }
  54344. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54345. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54346. }
  54347. // module transforms
  54348. for (var i = 0; i < state.transforms.length; i++) {
  54349. code = state.transforms[i](el, code);
  54350. }
  54351. return code
  54352. }
  54353. }
  54354. // hoist static sub-trees out
  54355. function genStatic (el, state) {
  54356. el.staticProcessed = true;
  54357. // Some elements (templates) need to behave differently inside of a v-pre
  54358. // node. All pre nodes are static roots, so we can use this as a location to
  54359. // wrap a state change and reset it upon exiting the pre node.
  54360. var originalPreState = state.pre;
  54361. if (el.pre) {
  54362. state.pre = el.pre;
  54363. }
  54364. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54365. state.pre = originalPreState;
  54366. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54367. }
  54368. // v-once
  54369. function genOnce (el, state) {
  54370. el.onceProcessed = true;
  54371. if (el.if && !el.ifProcessed) {
  54372. return genIf(el, state)
  54373. } else if (el.staticInFor) {
  54374. var key = '';
  54375. var parent = el.parent;
  54376. while (parent) {
  54377. if (parent.for) {
  54378. key = parent.key;
  54379. break
  54380. }
  54381. parent = parent.parent;
  54382. }
  54383. if (!key) {
  54384. state.warn(
  54385. "v-once can only be used inside v-for that is keyed. ",
  54386. el.rawAttrsMap['v-once']
  54387. );
  54388. return genElement(el, state)
  54389. }
  54390. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54391. } else {
  54392. return genStatic(el, state)
  54393. }
  54394. }
  54395. function genIf (
  54396. el,
  54397. state,
  54398. altGen,
  54399. altEmpty
  54400. ) {
  54401. el.ifProcessed = true; // avoid recursion
  54402. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54403. }
  54404. function genIfConditions (
  54405. conditions,
  54406. state,
  54407. altGen,
  54408. altEmpty
  54409. ) {
  54410. if (!conditions.length) {
  54411. return altEmpty || '_e()'
  54412. }
  54413. var condition = conditions.shift();
  54414. if (condition.exp) {
  54415. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54416. } else {
  54417. return ("" + (genTernaryExp(condition.block)))
  54418. }
  54419. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54420. function genTernaryExp (el) {
  54421. return altGen
  54422. ? altGen(el, state)
  54423. : el.once
  54424. ? genOnce(el, state)
  54425. : genElement(el, state)
  54426. }
  54427. }
  54428. function genFor (
  54429. el,
  54430. state,
  54431. altGen,
  54432. altHelper
  54433. ) {
  54434. var exp = el.for;
  54435. var alias = el.alias;
  54436. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54437. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54438. if (state.maybeComponent(el) &&
  54439. el.tag !== 'slot' &&
  54440. el.tag !== 'template' &&
  54441. !el.key
  54442. ) {
  54443. state.warn(
  54444. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54445. "v-for should have explicit keys. " +
  54446. "See https://vuejs.org/guide/list.html#key for more info.",
  54447. el.rawAttrsMap['v-for'],
  54448. true /* tip */
  54449. );
  54450. }
  54451. el.forProcessed = true; // avoid recursion
  54452. return (altHelper || '_l') + "((" + exp + ")," +
  54453. "function(" + alias + iterator1 + iterator2 + "){" +
  54454. "return " + ((altGen || genElement)(el, state)) +
  54455. '})'
  54456. }
  54457. function genData$2 (el, state) {
  54458. var data = '{';
  54459. // directives first.
  54460. // directives may mutate the el's other properties before they are generated.
  54461. var dirs = genDirectives(el, state);
  54462. if (dirs) { data += dirs + ','; }
  54463. // key
  54464. if (el.key) {
  54465. data += "key:" + (el.key) + ",";
  54466. }
  54467. // ref
  54468. if (el.ref) {
  54469. data += "ref:" + (el.ref) + ",";
  54470. }
  54471. if (el.refInFor) {
  54472. data += "refInFor:true,";
  54473. }
  54474. // pre
  54475. if (el.pre) {
  54476. data += "pre:true,";
  54477. }
  54478. // record original tag name for components using "is" attribute
  54479. if (el.component) {
  54480. data += "tag:\"" + (el.tag) + "\",";
  54481. }
  54482. // module data generation functions
  54483. for (var i = 0; i < state.dataGenFns.length; i++) {
  54484. data += state.dataGenFns[i](el);
  54485. }
  54486. // attributes
  54487. if (el.attrs) {
  54488. data += "attrs:" + (genProps(el.attrs)) + ",";
  54489. }
  54490. // DOM props
  54491. if (el.props) {
  54492. data += "domProps:" + (genProps(el.props)) + ",";
  54493. }
  54494. // event handlers
  54495. if (el.events) {
  54496. data += (genHandlers(el.events, false)) + ",";
  54497. }
  54498. if (el.nativeEvents) {
  54499. data += (genHandlers(el.nativeEvents, true)) + ",";
  54500. }
  54501. // slot target
  54502. // only for non-scoped slots
  54503. if (el.slotTarget && !el.slotScope) {
  54504. data += "slot:" + (el.slotTarget) + ",";
  54505. }
  54506. // scoped slots
  54507. if (el.scopedSlots) {
  54508. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54509. }
  54510. // component v-model
  54511. if (el.model) {
  54512. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54513. }
  54514. // inline-template
  54515. if (el.inlineTemplate) {
  54516. var inlineTemplate = genInlineTemplate(el, state);
  54517. if (inlineTemplate) {
  54518. data += inlineTemplate + ",";
  54519. }
  54520. }
  54521. data = data.replace(/,$/, '') + '}';
  54522. // v-bind dynamic argument wrap
  54523. // v-bind with dynamic arguments must be applied using the same v-bind object
  54524. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54525. if (el.dynamicAttrs) {
  54526. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54527. }
  54528. // v-bind data wrap
  54529. if (el.wrapData) {
  54530. data = el.wrapData(data);
  54531. }
  54532. // v-on data wrap
  54533. if (el.wrapListeners) {
  54534. data = el.wrapListeners(data);
  54535. }
  54536. return data
  54537. }
  54538. function genDirectives (el, state) {
  54539. var dirs = el.directives;
  54540. if (!dirs) { return }
  54541. var res = 'directives:[';
  54542. var hasRuntime = false;
  54543. var i, l, dir, needRuntime;
  54544. for (i = 0, l = dirs.length; i < l; i++) {
  54545. dir = dirs[i];
  54546. needRuntime = true;
  54547. var gen = state.directives[dir.name];
  54548. if (gen) {
  54549. // compile-time directive that manipulates AST.
  54550. // returns true if it also needs a runtime counterpart.
  54551. needRuntime = !!gen(el, dir, state.warn);
  54552. }
  54553. if (needRuntime) {
  54554. hasRuntime = true;
  54555. 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))) : '') + "},";
  54556. }
  54557. }
  54558. if (hasRuntime) {
  54559. return res.slice(0, -1) + ']'
  54560. }
  54561. }
  54562. function genInlineTemplate (el, state) {
  54563. var ast = el.children[0];
  54564. if (el.children.length !== 1 || ast.type !== 1) {
  54565. state.warn(
  54566. 'Inline-template components must have exactly one child element.',
  54567. { start: el.start }
  54568. );
  54569. }
  54570. if (ast && ast.type === 1) {
  54571. var inlineRenderFns = generate(ast, state.options);
  54572. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54573. }
  54574. }
  54575. function genScopedSlots (
  54576. el,
  54577. slots,
  54578. state
  54579. ) {
  54580. // by default scoped slots are considered "stable", this allows child
  54581. // components with only scoped slots to skip forced updates from parent.
  54582. // but in some cases we have to bail-out of this optimization
  54583. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54584. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54585. var slot = slots[key];
  54586. return (
  54587. slot.slotTargetDynamic ||
  54588. slot.if ||
  54589. slot.for ||
  54590. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54591. )
  54592. });
  54593. // #9534: if a component with scoped slots is inside a conditional branch,
  54594. // it's possible for the same component to be reused but with different
  54595. // compiled slot content. To avoid that, we generate a unique key based on
  54596. // the generated code of all the slot contents.
  54597. var needsKey = !!el.if;
  54598. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54599. // disconnected due to the intermediate scope variable)
  54600. // #9438, #9506
  54601. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54602. // and skip force updating ones that do not actually use scope variables.
  54603. if (!needsForceUpdate) {
  54604. var parent = el.parent;
  54605. while (parent) {
  54606. if (
  54607. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54608. parent.for
  54609. ) {
  54610. needsForceUpdate = true;
  54611. break
  54612. }
  54613. if (parent.if) {
  54614. needsKey = true;
  54615. }
  54616. parent = parent.parent;
  54617. }
  54618. }
  54619. var generatedSlots = Object.keys(slots)
  54620. .map(function (key) { return genScopedSlot(slots[key], state); })
  54621. .join(',');
  54622. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54623. }
  54624. function hash(str) {
  54625. var hash = 5381;
  54626. var i = str.length;
  54627. while(i) {
  54628. hash = (hash * 33) ^ str.charCodeAt(--i);
  54629. }
  54630. return hash >>> 0
  54631. }
  54632. function containsSlotChild (el) {
  54633. if (el.type === 1) {
  54634. if (el.tag === 'slot') {
  54635. return true
  54636. }
  54637. return el.children.some(containsSlotChild)
  54638. }
  54639. return false
  54640. }
  54641. function genScopedSlot (
  54642. el,
  54643. state
  54644. ) {
  54645. var isLegacySyntax = el.attrsMap['slot-scope'];
  54646. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54647. return genIf(el, state, genScopedSlot, "null")
  54648. }
  54649. if (el.for && !el.forProcessed) {
  54650. return genFor(el, state, genScopedSlot)
  54651. }
  54652. var slotScope = el.slotScope === emptySlotScopeToken
  54653. ? ""
  54654. : String(el.slotScope);
  54655. var fn = "function(" + slotScope + "){" +
  54656. "return " + (el.tag === 'template'
  54657. ? el.if && isLegacySyntax
  54658. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54659. : genChildren(el, state) || 'undefined'
  54660. : genElement(el, state)) + "}";
  54661. // reverse proxy v-slot without scope on this.$slots
  54662. var reverseProxy = slotScope ? "" : ",proxy:true";
  54663. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54664. }
  54665. function genChildren (
  54666. el,
  54667. state,
  54668. checkSkip,
  54669. altGenElement,
  54670. altGenNode
  54671. ) {
  54672. var children = el.children;
  54673. if (children.length) {
  54674. var el$1 = children[0];
  54675. // optimize single v-for
  54676. if (children.length === 1 &&
  54677. el$1.for &&
  54678. el$1.tag !== 'template' &&
  54679. el$1.tag !== 'slot'
  54680. ) {
  54681. var normalizationType = checkSkip
  54682. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54683. : "";
  54684. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54685. }
  54686. var normalizationType$1 = checkSkip
  54687. ? getNormalizationType(children, state.maybeComponent)
  54688. : 0;
  54689. var gen = altGenNode || genNode;
  54690. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54691. }
  54692. }
  54693. // determine the normalization needed for the children array.
  54694. // 0: no normalization needed
  54695. // 1: simple normalization needed (possible 1-level deep nested array)
  54696. // 2: full normalization needed
  54697. function getNormalizationType (
  54698. children,
  54699. maybeComponent
  54700. ) {
  54701. var res = 0;
  54702. for (var i = 0; i < children.length; i++) {
  54703. var el = children[i];
  54704. if (el.type !== 1) {
  54705. continue
  54706. }
  54707. if (needsNormalization(el) ||
  54708. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54709. res = 2;
  54710. break
  54711. }
  54712. if (maybeComponent(el) ||
  54713. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54714. res = 1;
  54715. }
  54716. }
  54717. return res
  54718. }
  54719. function needsNormalization (el) {
  54720. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54721. }
  54722. function genNode (node, state) {
  54723. if (node.type === 1) {
  54724. return genElement(node, state)
  54725. } else if (node.type === 3 && node.isComment) {
  54726. return genComment(node)
  54727. } else {
  54728. return genText(node)
  54729. }
  54730. }
  54731. function genText (text) {
  54732. return ("_v(" + (text.type === 2
  54733. ? text.expression // no need for () because already wrapped in _s()
  54734. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54735. }
  54736. function genComment (comment) {
  54737. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54738. }
  54739. function genSlot (el, state) {
  54740. var slotName = el.slotName || '"default"';
  54741. var children = genChildren(el, state);
  54742. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54743. var attrs = el.attrs || el.dynamicAttrs
  54744. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54745. // slot props are camelized
  54746. name: camelize(attr.name),
  54747. value: attr.value,
  54748. dynamic: attr.dynamic
  54749. }); }))
  54750. : null;
  54751. var bind$$1 = el.attrsMap['v-bind'];
  54752. if ((attrs || bind$$1) && !children) {
  54753. res += ",null";
  54754. }
  54755. if (attrs) {
  54756. res += "," + attrs;
  54757. }
  54758. if (bind$$1) {
  54759. res += (attrs ? '' : ',null') + "," + bind$$1;
  54760. }
  54761. return res + ')'
  54762. }
  54763. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54764. function genComponent (
  54765. componentName,
  54766. el,
  54767. state
  54768. ) {
  54769. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54770. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54771. }
  54772. function genProps (props) {
  54773. var staticProps = "";
  54774. var dynamicProps = "";
  54775. for (var i = 0; i < props.length; i++) {
  54776. var prop = props[i];
  54777. var value = transformSpecialNewlines(prop.value);
  54778. if (prop.dynamic) {
  54779. dynamicProps += (prop.name) + "," + value + ",";
  54780. } else {
  54781. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54782. }
  54783. }
  54784. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54785. if (dynamicProps) {
  54786. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54787. } else {
  54788. return staticProps
  54789. }
  54790. }
  54791. // #3895, #4268
  54792. function transformSpecialNewlines (text) {
  54793. return text
  54794. .replace(/\u2028/g, '\\u2028')
  54795. .replace(/\u2029/g, '\\u2029')
  54796. }
  54797. /* */
  54798. // these keywords should not appear inside expressions, but operators like
  54799. // typeof, instanceof and in are allowed
  54800. var prohibitedKeywordRE = new RegExp('\\b' + (
  54801. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54802. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54803. 'extends,finally,continue,debugger,function,arguments'
  54804. ).split(',').join('\\b|\\b') + '\\b');
  54805. // these unary operators should not be used as property/method names
  54806. var unaryOperatorsRE = new RegExp('\\b' + (
  54807. 'delete,typeof,void'
  54808. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54809. // strip strings in expressions
  54810. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54811. // detect problematic expressions in a template
  54812. function detectErrors (ast, warn) {
  54813. if (ast) {
  54814. checkNode(ast, warn);
  54815. }
  54816. }
  54817. function checkNode (node, warn) {
  54818. if (node.type === 1) {
  54819. for (var name in node.attrsMap) {
  54820. if (dirRE.test(name)) {
  54821. var value = node.attrsMap[name];
  54822. if (value) {
  54823. var range = node.rawAttrsMap[name];
  54824. if (name === 'v-for') {
  54825. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54826. } else if (name === 'v-slot' || name[0] === '#') {
  54827. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54828. } else if (onRE.test(name)) {
  54829. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54830. } else {
  54831. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54832. }
  54833. }
  54834. }
  54835. }
  54836. if (node.children) {
  54837. for (var i = 0; i < node.children.length; i++) {
  54838. checkNode(node.children[i], warn);
  54839. }
  54840. }
  54841. } else if (node.type === 2) {
  54842. checkExpression(node.expression, node.text, warn, node);
  54843. }
  54844. }
  54845. function checkEvent (exp, text, warn, range) {
  54846. var stripped = exp.replace(stripStringRE, '');
  54847. var keywordMatch = stripped.match(unaryOperatorsRE);
  54848. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54849. warn(
  54850. "avoid using JavaScript unary operator as property name: " +
  54851. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54852. range
  54853. );
  54854. }
  54855. checkExpression(exp, text, warn, range);
  54856. }
  54857. function checkFor (node, text, warn, range) {
  54858. checkExpression(node.for || '', text, warn, range);
  54859. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54860. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54861. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54862. }
  54863. function checkIdentifier (
  54864. ident,
  54865. type,
  54866. text,
  54867. warn,
  54868. range
  54869. ) {
  54870. if (typeof ident === 'string') {
  54871. try {
  54872. new Function(("var " + ident + "=_"));
  54873. } catch (e) {
  54874. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54875. }
  54876. }
  54877. }
  54878. function checkExpression (exp, text, warn, range) {
  54879. try {
  54880. new Function(("return " + exp));
  54881. } catch (e) {
  54882. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54883. if (keywordMatch) {
  54884. warn(
  54885. "avoid using JavaScript keyword as property name: " +
  54886. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54887. range
  54888. );
  54889. } else {
  54890. warn(
  54891. "invalid expression: " + (e.message) + " in\n\n" +
  54892. " " + exp + "\n\n" +
  54893. " Raw expression: " + (text.trim()) + "\n",
  54894. range
  54895. );
  54896. }
  54897. }
  54898. }
  54899. function checkFunctionParameterExpression (exp, text, warn, range) {
  54900. try {
  54901. new Function(exp, '');
  54902. } catch (e) {
  54903. warn(
  54904. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54905. " " + exp + "\n\n" +
  54906. " Raw expression: " + (text.trim()) + "\n",
  54907. range
  54908. );
  54909. }
  54910. }
  54911. /* */
  54912. var range = 2;
  54913. function generateCodeFrame (
  54914. source,
  54915. start,
  54916. end
  54917. ) {
  54918. if ( start === void 0 ) start = 0;
  54919. if ( end === void 0 ) end = source.length;
  54920. var lines = source.split(/\r?\n/);
  54921. var count = 0;
  54922. var res = [];
  54923. for (var i = 0; i < lines.length; i++) {
  54924. count += lines[i].length + 1;
  54925. if (count >= start) {
  54926. for (var j = i - range; j <= i + range || end > count; j++) {
  54927. if (j < 0 || j >= lines.length) { continue }
  54928. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54929. var lineLength = lines[j].length;
  54930. if (j === i) {
  54931. // push underline
  54932. var pad = start - (count - lineLength) + 1;
  54933. var length = end > count ? lineLength - pad : end - start;
  54934. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54935. } else if (j > i) {
  54936. if (end > count) {
  54937. var length$1 = Math.min(end - count, lineLength);
  54938. res.push(" | " + repeat$1("^", length$1));
  54939. }
  54940. count += lineLength + 1;
  54941. }
  54942. }
  54943. break
  54944. }
  54945. }
  54946. return res.join('\n')
  54947. }
  54948. function repeat$1 (str, n) {
  54949. var result = '';
  54950. if (n > 0) {
  54951. while (true) { // eslint-disable-line
  54952. if (n & 1) { result += str; }
  54953. n >>>= 1;
  54954. if (n <= 0) { break }
  54955. str += str;
  54956. }
  54957. }
  54958. return result
  54959. }
  54960. /* */
  54961. function createFunction (code, errors) {
  54962. try {
  54963. return new Function(code)
  54964. } catch (err) {
  54965. errors.push({ err: err, code: code });
  54966. return noop
  54967. }
  54968. }
  54969. function createCompileToFunctionFn (compile) {
  54970. var cache = Object.create(null);
  54971. return function compileToFunctions (
  54972. template,
  54973. options,
  54974. vm
  54975. ) {
  54976. options = extend({}, options);
  54977. var warn$$1 = options.warn || warn;
  54978. delete options.warn;
  54979. /* istanbul ignore if */
  54980. {
  54981. // detect possible CSP restriction
  54982. try {
  54983. new Function('return 1');
  54984. } catch (e) {
  54985. if (e.toString().match(/unsafe-eval|CSP/)) {
  54986. warn$$1(
  54987. 'It seems you are using the standalone build of Vue.js in an ' +
  54988. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54989. 'The template compiler cannot work in this environment. Consider ' +
  54990. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54991. 'templates into render functions.'
  54992. );
  54993. }
  54994. }
  54995. }
  54996. // check cache
  54997. var key = options.delimiters
  54998. ? String(options.delimiters) + template
  54999. : template;
  55000. if (cache[key]) {
  55001. return cache[key]
  55002. }
  55003. // compile
  55004. var compiled = compile(template, options);
  55005. // check compilation errors/tips
  55006. {
  55007. if (compiled.errors && compiled.errors.length) {
  55008. if (options.outputSourceRange) {
  55009. compiled.errors.forEach(function (e) {
  55010. warn$$1(
  55011. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55012. generateCodeFrame(template, e.start, e.end),
  55013. vm
  55014. );
  55015. });
  55016. } else {
  55017. warn$$1(
  55018. "Error compiling template:\n\n" + template + "\n\n" +
  55019. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55020. vm
  55021. );
  55022. }
  55023. }
  55024. if (compiled.tips && compiled.tips.length) {
  55025. if (options.outputSourceRange) {
  55026. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55027. } else {
  55028. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55029. }
  55030. }
  55031. }
  55032. // turn code into functions
  55033. var res = {};
  55034. var fnGenErrors = [];
  55035. res.render = createFunction(compiled.render, fnGenErrors);
  55036. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55037. return createFunction(code, fnGenErrors)
  55038. });
  55039. // check function generation errors.
  55040. // this should only happen if there is a bug in the compiler itself.
  55041. // mostly for codegen development use
  55042. /* istanbul ignore if */
  55043. {
  55044. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55045. warn$$1(
  55046. "Failed to generate render function:\n\n" +
  55047. fnGenErrors.map(function (ref) {
  55048. var err = ref.err;
  55049. var code = ref.code;
  55050. return ((err.toString()) + " in\n\n" + code + "\n");
  55051. }).join('\n'),
  55052. vm
  55053. );
  55054. }
  55055. }
  55056. return (cache[key] = res)
  55057. }
  55058. }
  55059. /* */
  55060. function createCompilerCreator (baseCompile) {
  55061. return function createCompiler (baseOptions) {
  55062. function compile (
  55063. template,
  55064. options
  55065. ) {
  55066. var finalOptions = Object.create(baseOptions);
  55067. var errors = [];
  55068. var tips = [];
  55069. var warn = function (msg, range, tip) {
  55070. (tip ? tips : errors).push(msg);
  55071. };
  55072. if (options) {
  55073. if (options.outputSourceRange) {
  55074. // $flow-disable-line
  55075. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55076. warn = function (msg, range, tip) {
  55077. var data = { msg: msg };
  55078. if (range) {
  55079. if (range.start != null) {
  55080. data.start = range.start + leadingSpaceLength;
  55081. }
  55082. if (range.end != null) {
  55083. data.end = range.end + leadingSpaceLength;
  55084. }
  55085. }
  55086. (tip ? tips : errors).push(data);
  55087. };
  55088. }
  55089. // merge custom modules
  55090. if (options.modules) {
  55091. finalOptions.modules =
  55092. (baseOptions.modules || []).concat(options.modules);
  55093. }
  55094. // merge custom directives
  55095. if (options.directives) {
  55096. finalOptions.directives = extend(
  55097. Object.create(baseOptions.directives || null),
  55098. options.directives
  55099. );
  55100. }
  55101. // copy other options
  55102. for (var key in options) {
  55103. if (key !== 'modules' && key !== 'directives') {
  55104. finalOptions[key] = options[key];
  55105. }
  55106. }
  55107. }
  55108. finalOptions.warn = warn;
  55109. var compiled = baseCompile(template.trim(), finalOptions);
  55110. {
  55111. detectErrors(compiled.ast, warn);
  55112. }
  55113. compiled.errors = errors;
  55114. compiled.tips = tips;
  55115. return compiled
  55116. }
  55117. return {
  55118. compile: compile,
  55119. compileToFunctions: createCompileToFunctionFn(compile)
  55120. }
  55121. }
  55122. }
  55123. /* */
  55124. // `createCompilerCreator` allows creating compilers that use alternative
  55125. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55126. // Here we just export a default compiler using the default parts.
  55127. var createCompiler = createCompilerCreator(function baseCompile (
  55128. template,
  55129. options
  55130. ) {
  55131. var ast = parse(template.trim(), options);
  55132. if (options.optimize !== false) {
  55133. optimize(ast, options);
  55134. }
  55135. var code = generate(ast, options);
  55136. return {
  55137. ast: ast,
  55138. render: code.render,
  55139. staticRenderFns: code.staticRenderFns
  55140. }
  55141. });
  55142. /* */
  55143. var ref$1 = createCompiler(baseOptions);
  55144. var compile = ref$1.compile;
  55145. var compileToFunctions = ref$1.compileToFunctions;
  55146. /* */
  55147. // check whether current browser encodes a char inside attribute values
  55148. var div;
  55149. function getShouldDecode (href) {
  55150. div = div || document.createElement('div');
  55151. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55152. return div.innerHTML.indexOf('&#10;') > 0
  55153. }
  55154. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55155. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55156. // #6828: chrome encodes content in a[href]
  55157. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55158. /* */
  55159. var idToTemplate = cached(function (id) {
  55160. var el = query(id);
  55161. return el && el.innerHTML
  55162. });
  55163. var mount = Vue.prototype.$mount;
  55164. Vue.prototype.$mount = function (
  55165. el,
  55166. hydrating
  55167. ) {
  55168. el = el && query(el);
  55169. /* istanbul ignore if */
  55170. if (el === document.body || el === document.documentElement) {
  55171. warn(
  55172. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55173. );
  55174. return this
  55175. }
  55176. var options = this.$options;
  55177. // resolve template/el and convert to render function
  55178. if (!options.render) {
  55179. var template = options.template;
  55180. if (template) {
  55181. if (typeof template === 'string') {
  55182. if (template.charAt(0) === '#') {
  55183. template = idToTemplate(template);
  55184. /* istanbul ignore if */
  55185. if (!template) {
  55186. warn(
  55187. ("Template element not found or is empty: " + (options.template)),
  55188. this
  55189. );
  55190. }
  55191. }
  55192. } else if (template.nodeType) {
  55193. template = template.innerHTML;
  55194. } else {
  55195. {
  55196. warn('invalid template option:' + template, this);
  55197. }
  55198. return this
  55199. }
  55200. } else if (el) {
  55201. template = getOuterHTML(el);
  55202. }
  55203. if (template) {
  55204. /* istanbul ignore if */
  55205. if (config.performance && mark) {
  55206. mark('compile');
  55207. }
  55208. var ref = compileToFunctions(template, {
  55209. outputSourceRange: "development" !== 'production',
  55210. shouldDecodeNewlines: shouldDecodeNewlines,
  55211. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55212. delimiters: options.delimiters,
  55213. comments: options.comments
  55214. }, this);
  55215. var render = ref.render;
  55216. var staticRenderFns = ref.staticRenderFns;
  55217. options.render = render;
  55218. options.staticRenderFns = staticRenderFns;
  55219. /* istanbul ignore if */
  55220. if (config.performance && mark) {
  55221. mark('compile end');
  55222. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55223. }
  55224. }
  55225. }
  55226. return mount.call(this, el, hydrating)
  55227. };
  55228. /**
  55229. * Get outerHTML of elements, taking care
  55230. * of SVG elements in IE as well.
  55231. */
  55232. function getOuterHTML (el) {
  55233. if (el.outerHTML) {
  55234. return el.outerHTML
  55235. } else {
  55236. var container = document.createElement('div');
  55237. container.appendChild(el.cloneNode(true));
  55238. return container.innerHTML
  55239. }
  55240. }
  55241. Vue.compile = compileToFunctions;
  55242. module.exports = Vue;
  55243. /* 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))
  55244. /***/ }),
  55245. /***/ "./node_modules/vue/dist/vue.common.js":
  55246. /*!*********************************************!*\
  55247. !*** ./node_modules/vue/dist/vue.common.js ***!
  55248. \*********************************************/
  55249. /*! no static exports found */
  55250. /***/ (function(module, exports, __webpack_require__) {
  55251. if (false) {} else {
  55252. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55253. }
  55254. /***/ }),
  55255. /***/ "./node_modules/webpack/buildin/global.js":
  55256. /*!***********************************!*\
  55257. !*** (webpack)/buildin/global.js ***!
  55258. \***********************************/
  55259. /*! no static exports found */
  55260. /***/ (function(module, exports) {
  55261. var g;
  55262. // This works in non-strict mode
  55263. g = (function() {
  55264. return this;
  55265. })();
  55266. try {
  55267. // This works if eval is allowed (see CSP)
  55268. g = g || new Function("return this")();
  55269. } catch (e) {
  55270. // This works if the window reference is available
  55271. if (typeof window === "object") g = window;
  55272. }
  55273. // g can still be undefined, but nothing to do about it...
  55274. // We return undefined, instead of nothing here, so it's
  55275. // easier to handle this case. if(!global) { ...}
  55276. module.exports = g;
  55277. /***/ }),
  55278. /***/ "./node_modules/webpack/buildin/module.js":
  55279. /*!***********************************!*\
  55280. !*** (webpack)/buildin/module.js ***!
  55281. \***********************************/
  55282. /*! no static exports found */
  55283. /***/ (function(module, exports) {
  55284. module.exports = function(module) {
  55285. if (!module.webpackPolyfill) {
  55286. module.deprecate = function() {};
  55287. module.paths = [];
  55288. // module.parent = undefined by default
  55289. if (!module.children) module.children = [];
  55290. Object.defineProperty(module, "loaded", {
  55291. enumerable: true,
  55292. get: function() {
  55293. return module.l;
  55294. }
  55295. });
  55296. Object.defineProperty(module, "id", {
  55297. enumerable: true,
  55298. get: function() {
  55299. return module.i;
  55300. }
  55301. });
  55302. module.webpackPolyfill = 1;
  55303. }
  55304. return module;
  55305. };
  55306. /***/ }),
  55307. /***/ "./resources/js/app.js":
  55308. /*!*****************************!*\
  55309. !*** ./resources/js/app.js ***!
  55310. \*****************************/
  55311. /*! no static exports found */
  55312. /***/ (function(module, exports, __webpack_require__) {
  55313. /**
  55314. * First we will load all of this project's JavaScript dependencies which
  55315. * includes Vue and other libraries. It is a great starting point when
  55316. * building robust, powerful web applications using Vue and Laravel.
  55317. */
  55318. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55319. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55320. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55321. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55322. /**
  55323. * The following block of code may be used to automatically register your
  55324. * Vue components. It will recursively scan this directory for the Vue
  55325. * components and automatically register them with their "basename".
  55326. *
  55327. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55328. */
  55329. // const files = require.context('./', true, /\.vue$/i)
  55330. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55331. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55332. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55333. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55334. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55335. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55336. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55337. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55338. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55339. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55340. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55341. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55342. /**
  55343. * Next, we will create a fresh Vue application instance and attach it to
  55344. * the page. Then, you may begin adding components to this application
  55345. * or customize the JavaScript scaffolding to fit your unique needs.
  55346. */
  55347. var app = new Vue({
  55348. el: '#app'
  55349. });
  55350. $(function () {
  55351. $('[data-toggle="tooltip"]').tooltip();
  55352. });
  55353. var clipboard = new Clipboard('.btn-clip');
  55354. clipboard.on('success', function (e) {
  55355. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55356. position: "right",
  55357. className: 'success'
  55358. });
  55359. e.clearSelection();
  55360. });
  55361. /***/ }),
  55362. /***/ "./resources/js/bootstrap.js":
  55363. /*!***********************************!*\
  55364. !*** ./resources/js/bootstrap.js ***!
  55365. \***********************************/
  55366. /*! no exports provided */
  55367. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55368. "use strict";
  55369. __webpack_require__.r(__webpack_exports__);
  55370. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55371. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55372. /**
  55373. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55374. * for JavaScript based Bootstrap features such as modals and tabs. This
  55375. * code may be modified to fit the specific needs of your application.
  55376. */
  55377. try {
  55378. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55379. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55380. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55381. } catch (e) {}
  55382. /**
  55383. * We'll load the axios HTTP library which allows us to easily issue requests
  55384. * to our Laravel back-end. This library automatically handles sending the
  55385. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55386. */
  55387. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55388. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55389. /**
  55390. * Echo exposes an expressive API for subscribing to channels and listening
  55391. * for events that are broadcast by Laravel. Echo and event broadcasting
  55392. * allows your team to easily build robust real-time web applications.
  55393. */
  55394. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55395. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55396. broadcaster: 'pusher',
  55397. key: "upccrt",
  55398. wsHost: window.location.hostname,
  55399. wsPort: 6001,
  55400. disableStats: true
  55401. });
  55402. /***/ }),
  55403. /***/ "./resources/js/components/ExampleComponent.vue":
  55404. /*!******************************************************!*\
  55405. !*** ./resources/js/components/ExampleComponent.vue ***!
  55406. \******************************************************/
  55407. /*! exports provided: default */
  55408. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55409. "use strict";
  55410. __webpack_require__.r(__webpack_exports__);
  55411. /* 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&");
  55412. /* 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&");
  55413. /* 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");
  55414. /* normalize component */
  55415. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55416. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55417. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55418. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55419. false,
  55420. null,
  55421. null,
  55422. null
  55423. )
  55424. /* hot reload */
  55425. if (false) { var api; }
  55426. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55427. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55428. /***/ }),
  55429. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55430. /*!*******************************************************************************!*\
  55431. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55432. \*******************************************************************************/
  55433. /*! exports provided: default */
  55434. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55435. "use strict";
  55436. __webpack_require__.r(__webpack_exports__);
  55437. /* 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&");
  55438. /* 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"]);
  55439. /***/ }),
  55440. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55441. /*!*************************************************************************************!*\
  55442. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55443. \*************************************************************************************/
  55444. /*! exports provided: render, staticRenderFns */
  55445. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55446. "use strict";
  55447. __webpack_require__.r(__webpack_exports__);
  55448. /* 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&");
  55449. /* 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"]; });
  55450. /* 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"]; });
  55451. /***/ }),
  55452. /***/ "./resources/js/components/assetinfo.vue":
  55453. /*!***********************************************!*\
  55454. !*** ./resources/js/components/assetinfo.vue ***!
  55455. \***********************************************/
  55456. /*! exports provided: default */
  55457. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55458. "use strict";
  55459. __webpack_require__.r(__webpack_exports__);
  55460. /* 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&");
  55461. /* 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&");
  55462. /* 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");
  55463. /* normalize component */
  55464. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55465. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55466. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55467. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55468. false,
  55469. null,
  55470. null,
  55471. null
  55472. )
  55473. /* hot reload */
  55474. if (false) { var api; }
  55475. component.options.__file = "resources/js/components/assetinfo.vue"
  55476. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55477. /***/ }),
  55478. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55479. /*!************************************************************************!*\
  55480. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55481. \************************************************************************/
  55482. /*! exports provided: default */
  55483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55484. "use strict";
  55485. __webpack_require__.r(__webpack_exports__);
  55486. /* 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&");
  55487. /* 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"]);
  55488. /***/ }),
  55489. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55490. /*!******************************************************************************!*\
  55491. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55492. \******************************************************************************/
  55493. /*! exports provided: render, staticRenderFns */
  55494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55495. "use strict";
  55496. __webpack_require__.r(__webpack_exports__);
  55497. /* 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&");
  55498. /* 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"]; });
  55499. /* 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"]; });
  55500. /***/ }),
  55501. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55502. /*!******************************************************************!*\
  55503. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55504. \******************************************************************/
  55505. /*! exports provided: default */
  55506. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55507. "use strict";
  55508. __webpack_require__.r(__webpack_exports__);
  55509. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55510. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55511. /* 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");
  55512. /* normalize component */
  55513. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55514. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55515. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55516. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55517. false,
  55518. null,
  55519. null,
  55520. null
  55521. )
  55522. /* hot reload */
  55523. if (false) { var api; }
  55524. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55525. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55526. /***/ }),
  55527. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55528. /*!*******************************************************************************************!*\
  55529. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55530. \*******************************************************************************************/
  55531. /*! exports provided: default */
  55532. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55533. "use strict";
  55534. __webpack_require__.r(__webpack_exports__);
  55535. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_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!./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55536. /* 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_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55537. /***/ }),
  55538. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55539. /*!*************************************************************************************************!*\
  55540. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55541. \*************************************************************************************************/
  55542. /*! exports provided: render, staticRenderFns */
  55543. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55544. "use strict";
  55545. __webpack_require__.r(__webpack_exports__);
  55546. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___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!./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55547. /* 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_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55548. /* 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_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55549. /***/ }),
  55550. /***/ "./resources/js/components/credential-form-modal.vue":
  55551. /*!***********************************************************!*\
  55552. !*** ./resources/js/components/credential-form-modal.vue ***!
  55553. \***********************************************************/
  55554. /*! exports provided: default */
  55555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55556. "use strict";
  55557. __webpack_require__.r(__webpack_exports__);
  55558. /* harmony import */ var _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55559. /* harmony import */ var _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55560. /* 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");
  55561. /* normalize component */
  55562. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55563. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55564. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55565. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55566. false,
  55567. null,
  55568. null,
  55569. null
  55570. )
  55571. /* hot reload */
  55572. if (false) { var api; }
  55573. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55574. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55575. /***/ }),
  55576. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55577. /*!************************************************************************************!*\
  55578. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55579. \************************************************************************************/
  55580. /*! exports provided: default */
  55581. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55582. "use strict";
  55583. __webpack_require__.r(__webpack_exports__);
  55584. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_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-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55585. /* 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_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55586. /***/ }),
  55587. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55588. /*!******************************************************************************************!*\
  55589. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55590. \******************************************************************************************/
  55591. /*! exports provided: render, staticRenderFns */
  55592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55593. "use strict";
  55594. __webpack_require__.r(__webpack_exports__);
  55595. /* 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_form_modal_vue_vue_type_template_id_5ba19d42___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-form-modal.vue?vue&type=template&id=5ba19d42& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55596. /* 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_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55597. /* 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_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55598. /***/ }),
  55599. /***/ "./resources/js/components/credential-list.vue":
  55600. /*!*****************************************************!*\
  55601. !*** ./resources/js/components/credential-list.vue ***!
  55602. \*****************************************************/
  55603. /*! exports provided: default */
  55604. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55605. "use strict";
  55606. __webpack_require__.r(__webpack_exports__);
  55607. /* harmony import */ var _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55608. /* harmony import */ var _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-list.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55609. /* 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");
  55610. /* normalize component */
  55611. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55612. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55613. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55614. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55615. false,
  55616. null,
  55617. null,
  55618. null
  55619. )
  55620. /* hot reload */
  55621. if (false) { var api; }
  55622. component.options.__file = "resources/js/components/credential-list.vue"
  55623. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55624. /***/ }),
  55625. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55626. /*!******************************************************************************!*\
  55627. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55628. \******************************************************************************/
  55629. /*! exports provided: default */
  55630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55631. "use strict";
  55632. __webpack_require__.r(__webpack_exports__);
  55633. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_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-list.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55634. /* 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_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55635. /***/ }),
  55636. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55637. /*!************************************************************************************!*\
  55638. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55639. \************************************************************************************/
  55640. /*! exports provided: render, staticRenderFns */
  55641. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55642. "use strict";
  55643. __webpack_require__.r(__webpack_exports__);
  55644. /* 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_list_vue_vue_type_template_id_06d8fa4e___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-list.vue?vue&type=template&id=06d8fa4e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55645. /* 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_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55646. /* 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_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55647. /***/ }),
  55648. /***/ "./resources/js/components/credential.vue":
  55649. /*!************************************************!*\
  55650. !*** ./resources/js/components/credential.vue ***!
  55651. \************************************************/
  55652. /*! exports provided: default */
  55653. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55654. "use strict";
  55655. __webpack_require__.r(__webpack_exports__);
  55656. /* 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&");
  55657. /* 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&");
  55658. /* 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");
  55659. /* normalize component */
  55660. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55661. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55662. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55663. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55664. false,
  55665. null,
  55666. null,
  55667. null
  55668. )
  55669. /* hot reload */
  55670. if (false) { var api; }
  55671. component.options.__file = "resources/js/components/credential.vue"
  55672. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55673. /***/ }),
  55674. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55675. /*!*************************************************************************!*\
  55676. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55677. \*************************************************************************/
  55678. /*! exports provided: default */
  55679. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55680. "use strict";
  55681. __webpack_require__.r(__webpack_exports__);
  55682. /* 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&");
  55683. /* 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"]);
  55684. /***/ }),
  55685. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55686. /*!*******************************************************************************!*\
  55687. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55688. \*******************************************************************************/
  55689. /*! exports provided: render, staticRenderFns */
  55690. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55691. "use strict";
  55692. __webpack_require__.r(__webpack_exports__);
  55693. /* 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&");
  55694. /* 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"]; });
  55695. /* 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"]; });
  55696. /***/ }),
  55697. /***/ "./resources/js/components/errorlist.vue":
  55698. /*!***********************************************!*\
  55699. !*** ./resources/js/components/errorlist.vue ***!
  55700. \***********************************************/
  55701. /*! exports provided: default */
  55702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55703. "use strict";
  55704. __webpack_require__.r(__webpack_exports__);
  55705. /* harmony import */ var _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorlist.vue?vue&type=template&id=1546f5eb& */ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55706. /* harmony import */ var _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errorlist.vue?vue&type=script&lang=js& */ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&");
  55707. /* 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");
  55708. /* normalize component */
  55709. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55710. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55711. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55712. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55713. false,
  55714. null,
  55715. null,
  55716. null
  55717. )
  55718. /* hot reload */
  55719. if (false) { var api; }
  55720. component.options.__file = "resources/js/components/errorlist.vue"
  55721. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55722. /***/ }),
  55723. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55724. /*!************************************************************************!*\
  55725. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55726. \************************************************************************/
  55727. /*! exports provided: default */
  55728. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55729. "use strict";
  55730. __webpack_require__.r(__webpack_exports__);
  55731. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_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!./errorlist.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&");
  55732. /* 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_errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55733. /***/ }),
  55734. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55735. /*!******************************************************************************!*\
  55736. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55737. \******************************************************************************/
  55738. /*! exports provided: render, staticRenderFns */
  55739. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55740. "use strict";
  55741. __webpack_require__.r(__webpack_exports__);
  55742. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_errorlist_vue_vue_type_template_id_1546f5eb___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!./errorlist.vue?vue&type=template&id=1546f5eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55743. /* 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_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55744. /* 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_errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55745. /***/ }),
  55746. /***/ "./resources/js/components/modal.vue":
  55747. /*!*******************************************!*\
  55748. !*** ./resources/js/components/modal.vue ***!
  55749. \*******************************************/
  55750. /*! exports provided: default */
  55751. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55752. "use strict";
  55753. __webpack_require__.r(__webpack_exports__);
  55754. /* 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&");
  55755. /* 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");
  55756. var script = {}
  55757. /* normalize component */
  55758. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55759. script,
  55760. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55761. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55762. false,
  55763. null,
  55764. null,
  55765. null
  55766. )
  55767. /* hot reload */
  55768. if (false) { var api; }
  55769. component.options.__file = "resources/js/components/modal.vue"
  55770. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55771. /***/ }),
  55772. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55773. /*!**************************************************************************!*\
  55774. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55775. \**************************************************************************/
  55776. /*! exports provided: render, staticRenderFns */
  55777. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55778. "use strict";
  55779. __webpack_require__.r(__webpack_exports__);
  55780. /* 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&");
  55781. /* 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"]; });
  55782. /* 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"]; });
  55783. /***/ }),
  55784. /***/ "./resources/js/components/notes.vue":
  55785. /*!*******************************************!*\
  55786. !*** ./resources/js/components/notes.vue ***!
  55787. \*******************************************/
  55788. /*! exports provided: default */
  55789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55790. "use strict";
  55791. __webpack_require__.r(__webpack_exports__);
  55792. /* 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&");
  55793. /* 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&");
  55794. /* 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");
  55795. /* normalize component */
  55796. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55797. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55798. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55799. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55800. false,
  55801. null,
  55802. null,
  55803. null
  55804. )
  55805. /* hot reload */
  55806. if (false) { var api; }
  55807. component.options.__file = "resources/js/components/notes.vue"
  55808. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55809. /***/ }),
  55810. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55811. /*!********************************************************************!*\
  55812. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55813. \********************************************************************/
  55814. /*! exports provided: default */
  55815. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55816. "use strict";
  55817. __webpack_require__.r(__webpack_exports__);
  55818. /* 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&");
  55819. /* 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"]);
  55820. /***/ }),
  55821. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55822. /*!**************************************************************************!*\
  55823. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55824. \**************************************************************************/
  55825. /*! exports provided: render, staticRenderFns */
  55826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55827. "use strict";
  55828. __webpack_require__.r(__webpack_exports__);
  55829. /* 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&");
  55830. /* 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"]; });
  55831. /* 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"]; });
  55832. /***/ }),
  55833. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55834. /*!*******************************************************!*\
  55835. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55836. \*******************************************************/
  55837. /*! exports provided: default */
  55838. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55839. "use strict";
  55840. __webpack_require__.r(__webpack_exports__);
  55841. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55842. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55843. /* 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");
  55844. /* normalize component */
  55845. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55846. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55847. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55848. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55849. false,
  55850. null,
  55851. null,
  55852. null
  55853. )
  55854. /* hot reload */
  55855. if (false) { var api; }
  55856. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55857. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55858. /***/ }),
  55859. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55860. /*!********************************************************************************!*\
  55861. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55862. \********************************************************************************/
  55863. /*! exports provided: default */
  55864. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55865. "use strict";
  55866. __webpack_require__.r(__webpack_exports__);
  55867. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_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-edit-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55868. /* 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_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55869. /***/ }),
  55870. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55871. /*!**************************************************************************************!*\
  55872. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55873. \**************************************************************************************/
  55874. /*! exports provided: render, staticRenderFns */
  55875. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55876. "use strict";
  55877. __webpack_require__.r(__webpack_exports__);
  55878. /* 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_edit_modal_vue_vue_type_template_id_ad3662d4___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-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55879. /* 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_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55880. /* 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_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55881. /***/ }),
  55882. /***/ "./resources/js/components/woinfo.vue":
  55883. /*!********************************************!*\
  55884. !*** ./resources/js/components/woinfo.vue ***!
  55885. \********************************************/
  55886. /*! exports provided: default */
  55887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55888. "use strict";
  55889. __webpack_require__.r(__webpack_exports__);
  55890. /* 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&");
  55891. /* 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&");
  55892. /* 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");
  55893. /* normalize component */
  55894. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55895. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55896. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55897. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55898. false,
  55899. null,
  55900. null,
  55901. null
  55902. )
  55903. /* hot reload */
  55904. if (false) { var api; }
  55905. component.options.__file = "resources/js/components/woinfo.vue"
  55906. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55907. /***/ }),
  55908. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55909. /*!*********************************************************************!*\
  55910. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55911. \*********************************************************************/
  55912. /*! exports provided: default */
  55913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55914. "use strict";
  55915. __webpack_require__.r(__webpack_exports__);
  55916. /* 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&");
  55917. /* 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"]);
  55918. /***/ }),
  55919. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55920. /*!***************************************************************************!*\
  55921. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55922. \***************************************************************************/
  55923. /*! exports provided: render, staticRenderFns */
  55924. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55925. "use strict";
  55926. __webpack_require__.r(__webpack_exports__);
  55927. /* 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&");
  55928. /* 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"]; });
  55929. /* 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"]; });
  55930. /***/ }),
  55931. /***/ "./resources/js/mixins/dateMixin.js":
  55932. /*!******************************************!*\
  55933. !*** ./resources/js/mixins/dateMixin.js ***!
  55934. \******************************************/
  55935. /*! exports provided: default */
  55936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55937. "use strict";
  55938. __webpack_require__.r(__webpack_exports__);
  55939. /* harmony default export */ __webpack_exports__["default"] = ({
  55940. methods: {
  55941. treatAsUTC: function treatAsUTC(date) {
  55942. var result = new Date(date);
  55943. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55944. return result;
  55945. },
  55946. daysSinceToday: function daysSinceToday(date) {
  55947. var currentDate = new Date();
  55948. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55949. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55950. },
  55951. getHRDate: function getHRDate(dateString) {
  55952. var date = new Date(dateString);
  55953. return date.toLocaleString('default', {
  55954. month: 'short',
  55955. day: 'numeric',
  55956. year: 'numeric',
  55957. hour: 'numeric',
  55958. minute: 'numeric'
  55959. });
  55960. },
  55961. isZero: function isZero(dateString) {
  55962. return dateString === '0000-00-00 00:00:00';
  55963. }
  55964. }
  55965. });
  55966. /***/ }),
  55967. /***/ "./resources/js/notify.min.js":
  55968. /*!************************************!*\
  55969. !*** ./resources/js/notify.min.js ***!
  55970. \************************************/
  55971. /*! no static exports found */
  55972. /***/ (function(module, exports, __webpack_require__) {
  55973. 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); }
  55974. (function (e) {
  55975. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55976. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55977. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55978. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55979. })(function (e) {
  55980. function A(t, n, i) {
  55981. typeof i == "string" && (i = {
  55982. className: i
  55983. }), 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);
  55984. }
  55985. var t = [].indexOf || function (e) {
  55986. for (var t = 0, n = this.length; t < n; t++) {
  55987. if (t in this && this[t] === e) return t;
  55988. }
  55989. return -1;
  55990. },
  55991. n = "notify",
  55992. r = n + "js",
  55993. i = n + "!blank",
  55994. s = {
  55995. t: "top",
  55996. m: "middle",
  55997. b: "bottom",
  55998. l: "left",
  55999. c: "center",
  56000. r: "right"
  56001. },
  56002. o = ["l", "c", "r"],
  56003. u = ["t", "m", "b"],
  56004. a = ["t", "b", "l", "r"],
  56005. f = {
  56006. t: "b",
  56007. m: null,
  56008. b: "t",
  56009. l: "r",
  56010. c: null,
  56011. r: "l"
  56012. },
  56013. l = function l(t) {
  56014. var n;
  56015. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56016. var r;
  56017. r = t.toLowerCase().charAt(0);
  56018. if (s[r]) return n.push(r);
  56019. }), n;
  56020. },
  56021. c = {},
  56022. h = {
  56023. name: "core",
  56024. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56025. 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}"
  56026. },
  56027. p = {
  56028. "border-radius": ["-webkit-", "-moz-"]
  56029. },
  56030. d = function d(e) {
  56031. return c[e];
  56032. },
  56033. v = function v(e) {
  56034. if (!e) throw "Missing Style name";
  56035. c[e] && delete c[e];
  56036. },
  56037. m = function m(t, i) {
  56038. if (!t) throw "Missing Style name";
  56039. if (!i) throw "Missing Style definition";
  56040. if (!i.html) throw "Missing Style HTML";
  56041. var s = c[t];
  56042. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56043. var o = "";
  56044. i.classes && e.each(i.classes, function (t, n) {
  56045. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56046. return p[t] && e.each(p[t], function (e, r) {
  56047. return o += " " + r + t + ": " + n + ";\n";
  56048. }), o += " " + t + ": " + n + ";\n";
  56049. }), o += "}\n";
  56050. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56051. var u = {},
  56052. a = e(i.html);
  56053. y("html", a, u), y("text", a, u), i.fields = u;
  56054. },
  56055. g = function g(t) {
  56056. var n, r, i;
  56057. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56058. try {
  56059. r.html(t);
  56060. } catch (s) {
  56061. r[0].styleSheet.cssText = t;
  56062. }
  56063. return r;
  56064. },
  56065. y = function y(t, n, r) {
  56066. var s;
  56067. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56068. var n;
  56069. n = e(this).attr(s), n || (n = i), r[n] = t;
  56070. });
  56071. },
  56072. b = function b(e, t) {
  56073. return e.is(t) ? e : e.find(t);
  56074. },
  56075. w = {
  56076. clickToHide: !0,
  56077. autoHide: !0,
  56078. autoHideDelay: 5e3,
  56079. arrowShow: !0,
  56080. arrowSize: 5,
  56081. breakNewLines: !0,
  56082. elementPosition: "bottom",
  56083. globalPosition: "top right",
  56084. style: "bootstrap",
  56085. className: "error",
  56086. showAnimation: "slideDown",
  56087. showDuration: 400,
  56088. hideAnimation: "slideUp",
  56089. hideDuration: 200,
  56090. gap: 5
  56091. },
  56092. E = function E(t, n) {
  56093. var r;
  56094. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56095. },
  56096. S = function S(t) {
  56097. return e.extend(w, t);
  56098. },
  56099. x = function x(t) {
  56100. return e("<" + t + "></" + t + ">");
  56101. },
  56102. T = {},
  56103. N = function N(t) {
  56104. var n;
  56105. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56106. return e(r).attr("name") === t.attr("name");
  56107. }), t = n.first()), t;
  56108. },
  56109. C = function C(e, t, n) {
  56110. var r, i;
  56111. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56112. if (isNaN(n)) return;
  56113. 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;
  56114. },
  56115. k = function k(e, t, n) {
  56116. if (e === "l" || e === "t") return 0;
  56117. if (e === "c" || e === "m") return n / 2 - t / 2;
  56118. if (e === "r" || e === "b") return n - t;
  56119. throw "Invalid alignment";
  56120. },
  56121. L = function L(e) {
  56122. return L.e = L.e || x("div"), L.e.text(e).html();
  56123. };
  56124. A.prototype.loadHTML = function () {
  56125. var t;
  56126. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56127. }, A.prototype.show = function (e, t) {
  56128. var n, r, i, s, o;
  56129. r = function (n) {
  56130. return function () {
  56131. !e && !n.elem && n.destroy();
  56132. if (t) return t();
  56133. };
  56134. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56135. 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 {
  56136. if (!!o || !!e) return r();
  56137. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56138. }
  56139. return n.push(r), i[s].apply(i, n);
  56140. }, A.prototype.setGlobalPosition = function () {
  56141. var t = this.getPosition(),
  56142. n = t[0],
  56143. i = t[1],
  56144. o = s[n],
  56145. u = s[i],
  56146. a = n + "|" + i,
  56147. f = T[a];
  56148. if (!f || !document.body.contains(f[0])) {
  56149. f = T[a] = x("div");
  56150. var l = {};
  56151. 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);
  56152. }
  56153. return f.prepend(this.wrapper);
  56154. }, A.prototype.setElementPosition = function () {
  56155. 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;
  56156. 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"];
  56157. for (w = 0, S = B.length; w < S; w++) {
  56158. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56159. }
  56160. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56161. if (!this.options.arrowShow) this.arrow.hide();else {
  56162. 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";
  56163. for (E = 0, x = a.length; E < x; E++) {
  56164. D = a[E], P = s[D];
  56165. if (D === L) continue;
  56166. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56167. }
  56168. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56169. }
  56170. 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);
  56171. if (r) return this.arrow.removeAttr("style").css(r);
  56172. }, A.prototype.getPosition = function () {
  56173. var e, n, r, i, s, f, c, h;
  56174. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56175. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56176. 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";
  56177. return e.length === 2 && (e[2] = e[1]), e;
  56178. }, A.prototype.getStyle = function (e) {
  56179. var t;
  56180. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56181. if (!t) throw "Missing style: " + e;
  56182. return t;
  56183. }, A.prototype.updateClasses = function () {
  56184. var t, n;
  56185. 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) {
  56186. return r + "-" + n.name + "-" + e;
  56187. }).join(" "), this.userContainer.attr("class", t);
  56188. }, A.prototype.run = function (t, n) {
  56189. var r, s, o, u, a;
  56190. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56191. if (this.container && !t) {
  56192. this.show(!1);
  56193. return;
  56194. }
  56195. if (!this.container && !t) return;
  56196. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56197. for (o in s) {
  56198. r = s[o], u = this.userFields[o];
  56199. if (!u) continue;
  56200. 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);
  56201. }
  56202. 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));
  56203. }, A.prototype.destroy = function () {
  56204. this.wrapper.data(r, null), this.wrapper.remove();
  56205. }, e[n] = function (t, r, i) {
  56206. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56207. }, e.fn[n] = function (t, n) {
  56208. return e(this).each(function () {
  56209. var i = N(e(this)).data(r);
  56210. i && i.destroy();
  56211. var s = new A(e(this), t, n);
  56212. }), this;
  56213. }, e.extend(e[n], {
  56214. defaults: S,
  56215. addStyle: m,
  56216. removeStyle: v,
  56217. pluginOptions: w,
  56218. getStyle: d,
  56219. insertCSS: g
  56220. }), m("bootstrap", {
  56221. html: "<div>\n<span data-notify-text></span>\n</div>",
  56222. classes: {
  56223. base: {
  56224. "font-weight": "bold",
  56225. padding: "8px 15px 8px 14px",
  56226. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56227. "background-color": "#fcf8e3",
  56228. border: "1px solid #fbeed5",
  56229. "border-radius": "4px",
  56230. "white-space": "nowrap",
  56231. "padding-left": "25px",
  56232. "background-repeat": "no-repeat",
  56233. "background-position": "3px 7px"
  56234. },
  56235. error: {
  56236. color: "#B94A48",
  56237. "background-color": "#F2DEDE",
  56238. "border-color": "#EED3D7",
  56239. "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=)"
  56240. },
  56241. success: {
  56242. color: "#468847",
  56243. "background-color": "#DFF0D8",
  56244. "border-color": "#D6E9C6",
  56245. "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==)"
  56246. },
  56247. info: {
  56248. color: "#3A87AD",
  56249. "background-color": "#D9EDF7",
  56250. "border-color": "#BCE8F1",
  56251. "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=)"
  56252. },
  56253. warn: {
  56254. color: "#C09853",
  56255. "background-color": "#FCF8E3",
  56256. "border-color": "#FBEED5",
  56257. "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)"
  56258. }
  56259. }
  56260. }), e(function () {
  56261. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56262. e(this).trigger("notify-hide");
  56263. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56264. var n = e(this).data(r);
  56265. n && n.show(!1);
  56266. });
  56267. });
  56268. });
  56269. /***/ }),
  56270. /***/ "./resources/sass/app.scss":
  56271. /*!*********************************!*\
  56272. !*** ./resources/sass/app.scss ***!
  56273. \*********************************/
  56274. /*! no static exports found */
  56275. /***/ (function(module, exports) {
  56276. // removed by extract-text-webpack-plugin
  56277. /***/ }),
  56278. /***/ 0:
  56279. /*!*************************************************************!*\
  56280. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56281. \*************************************************************/
  56282. /*! no static exports found */
  56283. /***/ (function(module, exports, __webpack_require__) {
  56284. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56285. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56286. /***/ })
  56287. /******/ });