app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982
  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('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = 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. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.credid === deletedCred['credid'];
  2004. });
  2005. console.log(index);
  2006. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2007. _this.deleteCred(index);
  2008. }).listen('CredentialAdded', function (e) {
  2009. _this.credentials.unshift(e.credential);
  2010. });
  2011. }
  2012. if (this.groupid) {
  2013. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2014. var deletedCred = e.credential;
  2015. var index = _this.credentials.findIndex(function (credential) {
  2016. return credential.groupid === deletedCred['groupid'];
  2017. });
  2018. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2019. _this.deleteCred(index);
  2020. }).listen('CredentialAdded', function (e) {
  2021. _this.credentials.unshift(e.credential);
  2022. });
  2023. }
  2024. }
  2025. });
  2026. /***/ }),
  2027. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2028. /*!*********************************************************************************************************************************************************************!*\
  2029. !*** ./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& ***!
  2030. \*********************************************************************************************************************************************************************/
  2031. /*! exports provided: default */
  2032. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2033. "use strict";
  2034. __webpack_require__.r(__webpack_exports__);
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. //
  2078. /* harmony default export */ __webpack_exports__["default"] = ({
  2079. props: ['credential', 'descriptions'],
  2080. data: function data() {
  2081. return {
  2082. data: this.credential,
  2083. creddescList: this.descriptions
  2084. };
  2085. },
  2086. mounted: function mounted() {
  2087. var _this = this;
  2088. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2089. _this.data = e.credential;
  2090. });
  2091. },
  2092. methods: {
  2093. deleteCredential: function deleteCredential() {
  2094. var _this2 = this;
  2095. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2096. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2097. })["catch"](function (error) {
  2098. console.error(error);
  2099. });
  2100. }
  2101. }
  2102. });
  2103. /***/ }),
  2104. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2105. /*!********************************************************************************************************************************************************************!*\
  2106. !*** ./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& ***!
  2107. \********************************************************************************************************************************************************************/
  2108. /*! exports provided: default */
  2109. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2110. "use strict";
  2111. __webpack_require__.r(__webpack_exports__);
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. /* harmony default export */ __webpack_exports__["default"] = ({
  2118. props: ['errors'],
  2119. data: function data() {
  2120. return {
  2121. errorList: this.errors
  2122. };
  2123. },
  2124. watch: {
  2125. errors: function errors(newErrors) {
  2126. this.errorList = newErrors;
  2127. }
  2128. }
  2129. });
  2130. /***/ }),
  2131. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  2132. /*!**************************************************************************************************************************************************************************!*\
  2133. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  2134. \**************************************************************************************************************************************************************************/
  2135. /*! exports provided: default */
  2136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2137. "use strict";
  2138. __webpack_require__.r(__webpack_exports__);
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. /* harmony default export */ __webpack_exports__["default"] = ({
  2157. props: {
  2158. populateWith: {
  2159. type: Object
  2160. },
  2161. modalId: {
  2162. type: String,
  2163. require: true
  2164. },
  2165. noteType: {
  2166. type: Number
  2167. },
  2168. noteUser: {
  2169. type: String
  2170. },
  2171. woid: {
  2172. type: Number
  2173. }
  2174. },
  2175. data: function data() {
  2176. return {
  2177. note: {}
  2178. };
  2179. },
  2180. mounted: function mounted() {
  2181. if (!this.populateWith) {
  2182. this.note = {
  2183. thenote: '',
  2184. notetype: this.noteType,
  2185. noteuser: this.noteUser,
  2186. woid: this.woid
  2187. };
  2188. } else {
  2189. this.note = JSON.parse(JSON.stringify(this.populateWith));
  2190. }
  2191. },
  2192. methods: {
  2193. updateNote: function updateNote(note) {
  2194. if (this.populateWith) {
  2195. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2196. hideModal();
  2197. });
  2198. } else {
  2199. axios.post('/api/workorders/notes', note).then(function (response) {
  2200. hideModal();
  2201. });
  2202. }
  2203. },
  2204. hideModal: function hideModal() {
  2205. $('#' + this.modalId).modal('hide');
  2206. }
  2207. }
  2208. });
  2209. /***/ }),
  2210. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2211. /*!****************************************************************************************************************************************************************!*\
  2212. !*** ./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& ***!
  2213. \****************************************************************************************************************************************************************/
  2214. /*! exports provided: default */
  2215. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2216. "use strict";
  2217. __webpack_require__.r(__webpack_exports__);
  2218. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. //
  2240. //
  2241. //
  2242. //
  2243. //
  2244. //
  2245. //
  2246. /* harmony default export */ __webpack_exports__["default"] = ({
  2247. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2248. props: ['initialnotes', 'authusername', 'noteType', 'woid'],
  2249. data: function data() {
  2250. return {
  2251. notes: Object.values(this.initialnotes),
  2252. currentOrder: 'order-first'
  2253. };
  2254. },
  2255. methods: {
  2256. setOrder: function setOrder(index) {
  2257. if (index === 0) {
  2258. this.currentOrder = 'order-first';
  2259. } else if (this.notes[index].noteuser !== this.notes[index - 1].noteuser) {
  2260. if (this.currentOrder === 'order-first') {
  2261. this.currentOrder = 'order-last';
  2262. } else {
  2263. this.currentOrder = 'order-first';
  2264. }
  2265. }
  2266. return this.currentOrder;
  2267. }
  2268. }
  2269. });
  2270. /***/ }),
  2271. /***/ "./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&":
  2272. /*!****************************************************************************************************************************************************************************!*\
  2273. !*** ./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& ***!
  2274. \****************************************************************************************************************************************************************************/
  2275. /*! exports provided: default */
  2276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2277. "use strict";
  2278. __webpack_require__.r(__webpack_exports__);
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. //
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. /* harmony default export */ __webpack_exports__["default"] = ({
  2313. props: ['populateWith', 'storeList', 'modalId'],
  2314. data: function data() {
  2315. return {
  2316. // Copies object from prop, so it doesn't mutate the object
  2317. // from the parent component. Parent component will be updated via
  2318. // Websocket if updateWorkOrder is successful.
  2319. data: JSON.parse(JSON.stringify(this.populateWith)),
  2320. id: this.modalId,
  2321. store: {},
  2322. errors: []
  2323. };
  2324. },
  2325. mounted: function mounted() {
  2326. this.store = {
  2327. 'id': this.data.storeid,
  2328. 'name': this.storeList[this.data.storeid]
  2329. };
  2330. },
  2331. methods: {
  2332. updateWorkOrder: function updateWorkOrder() {
  2333. var _this = this;
  2334. this.data.storeid = this.store.id;
  2335. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2336. $('#workordereditModal').modal('hide');
  2337. })["catch"](function (error) {
  2338. _this.errors = JSON.parse(error.response.request.response).errors;
  2339. });
  2340. }
  2341. }
  2342. });
  2343. /***/ }),
  2344. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2345. /*!*****************************************************************************************************************************************************************!*\
  2346. !*** ./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& ***!
  2347. \*****************************************************************************************************************************************************************/
  2348. /*! exports provided: default */
  2349. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2350. "use strict";
  2351. __webpack_require__.r(__webpack_exports__);
  2352. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2353. //
  2354. //
  2355. //
  2356. //
  2357. //
  2358. //
  2359. //
  2360. //
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. /* harmony default export */ __webpack_exports__["default"] = ({
  2374. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2375. props: ['workOrder', 'stores'],
  2376. data: function data() {
  2377. return {
  2378. data: JSON.parse(this.workOrder)
  2379. };
  2380. },
  2381. computed: {
  2382. storeList: function storeList() {
  2383. var list = {};
  2384. JSON.parse(this.stores).map(function (val) {
  2385. list[val.storeid] = val.storesname;
  2386. });
  2387. return list;
  2388. }
  2389. },
  2390. mounted: function mounted() {
  2391. var _this = this;
  2392. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2393. _this.data = e.data;
  2394. });
  2395. }
  2396. });
  2397. /***/ }),
  2398. /***/ "./node_modules/base64-js/index.js":
  2399. /*!*****************************************!*\
  2400. !*** ./node_modules/base64-js/index.js ***!
  2401. \*****************************************/
  2402. /*! no static exports found */
  2403. /***/ (function(module, exports, __webpack_require__) {
  2404. "use strict";
  2405. exports.byteLength = byteLength
  2406. exports.toByteArray = toByteArray
  2407. exports.fromByteArray = fromByteArray
  2408. var lookup = []
  2409. var revLookup = []
  2410. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2411. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2412. for (var i = 0, len = code.length; i < len; ++i) {
  2413. lookup[i] = code[i]
  2414. revLookup[code.charCodeAt(i)] = i
  2415. }
  2416. // Support decoding URL-safe base64 strings, as Node.js does.
  2417. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2418. revLookup['-'.charCodeAt(0)] = 62
  2419. revLookup['_'.charCodeAt(0)] = 63
  2420. function getLens (b64) {
  2421. var len = b64.length
  2422. if (len % 4 > 0) {
  2423. throw new Error('Invalid string. Length must be a multiple of 4')
  2424. }
  2425. // Trim off extra bytes after placeholder bytes are found
  2426. // See: https://github.com/beatgammit/base64-js/issues/42
  2427. var validLen = b64.indexOf('=')
  2428. if (validLen === -1) validLen = len
  2429. var placeHoldersLen = validLen === len
  2430. ? 0
  2431. : 4 - (validLen % 4)
  2432. return [validLen, placeHoldersLen]
  2433. }
  2434. // base64 is 4/3 + up to two characters of the original data
  2435. function byteLength (b64) {
  2436. var lens = getLens(b64)
  2437. var validLen = lens[0]
  2438. var placeHoldersLen = lens[1]
  2439. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2440. }
  2441. function _byteLength (b64, validLen, placeHoldersLen) {
  2442. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2443. }
  2444. function toByteArray (b64) {
  2445. var tmp
  2446. var lens = getLens(b64)
  2447. var validLen = lens[0]
  2448. var placeHoldersLen = lens[1]
  2449. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2450. var curByte = 0
  2451. // if there are placeholders, only get up to the last complete 4 chars
  2452. var len = placeHoldersLen > 0
  2453. ? validLen - 4
  2454. : validLen
  2455. var i
  2456. for (i = 0; i < len; i += 4) {
  2457. tmp =
  2458. (revLookup[b64.charCodeAt(i)] << 18) |
  2459. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2460. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2461. revLookup[b64.charCodeAt(i + 3)]
  2462. arr[curByte++] = (tmp >> 16) & 0xFF
  2463. arr[curByte++] = (tmp >> 8) & 0xFF
  2464. arr[curByte++] = tmp & 0xFF
  2465. }
  2466. if (placeHoldersLen === 2) {
  2467. tmp =
  2468. (revLookup[b64.charCodeAt(i)] << 2) |
  2469. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2470. arr[curByte++] = tmp & 0xFF
  2471. }
  2472. if (placeHoldersLen === 1) {
  2473. tmp =
  2474. (revLookup[b64.charCodeAt(i)] << 10) |
  2475. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2476. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2477. arr[curByte++] = (tmp >> 8) & 0xFF
  2478. arr[curByte++] = tmp & 0xFF
  2479. }
  2480. return arr
  2481. }
  2482. function tripletToBase64 (num) {
  2483. return lookup[num >> 18 & 0x3F] +
  2484. lookup[num >> 12 & 0x3F] +
  2485. lookup[num >> 6 & 0x3F] +
  2486. lookup[num & 0x3F]
  2487. }
  2488. function encodeChunk (uint8, start, end) {
  2489. var tmp
  2490. var output = []
  2491. for (var i = start; i < end; i += 3) {
  2492. tmp =
  2493. ((uint8[i] << 16) & 0xFF0000) +
  2494. ((uint8[i + 1] << 8) & 0xFF00) +
  2495. (uint8[i + 2] & 0xFF)
  2496. output.push(tripletToBase64(tmp))
  2497. }
  2498. return output.join('')
  2499. }
  2500. function fromByteArray (uint8) {
  2501. var tmp
  2502. var len = uint8.length
  2503. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2504. var parts = []
  2505. var maxChunkLength = 16383 // must be multiple of 3
  2506. // go through the array every three bytes, we'll deal with trailing stuff later
  2507. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2508. parts.push(encodeChunk(
  2509. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2510. ))
  2511. }
  2512. // pad the end with zeros, but make sure to not forget the extra bytes
  2513. if (extraBytes === 1) {
  2514. tmp = uint8[len - 1]
  2515. parts.push(
  2516. lookup[tmp >> 2] +
  2517. lookup[(tmp << 4) & 0x3F] +
  2518. '=='
  2519. )
  2520. } else if (extraBytes === 2) {
  2521. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2522. parts.push(
  2523. lookup[tmp >> 10] +
  2524. lookup[(tmp >> 4) & 0x3F] +
  2525. lookup[(tmp << 2) & 0x3F] +
  2526. '='
  2527. )
  2528. }
  2529. return parts.join('')
  2530. }
  2531. /***/ }),
  2532. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2533. /*!*****************************************************!*\
  2534. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2535. \*****************************************************/
  2536. /*! no static exports found */
  2537. /***/ (function(module, exports, __webpack_require__) {
  2538. /*!
  2539. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2540. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2541. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2542. */
  2543. (function (global, factory) {
  2544. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2545. undefined;
  2546. }(this, (function (exports, $, Popper) { 'use strict';
  2547. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2548. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2549. function _defineProperties(target, props) {
  2550. for (var i = 0; i < props.length; i++) {
  2551. var descriptor = props[i];
  2552. descriptor.enumerable = descriptor.enumerable || false;
  2553. descriptor.configurable = true;
  2554. if ("value" in descriptor) descriptor.writable = true;
  2555. Object.defineProperty(target, descriptor.key, descriptor);
  2556. }
  2557. }
  2558. function _createClass(Constructor, protoProps, staticProps) {
  2559. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2560. if (staticProps) _defineProperties(Constructor, staticProps);
  2561. return Constructor;
  2562. }
  2563. function _defineProperty(obj, key, value) {
  2564. if (key in obj) {
  2565. Object.defineProperty(obj, key, {
  2566. value: value,
  2567. enumerable: true,
  2568. configurable: true,
  2569. writable: true
  2570. });
  2571. } else {
  2572. obj[key] = value;
  2573. }
  2574. return obj;
  2575. }
  2576. function ownKeys(object, enumerableOnly) {
  2577. var keys = Object.keys(object);
  2578. if (Object.getOwnPropertySymbols) {
  2579. var symbols = Object.getOwnPropertySymbols(object);
  2580. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2581. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2582. });
  2583. keys.push.apply(keys, symbols);
  2584. }
  2585. return keys;
  2586. }
  2587. function _objectSpread2(target) {
  2588. for (var i = 1; i < arguments.length; i++) {
  2589. var source = arguments[i] != null ? arguments[i] : {};
  2590. if (i % 2) {
  2591. ownKeys(Object(source), true).forEach(function (key) {
  2592. _defineProperty(target, key, source[key]);
  2593. });
  2594. } else if (Object.getOwnPropertyDescriptors) {
  2595. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2596. } else {
  2597. ownKeys(Object(source)).forEach(function (key) {
  2598. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2599. });
  2600. }
  2601. }
  2602. return target;
  2603. }
  2604. function _inheritsLoose(subClass, superClass) {
  2605. subClass.prototype = Object.create(superClass.prototype);
  2606. subClass.prototype.constructor = subClass;
  2607. subClass.__proto__ = superClass;
  2608. }
  2609. /**
  2610. * --------------------------------------------------------------------------
  2611. * Bootstrap (v4.4.1): util.js
  2612. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2613. * --------------------------------------------------------------------------
  2614. */
  2615. /**
  2616. * ------------------------------------------------------------------------
  2617. * Private TransitionEnd Helpers
  2618. * ------------------------------------------------------------------------
  2619. */
  2620. var TRANSITION_END = 'transitionend';
  2621. var MAX_UID = 1000000;
  2622. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2623. function toType(obj) {
  2624. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2625. }
  2626. function getSpecialTransitionEndEvent() {
  2627. return {
  2628. bindType: TRANSITION_END,
  2629. delegateType: TRANSITION_END,
  2630. handle: function handle(event) {
  2631. if ($(event.target).is(this)) {
  2632. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2633. }
  2634. return undefined; // eslint-disable-line no-undefined
  2635. }
  2636. };
  2637. }
  2638. function transitionEndEmulator(duration) {
  2639. var _this = this;
  2640. var called = false;
  2641. $(this).one(Util.TRANSITION_END, function () {
  2642. called = true;
  2643. });
  2644. setTimeout(function () {
  2645. if (!called) {
  2646. Util.triggerTransitionEnd(_this);
  2647. }
  2648. }, duration);
  2649. return this;
  2650. }
  2651. function setTransitionEndSupport() {
  2652. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2653. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2654. }
  2655. /**
  2656. * --------------------------------------------------------------------------
  2657. * Public Util Api
  2658. * --------------------------------------------------------------------------
  2659. */
  2660. var Util = {
  2661. TRANSITION_END: 'bsTransitionEnd',
  2662. getUID: function getUID(prefix) {
  2663. do {
  2664. // eslint-disable-next-line no-bitwise
  2665. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2666. } while (document.getElementById(prefix));
  2667. return prefix;
  2668. },
  2669. getSelectorFromElement: function getSelectorFromElement(element) {
  2670. var selector = element.getAttribute('data-target');
  2671. if (!selector || selector === '#') {
  2672. var hrefAttr = element.getAttribute('href');
  2673. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2674. }
  2675. try {
  2676. return document.querySelector(selector) ? selector : null;
  2677. } catch (err) {
  2678. return null;
  2679. }
  2680. },
  2681. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2682. if (!element) {
  2683. return 0;
  2684. } // Get transition-duration of the element
  2685. var transitionDuration = $(element).css('transition-duration');
  2686. var transitionDelay = $(element).css('transition-delay');
  2687. var floatTransitionDuration = parseFloat(transitionDuration);
  2688. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2689. if (!floatTransitionDuration && !floatTransitionDelay) {
  2690. return 0;
  2691. } // If multiple durations are defined, take the first
  2692. transitionDuration = transitionDuration.split(',')[0];
  2693. transitionDelay = transitionDelay.split(',')[0];
  2694. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2695. },
  2696. reflow: function reflow(element) {
  2697. return element.offsetHeight;
  2698. },
  2699. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2700. $(element).trigger(TRANSITION_END);
  2701. },
  2702. // TODO: Remove in v5
  2703. supportsTransitionEnd: function supportsTransitionEnd() {
  2704. return Boolean(TRANSITION_END);
  2705. },
  2706. isElement: function isElement(obj) {
  2707. return (obj[0] || obj).nodeType;
  2708. },
  2709. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2710. for (var property in configTypes) {
  2711. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2712. var expectedTypes = configTypes[property];
  2713. var value = config[property];
  2714. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2715. if (!new RegExp(expectedTypes).test(valueType)) {
  2716. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2717. }
  2718. }
  2719. }
  2720. },
  2721. findShadowRoot: function findShadowRoot(element) {
  2722. if (!document.documentElement.attachShadow) {
  2723. return null;
  2724. } // Can find the shadow root otherwise it'll return the document
  2725. if (typeof element.getRootNode === 'function') {
  2726. var root = element.getRootNode();
  2727. return root instanceof ShadowRoot ? root : null;
  2728. }
  2729. if (element instanceof ShadowRoot) {
  2730. return element;
  2731. } // when we don't find a shadow root
  2732. if (!element.parentNode) {
  2733. return null;
  2734. }
  2735. return Util.findShadowRoot(element.parentNode);
  2736. },
  2737. jQueryDetection: function jQueryDetection() {
  2738. if (typeof $ === 'undefined') {
  2739. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2740. }
  2741. var version = $.fn.jquery.split(' ')[0].split('.');
  2742. var minMajor = 1;
  2743. var ltMajor = 2;
  2744. var minMinor = 9;
  2745. var minPatch = 1;
  2746. var maxMajor = 4;
  2747. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2748. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2749. }
  2750. }
  2751. };
  2752. Util.jQueryDetection();
  2753. setTransitionEndSupport();
  2754. /**
  2755. * ------------------------------------------------------------------------
  2756. * Constants
  2757. * ------------------------------------------------------------------------
  2758. */
  2759. var NAME = 'alert';
  2760. var VERSION = '4.4.1';
  2761. var DATA_KEY = 'bs.alert';
  2762. var EVENT_KEY = "." + DATA_KEY;
  2763. var DATA_API_KEY = '.data-api';
  2764. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2765. var Selector = {
  2766. DISMISS: '[data-dismiss="alert"]'
  2767. };
  2768. var Event = {
  2769. CLOSE: "close" + EVENT_KEY,
  2770. CLOSED: "closed" + EVENT_KEY,
  2771. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2772. };
  2773. var ClassName = {
  2774. ALERT: 'alert',
  2775. FADE: 'fade',
  2776. SHOW: 'show'
  2777. };
  2778. /**
  2779. * ------------------------------------------------------------------------
  2780. * Class Definition
  2781. * ------------------------------------------------------------------------
  2782. */
  2783. var Alert =
  2784. /*#__PURE__*/
  2785. function () {
  2786. function Alert(element) {
  2787. this._element = element;
  2788. } // Getters
  2789. var _proto = Alert.prototype;
  2790. // Public
  2791. _proto.close = function close(element) {
  2792. var rootElement = this._element;
  2793. if (element) {
  2794. rootElement = this._getRootElement(element);
  2795. }
  2796. var customEvent = this._triggerCloseEvent(rootElement);
  2797. if (customEvent.isDefaultPrevented()) {
  2798. return;
  2799. }
  2800. this._removeElement(rootElement);
  2801. };
  2802. _proto.dispose = function dispose() {
  2803. $.removeData(this._element, DATA_KEY);
  2804. this._element = null;
  2805. } // Private
  2806. ;
  2807. _proto._getRootElement = function _getRootElement(element) {
  2808. var selector = Util.getSelectorFromElement(element);
  2809. var parent = false;
  2810. if (selector) {
  2811. parent = document.querySelector(selector);
  2812. }
  2813. if (!parent) {
  2814. parent = $(element).closest("." + ClassName.ALERT)[0];
  2815. }
  2816. return parent;
  2817. };
  2818. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2819. var closeEvent = $.Event(Event.CLOSE);
  2820. $(element).trigger(closeEvent);
  2821. return closeEvent;
  2822. };
  2823. _proto._removeElement = function _removeElement(element) {
  2824. var _this = this;
  2825. $(element).removeClass(ClassName.SHOW);
  2826. if (!$(element).hasClass(ClassName.FADE)) {
  2827. this._destroyElement(element);
  2828. return;
  2829. }
  2830. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2831. $(element).one(Util.TRANSITION_END, function (event) {
  2832. return _this._destroyElement(element, event);
  2833. }).emulateTransitionEnd(transitionDuration);
  2834. };
  2835. _proto._destroyElement = function _destroyElement(element) {
  2836. $(element).detach().trigger(Event.CLOSED).remove();
  2837. } // Static
  2838. ;
  2839. Alert._jQueryInterface = function _jQueryInterface(config) {
  2840. return this.each(function () {
  2841. var $element = $(this);
  2842. var data = $element.data(DATA_KEY);
  2843. if (!data) {
  2844. data = new Alert(this);
  2845. $element.data(DATA_KEY, data);
  2846. }
  2847. if (config === 'close') {
  2848. data[config](this);
  2849. }
  2850. });
  2851. };
  2852. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2853. return function (event) {
  2854. if (event) {
  2855. event.preventDefault();
  2856. }
  2857. alertInstance.close(this);
  2858. };
  2859. };
  2860. _createClass(Alert, null, [{
  2861. key: "VERSION",
  2862. get: function get() {
  2863. return VERSION;
  2864. }
  2865. }]);
  2866. return Alert;
  2867. }();
  2868. /**
  2869. * ------------------------------------------------------------------------
  2870. * Data Api implementation
  2871. * ------------------------------------------------------------------------
  2872. */
  2873. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2874. /**
  2875. * ------------------------------------------------------------------------
  2876. * jQuery
  2877. * ------------------------------------------------------------------------
  2878. */
  2879. $.fn[NAME] = Alert._jQueryInterface;
  2880. $.fn[NAME].Constructor = Alert;
  2881. $.fn[NAME].noConflict = function () {
  2882. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2883. return Alert._jQueryInterface;
  2884. };
  2885. /**
  2886. * ------------------------------------------------------------------------
  2887. * Constants
  2888. * ------------------------------------------------------------------------
  2889. */
  2890. var NAME$1 = 'button';
  2891. var VERSION$1 = '4.4.1';
  2892. var DATA_KEY$1 = 'bs.button';
  2893. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2894. var DATA_API_KEY$1 = '.data-api';
  2895. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2896. var ClassName$1 = {
  2897. ACTIVE: 'active',
  2898. BUTTON: 'btn',
  2899. FOCUS: 'focus'
  2900. };
  2901. var Selector$1 = {
  2902. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2903. DATA_TOGGLES: '[data-toggle="buttons"]',
  2904. DATA_TOGGLE: '[data-toggle="button"]',
  2905. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2906. INPUT: 'input:not([type="hidden"])',
  2907. ACTIVE: '.active',
  2908. BUTTON: '.btn'
  2909. };
  2910. var Event$1 = {
  2911. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2912. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2913. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2914. };
  2915. /**
  2916. * ------------------------------------------------------------------------
  2917. * Class Definition
  2918. * ------------------------------------------------------------------------
  2919. */
  2920. var Button =
  2921. /*#__PURE__*/
  2922. function () {
  2923. function Button(element) {
  2924. this._element = element;
  2925. } // Getters
  2926. var _proto = Button.prototype;
  2927. // Public
  2928. _proto.toggle = function toggle() {
  2929. var triggerChangeEvent = true;
  2930. var addAriaPressed = true;
  2931. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2932. if (rootElement) {
  2933. var input = this._element.querySelector(Selector$1.INPUT);
  2934. if (input) {
  2935. if (input.type === 'radio') {
  2936. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2937. triggerChangeEvent = false;
  2938. } else {
  2939. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2940. if (activeElement) {
  2941. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2942. }
  2943. }
  2944. } else if (input.type === 'checkbox') {
  2945. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2946. triggerChangeEvent = false;
  2947. }
  2948. } else {
  2949. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2950. triggerChangeEvent = false;
  2951. }
  2952. if (triggerChangeEvent) {
  2953. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2954. $(input).trigger('change');
  2955. }
  2956. input.focus();
  2957. addAriaPressed = false;
  2958. }
  2959. }
  2960. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2961. if (addAriaPressed) {
  2962. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2963. }
  2964. if (triggerChangeEvent) {
  2965. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2966. }
  2967. }
  2968. };
  2969. _proto.dispose = function dispose() {
  2970. $.removeData(this._element, DATA_KEY$1);
  2971. this._element = null;
  2972. } // Static
  2973. ;
  2974. Button._jQueryInterface = function _jQueryInterface(config) {
  2975. return this.each(function () {
  2976. var data = $(this).data(DATA_KEY$1);
  2977. if (!data) {
  2978. data = new Button(this);
  2979. $(this).data(DATA_KEY$1, data);
  2980. }
  2981. if (config === 'toggle') {
  2982. data[config]();
  2983. }
  2984. });
  2985. };
  2986. _createClass(Button, null, [{
  2987. key: "VERSION",
  2988. get: function get() {
  2989. return VERSION$1;
  2990. }
  2991. }]);
  2992. return Button;
  2993. }();
  2994. /**
  2995. * ------------------------------------------------------------------------
  2996. * Data Api implementation
  2997. * ------------------------------------------------------------------------
  2998. */
  2999. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3000. var button = event.target;
  3001. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3002. button = $(button).closest(Selector$1.BUTTON)[0];
  3003. }
  3004. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3005. event.preventDefault(); // work around Firefox bug #1540995
  3006. } else {
  3007. var inputBtn = button.querySelector(Selector$1.INPUT);
  3008. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3009. event.preventDefault(); // work around Firefox bug #1540995
  3010. return;
  3011. }
  3012. Button._jQueryInterface.call($(button), 'toggle');
  3013. }
  3014. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3015. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3016. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3017. });
  3018. $(window).on(Event$1.LOAD_DATA_API, function () {
  3019. // ensure correct active class is set to match the controls' actual values/states
  3020. // find all checkboxes/readio buttons inside data-toggle groups
  3021. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3022. for (var i = 0, len = buttons.length; i < len; i++) {
  3023. var button = buttons[i];
  3024. var input = button.querySelector(Selector$1.INPUT);
  3025. if (input.checked || input.hasAttribute('checked')) {
  3026. button.classList.add(ClassName$1.ACTIVE);
  3027. } else {
  3028. button.classList.remove(ClassName$1.ACTIVE);
  3029. }
  3030. } // find all button toggles
  3031. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3032. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3033. var _button = buttons[_i];
  3034. if (_button.getAttribute('aria-pressed') === 'true') {
  3035. _button.classList.add(ClassName$1.ACTIVE);
  3036. } else {
  3037. _button.classList.remove(ClassName$1.ACTIVE);
  3038. }
  3039. }
  3040. });
  3041. /**
  3042. * ------------------------------------------------------------------------
  3043. * jQuery
  3044. * ------------------------------------------------------------------------
  3045. */
  3046. $.fn[NAME$1] = Button._jQueryInterface;
  3047. $.fn[NAME$1].Constructor = Button;
  3048. $.fn[NAME$1].noConflict = function () {
  3049. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3050. return Button._jQueryInterface;
  3051. };
  3052. /**
  3053. * ------------------------------------------------------------------------
  3054. * Constants
  3055. * ------------------------------------------------------------------------
  3056. */
  3057. var NAME$2 = 'carousel';
  3058. var VERSION$2 = '4.4.1';
  3059. var DATA_KEY$2 = 'bs.carousel';
  3060. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3061. var DATA_API_KEY$2 = '.data-api';
  3062. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3063. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3064. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3065. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3066. var SWIPE_THRESHOLD = 40;
  3067. var Default = {
  3068. interval: 5000,
  3069. keyboard: true,
  3070. slide: false,
  3071. pause: 'hover',
  3072. wrap: true,
  3073. touch: true
  3074. };
  3075. var DefaultType = {
  3076. interval: '(number|boolean)',
  3077. keyboard: 'boolean',
  3078. slide: '(boolean|string)',
  3079. pause: '(string|boolean)',
  3080. wrap: 'boolean',
  3081. touch: 'boolean'
  3082. };
  3083. var Direction = {
  3084. NEXT: 'next',
  3085. PREV: 'prev',
  3086. LEFT: 'left',
  3087. RIGHT: 'right'
  3088. };
  3089. var Event$2 = {
  3090. SLIDE: "slide" + EVENT_KEY$2,
  3091. SLID: "slid" + EVENT_KEY$2,
  3092. KEYDOWN: "keydown" + EVENT_KEY$2,
  3093. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3094. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3095. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3096. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3097. TOUCHEND: "touchend" + EVENT_KEY$2,
  3098. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3099. POINTERUP: "pointerup" + EVENT_KEY$2,
  3100. DRAG_START: "dragstart" + EVENT_KEY$2,
  3101. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3102. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3103. };
  3104. var ClassName$2 = {
  3105. CAROUSEL: 'carousel',
  3106. ACTIVE: 'active',
  3107. SLIDE: 'slide',
  3108. RIGHT: 'carousel-item-right',
  3109. LEFT: 'carousel-item-left',
  3110. NEXT: 'carousel-item-next',
  3111. PREV: 'carousel-item-prev',
  3112. ITEM: 'carousel-item',
  3113. POINTER_EVENT: 'pointer-event'
  3114. };
  3115. var Selector$2 = {
  3116. ACTIVE: '.active',
  3117. ACTIVE_ITEM: '.active.carousel-item',
  3118. ITEM: '.carousel-item',
  3119. ITEM_IMG: '.carousel-item img',
  3120. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3121. INDICATORS: '.carousel-indicators',
  3122. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3123. DATA_RIDE: '[data-ride="carousel"]'
  3124. };
  3125. var PointerType = {
  3126. TOUCH: 'touch',
  3127. PEN: 'pen'
  3128. };
  3129. /**
  3130. * ------------------------------------------------------------------------
  3131. * Class Definition
  3132. * ------------------------------------------------------------------------
  3133. */
  3134. var Carousel =
  3135. /*#__PURE__*/
  3136. function () {
  3137. function Carousel(element, config) {
  3138. this._items = null;
  3139. this._interval = null;
  3140. this._activeElement = null;
  3141. this._isPaused = false;
  3142. this._isSliding = false;
  3143. this.touchTimeout = null;
  3144. this.touchStartX = 0;
  3145. this.touchDeltaX = 0;
  3146. this._config = this._getConfig(config);
  3147. this._element = element;
  3148. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3149. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3150. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3151. this._addEventListeners();
  3152. } // Getters
  3153. var _proto = Carousel.prototype;
  3154. // Public
  3155. _proto.next = function next() {
  3156. if (!this._isSliding) {
  3157. this._slide(Direction.NEXT);
  3158. }
  3159. };
  3160. _proto.nextWhenVisible = function nextWhenVisible() {
  3161. // Don't call next when the page isn't visible
  3162. // or the carousel or its parent isn't visible
  3163. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3164. this.next();
  3165. }
  3166. };
  3167. _proto.prev = function prev() {
  3168. if (!this._isSliding) {
  3169. this._slide(Direction.PREV);
  3170. }
  3171. };
  3172. _proto.pause = function pause(event) {
  3173. if (!event) {
  3174. this._isPaused = true;
  3175. }
  3176. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3177. Util.triggerTransitionEnd(this._element);
  3178. this.cycle(true);
  3179. }
  3180. clearInterval(this._interval);
  3181. this._interval = null;
  3182. };
  3183. _proto.cycle = function cycle(event) {
  3184. if (!event) {
  3185. this._isPaused = false;
  3186. }
  3187. if (this._interval) {
  3188. clearInterval(this._interval);
  3189. this._interval = null;
  3190. }
  3191. if (this._config.interval && !this._isPaused) {
  3192. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3193. }
  3194. };
  3195. _proto.to = function to(index) {
  3196. var _this = this;
  3197. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3198. var activeIndex = this._getItemIndex(this._activeElement);
  3199. if (index > this._items.length - 1 || index < 0) {
  3200. return;
  3201. }
  3202. if (this._isSliding) {
  3203. $(this._element).one(Event$2.SLID, function () {
  3204. return _this.to(index);
  3205. });
  3206. return;
  3207. }
  3208. if (activeIndex === index) {
  3209. this.pause();
  3210. this.cycle();
  3211. return;
  3212. }
  3213. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3214. this._slide(direction, this._items[index]);
  3215. };
  3216. _proto.dispose = function dispose() {
  3217. $(this._element).off(EVENT_KEY$2);
  3218. $.removeData(this._element, DATA_KEY$2);
  3219. this._items = null;
  3220. this._config = null;
  3221. this._element = null;
  3222. this._interval = null;
  3223. this._isPaused = null;
  3224. this._isSliding = null;
  3225. this._activeElement = null;
  3226. this._indicatorsElement = null;
  3227. } // Private
  3228. ;
  3229. _proto._getConfig = function _getConfig(config) {
  3230. config = _objectSpread2({}, Default, {}, config);
  3231. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3232. return config;
  3233. };
  3234. _proto._handleSwipe = function _handleSwipe() {
  3235. var absDeltax = Math.abs(this.touchDeltaX);
  3236. if (absDeltax <= SWIPE_THRESHOLD) {
  3237. return;
  3238. }
  3239. var direction = absDeltax / this.touchDeltaX;
  3240. this.touchDeltaX = 0; // swipe left
  3241. if (direction > 0) {
  3242. this.prev();
  3243. } // swipe right
  3244. if (direction < 0) {
  3245. this.next();
  3246. }
  3247. };
  3248. _proto._addEventListeners = function _addEventListeners() {
  3249. var _this2 = this;
  3250. if (this._config.keyboard) {
  3251. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3252. return _this2._keydown(event);
  3253. });
  3254. }
  3255. if (this._config.pause === 'hover') {
  3256. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3257. return _this2.pause(event);
  3258. }).on(Event$2.MOUSELEAVE, function (event) {
  3259. return _this2.cycle(event);
  3260. });
  3261. }
  3262. if (this._config.touch) {
  3263. this._addTouchEventListeners();
  3264. }
  3265. };
  3266. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3267. var _this3 = this;
  3268. if (!this._touchSupported) {
  3269. return;
  3270. }
  3271. var start = function start(event) {
  3272. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3273. _this3.touchStartX = event.originalEvent.clientX;
  3274. } else if (!_this3._pointerEvent) {
  3275. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3276. }
  3277. };
  3278. var move = function move(event) {
  3279. // ensure swiping with one touch and not pinching
  3280. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3281. _this3.touchDeltaX = 0;
  3282. } else {
  3283. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3284. }
  3285. };
  3286. var end = function end(event) {
  3287. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3288. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3289. }
  3290. _this3._handleSwipe();
  3291. if (_this3._config.pause === 'hover') {
  3292. // If it's a touch-enabled device, mouseenter/leave are fired as
  3293. // part of the mouse compatibility events on first tap - the carousel
  3294. // would stop cycling until user tapped out of it;
  3295. // here, we listen for touchend, explicitly pause the carousel
  3296. // (as if it's the second time we tap on it, mouseenter compat event
  3297. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3298. // events to fire) we explicitly restart cycling
  3299. _this3.pause();
  3300. if (_this3.touchTimeout) {
  3301. clearTimeout(_this3.touchTimeout);
  3302. }
  3303. _this3.touchTimeout = setTimeout(function (event) {
  3304. return _this3.cycle(event);
  3305. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3306. }
  3307. };
  3308. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3309. return e.preventDefault();
  3310. });
  3311. if (this._pointerEvent) {
  3312. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3313. return start(event);
  3314. });
  3315. $(this._element).on(Event$2.POINTERUP, function (event) {
  3316. return end(event);
  3317. });
  3318. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3319. } else {
  3320. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3321. return start(event);
  3322. });
  3323. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3324. return move(event);
  3325. });
  3326. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3327. return end(event);
  3328. });
  3329. }
  3330. };
  3331. _proto._keydown = function _keydown(event) {
  3332. if (/input|textarea/i.test(event.target.tagName)) {
  3333. return;
  3334. }
  3335. switch (event.which) {
  3336. case ARROW_LEFT_KEYCODE:
  3337. event.preventDefault();
  3338. this.prev();
  3339. break;
  3340. case ARROW_RIGHT_KEYCODE:
  3341. event.preventDefault();
  3342. this.next();
  3343. break;
  3344. }
  3345. };
  3346. _proto._getItemIndex = function _getItemIndex(element) {
  3347. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3348. return this._items.indexOf(element);
  3349. };
  3350. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3351. var isNextDirection = direction === Direction.NEXT;
  3352. var isPrevDirection = direction === Direction.PREV;
  3353. var activeIndex = this._getItemIndex(activeElement);
  3354. var lastItemIndex = this._items.length - 1;
  3355. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3356. if (isGoingToWrap && !this._config.wrap) {
  3357. return activeElement;
  3358. }
  3359. var delta = direction === Direction.PREV ? -1 : 1;
  3360. var itemIndex = (activeIndex + delta) % this._items.length;
  3361. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3362. };
  3363. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3364. var targetIndex = this._getItemIndex(relatedTarget);
  3365. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3366. var slideEvent = $.Event(Event$2.SLIDE, {
  3367. relatedTarget: relatedTarget,
  3368. direction: eventDirectionName,
  3369. from: fromIndex,
  3370. to: targetIndex
  3371. });
  3372. $(this._element).trigger(slideEvent);
  3373. return slideEvent;
  3374. };
  3375. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3376. if (this._indicatorsElement) {
  3377. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3378. $(indicators).removeClass(ClassName$2.ACTIVE);
  3379. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3380. if (nextIndicator) {
  3381. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3382. }
  3383. }
  3384. };
  3385. _proto._slide = function _slide(direction, element) {
  3386. var _this4 = this;
  3387. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3388. var activeElementIndex = this._getItemIndex(activeElement);
  3389. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3390. var nextElementIndex = this._getItemIndex(nextElement);
  3391. var isCycling = Boolean(this._interval);
  3392. var directionalClassName;
  3393. var orderClassName;
  3394. var eventDirectionName;
  3395. if (direction === Direction.NEXT) {
  3396. directionalClassName = ClassName$2.LEFT;
  3397. orderClassName = ClassName$2.NEXT;
  3398. eventDirectionName = Direction.LEFT;
  3399. } else {
  3400. directionalClassName = ClassName$2.RIGHT;
  3401. orderClassName = ClassName$2.PREV;
  3402. eventDirectionName = Direction.RIGHT;
  3403. }
  3404. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3405. this._isSliding = false;
  3406. return;
  3407. }
  3408. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3409. if (slideEvent.isDefaultPrevented()) {
  3410. return;
  3411. }
  3412. if (!activeElement || !nextElement) {
  3413. // Some weirdness is happening, so we bail
  3414. return;
  3415. }
  3416. this._isSliding = true;
  3417. if (isCycling) {
  3418. this.pause();
  3419. }
  3420. this._setActiveIndicatorElement(nextElement);
  3421. var slidEvent = $.Event(Event$2.SLID, {
  3422. relatedTarget: nextElement,
  3423. direction: eventDirectionName,
  3424. from: activeElementIndex,
  3425. to: nextElementIndex
  3426. });
  3427. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3428. $(nextElement).addClass(orderClassName);
  3429. Util.reflow(nextElement);
  3430. $(activeElement).addClass(directionalClassName);
  3431. $(nextElement).addClass(directionalClassName);
  3432. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3433. if (nextElementInterval) {
  3434. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3435. this._config.interval = nextElementInterval;
  3436. } else {
  3437. this._config.interval = this._config.defaultInterval || this._config.interval;
  3438. }
  3439. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3440. $(activeElement).one(Util.TRANSITION_END, function () {
  3441. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3442. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3443. _this4._isSliding = false;
  3444. setTimeout(function () {
  3445. return $(_this4._element).trigger(slidEvent);
  3446. }, 0);
  3447. }).emulateTransitionEnd(transitionDuration);
  3448. } else {
  3449. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3450. $(nextElement).addClass(ClassName$2.ACTIVE);
  3451. this._isSliding = false;
  3452. $(this._element).trigger(slidEvent);
  3453. }
  3454. if (isCycling) {
  3455. this.cycle();
  3456. }
  3457. } // Static
  3458. ;
  3459. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3460. return this.each(function () {
  3461. var data = $(this).data(DATA_KEY$2);
  3462. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3463. if (typeof config === 'object') {
  3464. _config = _objectSpread2({}, _config, {}, config);
  3465. }
  3466. var action = typeof config === 'string' ? config : _config.slide;
  3467. if (!data) {
  3468. data = new Carousel(this, _config);
  3469. $(this).data(DATA_KEY$2, data);
  3470. }
  3471. if (typeof config === 'number') {
  3472. data.to(config);
  3473. } else if (typeof action === 'string') {
  3474. if (typeof data[action] === 'undefined') {
  3475. throw new TypeError("No method named \"" + action + "\"");
  3476. }
  3477. data[action]();
  3478. } else if (_config.interval && _config.ride) {
  3479. data.pause();
  3480. data.cycle();
  3481. }
  3482. });
  3483. };
  3484. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3485. var selector = Util.getSelectorFromElement(this);
  3486. if (!selector) {
  3487. return;
  3488. }
  3489. var target = $(selector)[0];
  3490. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3491. return;
  3492. }
  3493. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3494. var slideIndex = this.getAttribute('data-slide-to');
  3495. if (slideIndex) {
  3496. config.interval = false;
  3497. }
  3498. Carousel._jQueryInterface.call($(target), config);
  3499. if (slideIndex) {
  3500. $(target).data(DATA_KEY$2).to(slideIndex);
  3501. }
  3502. event.preventDefault();
  3503. };
  3504. _createClass(Carousel, null, [{
  3505. key: "VERSION",
  3506. get: function get() {
  3507. return VERSION$2;
  3508. }
  3509. }, {
  3510. key: "Default",
  3511. get: function get() {
  3512. return Default;
  3513. }
  3514. }]);
  3515. return Carousel;
  3516. }();
  3517. /**
  3518. * ------------------------------------------------------------------------
  3519. * Data Api implementation
  3520. * ------------------------------------------------------------------------
  3521. */
  3522. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3523. $(window).on(Event$2.LOAD_DATA_API, function () {
  3524. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3525. for (var i = 0, len = carousels.length; i < len; i++) {
  3526. var $carousel = $(carousels[i]);
  3527. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3528. }
  3529. });
  3530. /**
  3531. * ------------------------------------------------------------------------
  3532. * jQuery
  3533. * ------------------------------------------------------------------------
  3534. */
  3535. $.fn[NAME$2] = Carousel._jQueryInterface;
  3536. $.fn[NAME$2].Constructor = Carousel;
  3537. $.fn[NAME$2].noConflict = function () {
  3538. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3539. return Carousel._jQueryInterface;
  3540. };
  3541. /**
  3542. * ------------------------------------------------------------------------
  3543. * Constants
  3544. * ------------------------------------------------------------------------
  3545. */
  3546. var NAME$3 = 'collapse';
  3547. var VERSION$3 = '4.4.1';
  3548. var DATA_KEY$3 = 'bs.collapse';
  3549. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3550. var DATA_API_KEY$3 = '.data-api';
  3551. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3552. var Default$1 = {
  3553. toggle: true,
  3554. parent: ''
  3555. };
  3556. var DefaultType$1 = {
  3557. toggle: 'boolean',
  3558. parent: '(string|element)'
  3559. };
  3560. var Event$3 = {
  3561. SHOW: "show" + EVENT_KEY$3,
  3562. SHOWN: "shown" + EVENT_KEY$3,
  3563. HIDE: "hide" + EVENT_KEY$3,
  3564. HIDDEN: "hidden" + EVENT_KEY$3,
  3565. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3566. };
  3567. var ClassName$3 = {
  3568. SHOW: 'show',
  3569. COLLAPSE: 'collapse',
  3570. COLLAPSING: 'collapsing',
  3571. COLLAPSED: 'collapsed'
  3572. };
  3573. var Dimension = {
  3574. WIDTH: 'width',
  3575. HEIGHT: 'height'
  3576. };
  3577. var Selector$3 = {
  3578. ACTIVES: '.show, .collapsing',
  3579. DATA_TOGGLE: '[data-toggle="collapse"]'
  3580. };
  3581. /**
  3582. * ------------------------------------------------------------------------
  3583. * Class Definition
  3584. * ------------------------------------------------------------------------
  3585. */
  3586. var Collapse =
  3587. /*#__PURE__*/
  3588. function () {
  3589. function Collapse(element, config) {
  3590. this._isTransitioning = false;
  3591. this._element = element;
  3592. this._config = this._getConfig(config);
  3593. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3594. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3595. for (var i = 0, len = toggleList.length; i < len; i++) {
  3596. var elem = toggleList[i];
  3597. var selector = Util.getSelectorFromElement(elem);
  3598. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3599. return foundElem === element;
  3600. });
  3601. if (selector !== null && filterElement.length > 0) {
  3602. this._selector = selector;
  3603. this._triggerArray.push(elem);
  3604. }
  3605. }
  3606. this._parent = this._config.parent ? this._getParent() : null;
  3607. if (!this._config.parent) {
  3608. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3609. }
  3610. if (this._config.toggle) {
  3611. this.toggle();
  3612. }
  3613. } // Getters
  3614. var _proto = Collapse.prototype;
  3615. // Public
  3616. _proto.toggle = function toggle() {
  3617. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3618. this.hide();
  3619. } else {
  3620. this.show();
  3621. }
  3622. };
  3623. _proto.show = function show() {
  3624. var _this = this;
  3625. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3626. return;
  3627. }
  3628. var actives;
  3629. var activesData;
  3630. if (this._parent) {
  3631. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3632. if (typeof _this._config.parent === 'string') {
  3633. return elem.getAttribute('data-parent') === _this._config.parent;
  3634. }
  3635. return elem.classList.contains(ClassName$3.COLLAPSE);
  3636. });
  3637. if (actives.length === 0) {
  3638. actives = null;
  3639. }
  3640. }
  3641. if (actives) {
  3642. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3643. if (activesData && activesData._isTransitioning) {
  3644. return;
  3645. }
  3646. }
  3647. var startEvent = $.Event(Event$3.SHOW);
  3648. $(this._element).trigger(startEvent);
  3649. if (startEvent.isDefaultPrevented()) {
  3650. return;
  3651. }
  3652. if (actives) {
  3653. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3654. if (!activesData) {
  3655. $(actives).data(DATA_KEY$3, null);
  3656. }
  3657. }
  3658. var dimension = this._getDimension();
  3659. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3660. this._element.style[dimension] = 0;
  3661. if (this._triggerArray.length) {
  3662. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3663. }
  3664. this.setTransitioning(true);
  3665. var complete = function complete() {
  3666. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3667. _this._element.style[dimension] = '';
  3668. _this.setTransitioning(false);
  3669. $(_this._element).trigger(Event$3.SHOWN);
  3670. };
  3671. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3672. var scrollSize = "scroll" + capitalizedDimension;
  3673. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3674. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3675. this._element.style[dimension] = this._element[scrollSize] + "px";
  3676. };
  3677. _proto.hide = function hide() {
  3678. var _this2 = this;
  3679. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3680. return;
  3681. }
  3682. var startEvent = $.Event(Event$3.HIDE);
  3683. $(this._element).trigger(startEvent);
  3684. if (startEvent.isDefaultPrevented()) {
  3685. return;
  3686. }
  3687. var dimension = this._getDimension();
  3688. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3689. Util.reflow(this._element);
  3690. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3691. var triggerArrayLength = this._triggerArray.length;
  3692. if (triggerArrayLength > 0) {
  3693. for (var i = 0; i < triggerArrayLength; i++) {
  3694. var trigger = this._triggerArray[i];
  3695. var selector = Util.getSelectorFromElement(trigger);
  3696. if (selector !== null) {
  3697. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3698. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3699. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3700. }
  3701. }
  3702. }
  3703. }
  3704. this.setTransitioning(true);
  3705. var complete = function complete() {
  3706. _this2.setTransitioning(false);
  3707. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3708. };
  3709. this._element.style[dimension] = '';
  3710. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3711. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3712. };
  3713. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3714. this._isTransitioning = isTransitioning;
  3715. };
  3716. _proto.dispose = function dispose() {
  3717. $.removeData(this._element, DATA_KEY$3);
  3718. this._config = null;
  3719. this._parent = null;
  3720. this._element = null;
  3721. this._triggerArray = null;
  3722. this._isTransitioning = null;
  3723. } // Private
  3724. ;
  3725. _proto._getConfig = function _getConfig(config) {
  3726. config = _objectSpread2({}, Default$1, {}, config);
  3727. config.toggle = Boolean(config.toggle); // Coerce string values
  3728. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3729. return config;
  3730. };
  3731. _proto._getDimension = function _getDimension() {
  3732. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3733. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3734. };
  3735. _proto._getParent = function _getParent() {
  3736. var _this3 = this;
  3737. var parent;
  3738. if (Util.isElement(this._config.parent)) {
  3739. parent = this._config.parent; // It's a jQuery object
  3740. if (typeof this._config.parent.jquery !== 'undefined') {
  3741. parent = this._config.parent[0];
  3742. }
  3743. } else {
  3744. parent = document.querySelector(this._config.parent);
  3745. }
  3746. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3747. var children = [].slice.call(parent.querySelectorAll(selector));
  3748. $(children).each(function (i, element) {
  3749. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3750. });
  3751. return parent;
  3752. };
  3753. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3754. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3755. if (triggerArray.length) {
  3756. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3757. }
  3758. } // Static
  3759. ;
  3760. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3761. var selector = Util.getSelectorFromElement(element);
  3762. return selector ? document.querySelector(selector) : null;
  3763. };
  3764. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3765. return this.each(function () {
  3766. var $this = $(this);
  3767. var data = $this.data(DATA_KEY$3);
  3768. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3769. if (!data && _config.toggle && /show|hide/.test(config)) {
  3770. _config.toggle = false;
  3771. }
  3772. if (!data) {
  3773. data = new Collapse(this, _config);
  3774. $this.data(DATA_KEY$3, data);
  3775. }
  3776. if (typeof config === 'string') {
  3777. if (typeof data[config] === 'undefined') {
  3778. throw new TypeError("No method named \"" + config + "\"");
  3779. }
  3780. data[config]();
  3781. }
  3782. });
  3783. };
  3784. _createClass(Collapse, null, [{
  3785. key: "VERSION",
  3786. get: function get() {
  3787. return VERSION$3;
  3788. }
  3789. }, {
  3790. key: "Default",
  3791. get: function get() {
  3792. return Default$1;
  3793. }
  3794. }]);
  3795. return Collapse;
  3796. }();
  3797. /**
  3798. * ------------------------------------------------------------------------
  3799. * Data Api implementation
  3800. * ------------------------------------------------------------------------
  3801. */
  3802. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3803. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3804. if (event.currentTarget.tagName === 'A') {
  3805. event.preventDefault();
  3806. }
  3807. var $trigger = $(this);
  3808. var selector = Util.getSelectorFromElement(this);
  3809. var selectors = [].slice.call(document.querySelectorAll(selector));
  3810. $(selectors).each(function () {
  3811. var $target = $(this);
  3812. var data = $target.data(DATA_KEY$3);
  3813. var config = data ? 'toggle' : $trigger.data();
  3814. Collapse._jQueryInterface.call($target, config);
  3815. });
  3816. });
  3817. /**
  3818. * ------------------------------------------------------------------------
  3819. * jQuery
  3820. * ------------------------------------------------------------------------
  3821. */
  3822. $.fn[NAME$3] = Collapse._jQueryInterface;
  3823. $.fn[NAME$3].Constructor = Collapse;
  3824. $.fn[NAME$3].noConflict = function () {
  3825. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3826. return Collapse._jQueryInterface;
  3827. };
  3828. /**
  3829. * ------------------------------------------------------------------------
  3830. * Constants
  3831. * ------------------------------------------------------------------------
  3832. */
  3833. var NAME$4 = 'dropdown';
  3834. var VERSION$4 = '4.4.1';
  3835. var DATA_KEY$4 = 'bs.dropdown';
  3836. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3837. var DATA_API_KEY$4 = '.data-api';
  3838. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3839. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3840. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3841. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3842. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3843. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3844. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3845. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3846. var Event$4 = {
  3847. HIDE: "hide" + EVENT_KEY$4,
  3848. HIDDEN: "hidden" + EVENT_KEY$4,
  3849. SHOW: "show" + EVENT_KEY$4,
  3850. SHOWN: "shown" + EVENT_KEY$4,
  3851. CLICK: "click" + EVENT_KEY$4,
  3852. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3853. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3854. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3855. };
  3856. var ClassName$4 = {
  3857. DISABLED: 'disabled',
  3858. SHOW: 'show',
  3859. DROPUP: 'dropup',
  3860. DROPRIGHT: 'dropright',
  3861. DROPLEFT: 'dropleft',
  3862. MENURIGHT: 'dropdown-menu-right',
  3863. MENULEFT: 'dropdown-menu-left',
  3864. POSITION_STATIC: 'position-static'
  3865. };
  3866. var Selector$4 = {
  3867. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3868. FORM_CHILD: '.dropdown form',
  3869. MENU: '.dropdown-menu',
  3870. NAVBAR_NAV: '.navbar-nav',
  3871. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3872. };
  3873. var AttachmentMap = {
  3874. TOP: 'top-start',
  3875. TOPEND: 'top-end',
  3876. BOTTOM: 'bottom-start',
  3877. BOTTOMEND: 'bottom-end',
  3878. RIGHT: 'right-start',
  3879. RIGHTEND: 'right-end',
  3880. LEFT: 'left-start',
  3881. LEFTEND: 'left-end'
  3882. };
  3883. var Default$2 = {
  3884. offset: 0,
  3885. flip: true,
  3886. boundary: 'scrollParent',
  3887. reference: 'toggle',
  3888. display: 'dynamic',
  3889. popperConfig: null
  3890. };
  3891. var DefaultType$2 = {
  3892. offset: '(number|string|function)',
  3893. flip: 'boolean',
  3894. boundary: '(string|element)',
  3895. reference: '(string|element)',
  3896. display: 'string',
  3897. popperConfig: '(null|object)'
  3898. };
  3899. /**
  3900. * ------------------------------------------------------------------------
  3901. * Class Definition
  3902. * ------------------------------------------------------------------------
  3903. */
  3904. var Dropdown =
  3905. /*#__PURE__*/
  3906. function () {
  3907. function Dropdown(element, config) {
  3908. this._element = element;
  3909. this._popper = null;
  3910. this._config = this._getConfig(config);
  3911. this._menu = this._getMenuElement();
  3912. this._inNavbar = this._detectNavbar();
  3913. this._addEventListeners();
  3914. } // Getters
  3915. var _proto = Dropdown.prototype;
  3916. // Public
  3917. _proto.toggle = function toggle() {
  3918. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3919. return;
  3920. }
  3921. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3922. Dropdown._clearMenus();
  3923. if (isActive) {
  3924. return;
  3925. }
  3926. this.show(true);
  3927. };
  3928. _proto.show = function show(usePopper) {
  3929. if (usePopper === void 0) {
  3930. usePopper = false;
  3931. }
  3932. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3933. return;
  3934. }
  3935. var relatedTarget = {
  3936. relatedTarget: this._element
  3937. };
  3938. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3939. var parent = Dropdown._getParentFromElement(this._element);
  3940. $(parent).trigger(showEvent);
  3941. if (showEvent.isDefaultPrevented()) {
  3942. return;
  3943. } // Disable totally Popper.js for Dropdown in Navbar
  3944. if (!this._inNavbar && usePopper) {
  3945. /**
  3946. * Check for Popper dependency
  3947. * Popper - https://popper.js.org
  3948. */
  3949. if (typeof Popper === 'undefined') {
  3950. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3951. }
  3952. var referenceElement = this._element;
  3953. if (this._config.reference === 'parent') {
  3954. referenceElement = parent;
  3955. } else if (Util.isElement(this._config.reference)) {
  3956. referenceElement = this._config.reference; // Check if it's jQuery element
  3957. if (typeof this._config.reference.jquery !== 'undefined') {
  3958. referenceElement = this._config.reference[0];
  3959. }
  3960. } // If boundary is not `scrollParent`, then set position to `static`
  3961. // to allow the menu to "escape" the scroll parent's boundaries
  3962. // https://github.com/twbs/bootstrap/issues/24251
  3963. if (this._config.boundary !== 'scrollParent') {
  3964. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3965. }
  3966. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3967. } // If this is a touch-enabled device we add extra
  3968. // empty mouseover listeners to the body's immediate children;
  3969. // only needed because of broken event delegation on iOS
  3970. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3971. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3972. $(document.body).children().on('mouseover', null, $.noop);
  3973. }
  3974. this._element.focus();
  3975. this._element.setAttribute('aria-expanded', true);
  3976. $(this._menu).toggleClass(ClassName$4.SHOW);
  3977. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3978. };
  3979. _proto.hide = function hide() {
  3980. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3981. return;
  3982. }
  3983. var relatedTarget = {
  3984. relatedTarget: this._element
  3985. };
  3986. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3987. var parent = Dropdown._getParentFromElement(this._element);
  3988. $(parent).trigger(hideEvent);
  3989. if (hideEvent.isDefaultPrevented()) {
  3990. return;
  3991. }
  3992. if (this._popper) {
  3993. this._popper.destroy();
  3994. }
  3995. $(this._menu).toggleClass(ClassName$4.SHOW);
  3996. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3997. };
  3998. _proto.dispose = function dispose() {
  3999. $.removeData(this._element, DATA_KEY$4);
  4000. $(this._element).off(EVENT_KEY$4);
  4001. this._element = null;
  4002. this._menu = null;
  4003. if (this._popper !== null) {
  4004. this._popper.destroy();
  4005. this._popper = null;
  4006. }
  4007. };
  4008. _proto.update = function update() {
  4009. this._inNavbar = this._detectNavbar();
  4010. if (this._popper !== null) {
  4011. this._popper.scheduleUpdate();
  4012. }
  4013. } // Private
  4014. ;
  4015. _proto._addEventListeners = function _addEventListeners() {
  4016. var _this = this;
  4017. $(this._element).on(Event$4.CLICK, function (event) {
  4018. event.preventDefault();
  4019. event.stopPropagation();
  4020. _this.toggle();
  4021. });
  4022. };
  4023. _proto._getConfig = function _getConfig(config) {
  4024. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4025. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4026. return config;
  4027. };
  4028. _proto._getMenuElement = function _getMenuElement() {
  4029. if (!this._menu) {
  4030. var parent = Dropdown._getParentFromElement(this._element);
  4031. if (parent) {
  4032. this._menu = parent.querySelector(Selector$4.MENU);
  4033. }
  4034. }
  4035. return this._menu;
  4036. };
  4037. _proto._getPlacement = function _getPlacement() {
  4038. var $parentDropdown = $(this._element.parentNode);
  4039. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4040. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4041. placement = AttachmentMap.TOP;
  4042. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4043. placement = AttachmentMap.TOPEND;
  4044. }
  4045. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4046. placement = AttachmentMap.RIGHT;
  4047. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4048. placement = AttachmentMap.LEFT;
  4049. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4050. placement = AttachmentMap.BOTTOMEND;
  4051. }
  4052. return placement;
  4053. };
  4054. _proto._detectNavbar = function _detectNavbar() {
  4055. return $(this._element).closest('.navbar').length > 0;
  4056. };
  4057. _proto._getOffset = function _getOffset() {
  4058. var _this2 = this;
  4059. var offset = {};
  4060. if (typeof this._config.offset === 'function') {
  4061. offset.fn = function (data) {
  4062. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4063. return data;
  4064. };
  4065. } else {
  4066. offset.offset = this._config.offset;
  4067. }
  4068. return offset;
  4069. };
  4070. _proto._getPopperConfig = function _getPopperConfig() {
  4071. var popperConfig = {
  4072. placement: this._getPlacement(),
  4073. modifiers: {
  4074. offset: this._getOffset(),
  4075. flip: {
  4076. enabled: this._config.flip
  4077. },
  4078. preventOverflow: {
  4079. boundariesElement: this._config.boundary
  4080. }
  4081. }
  4082. }; // Disable Popper.js if we have a static display
  4083. if (this._config.display === 'static') {
  4084. popperConfig.modifiers.applyStyle = {
  4085. enabled: false
  4086. };
  4087. }
  4088. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4089. } // Static
  4090. ;
  4091. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4092. return this.each(function () {
  4093. var data = $(this).data(DATA_KEY$4);
  4094. var _config = typeof config === 'object' ? config : null;
  4095. if (!data) {
  4096. data = new Dropdown(this, _config);
  4097. $(this).data(DATA_KEY$4, data);
  4098. }
  4099. if (typeof config === 'string') {
  4100. if (typeof data[config] === 'undefined') {
  4101. throw new TypeError("No method named \"" + config + "\"");
  4102. }
  4103. data[config]();
  4104. }
  4105. });
  4106. };
  4107. Dropdown._clearMenus = function _clearMenus(event) {
  4108. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4109. return;
  4110. }
  4111. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4112. for (var i = 0, len = toggles.length; i < len; i++) {
  4113. var parent = Dropdown._getParentFromElement(toggles[i]);
  4114. var context = $(toggles[i]).data(DATA_KEY$4);
  4115. var relatedTarget = {
  4116. relatedTarget: toggles[i]
  4117. };
  4118. if (event && event.type === 'click') {
  4119. relatedTarget.clickEvent = event;
  4120. }
  4121. if (!context) {
  4122. continue;
  4123. }
  4124. var dropdownMenu = context._menu;
  4125. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4126. continue;
  4127. }
  4128. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4129. continue;
  4130. }
  4131. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4132. $(parent).trigger(hideEvent);
  4133. if (hideEvent.isDefaultPrevented()) {
  4134. continue;
  4135. } // If this is a touch-enabled device we remove the extra
  4136. // empty mouseover listeners we added for iOS support
  4137. if ('ontouchstart' in document.documentElement) {
  4138. $(document.body).children().off('mouseover', null, $.noop);
  4139. }
  4140. toggles[i].setAttribute('aria-expanded', 'false');
  4141. if (context._popper) {
  4142. context._popper.destroy();
  4143. }
  4144. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4145. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4146. }
  4147. };
  4148. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4149. var parent;
  4150. var selector = Util.getSelectorFromElement(element);
  4151. if (selector) {
  4152. parent = document.querySelector(selector);
  4153. }
  4154. return parent || element.parentNode;
  4155. } // eslint-disable-next-line complexity
  4156. ;
  4157. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4158. // If not input/textarea:
  4159. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4160. // If input/textarea:
  4161. // - If space key => not a dropdown command
  4162. // - If key is other than escape
  4163. // - If key is not up or down => not a dropdown command
  4164. // - If trigger inside the menu => not a dropdown command
  4165. 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)) {
  4166. return;
  4167. }
  4168. event.preventDefault();
  4169. event.stopPropagation();
  4170. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4171. return;
  4172. }
  4173. var parent = Dropdown._getParentFromElement(this);
  4174. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4175. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4176. return;
  4177. }
  4178. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4179. if (event.which === ESCAPE_KEYCODE) {
  4180. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4181. $(toggle).trigger('focus');
  4182. }
  4183. $(this).trigger('click');
  4184. return;
  4185. }
  4186. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4187. return $(item).is(':visible');
  4188. });
  4189. if (items.length === 0) {
  4190. return;
  4191. }
  4192. var index = items.indexOf(event.target);
  4193. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4194. // Up
  4195. index--;
  4196. }
  4197. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4198. // Down
  4199. index++;
  4200. }
  4201. if (index < 0) {
  4202. index = 0;
  4203. }
  4204. items[index].focus();
  4205. };
  4206. _createClass(Dropdown, null, [{
  4207. key: "VERSION",
  4208. get: function get() {
  4209. return VERSION$4;
  4210. }
  4211. }, {
  4212. key: "Default",
  4213. get: function get() {
  4214. return Default$2;
  4215. }
  4216. }, {
  4217. key: "DefaultType",
  4218. get: function get() {
  4219. return DefaultType$2;
  4220. }
  4221. }]);
  4222. return Dropdown;
  4223. }();
  4224. /**
  4225. * ------------------------------------------------------------------------
  4226. * Data Api implementation
  4227. * ------------------------------------------------------------------------
  4228. */
  4229. $(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) {
  4230. event.preventDefault();
  4231. event.stopPropagation();
  4232. Dropdown._jQueryInterface.call($(this), 'toggle');
  4233. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4234. e.stopPropagation();
  4235. });
  4236. /**
  4237. * ------------------------------------------------------------------------
  4238. * jQuery
  4239. * ------------------------------------------------------------------------
  4240. */
  4241. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4242. $.fn[NAME$4].Constructor = Dropdown;
  4243. $.fn[NAME$4].noConflict = function () {
  4244. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4245. return Dropdown._jQueryInterface;
  4246. };
  4247. /**
  4248. * ------------------------------------------------------------------------
  4249. * Constants
  4250. * ------------------------------------------------------------------------
  4251. */
  4252. var NAME$5 = 'modal';
  4253. var VERSION$5 = '4.4.1';
  4254. var DATA_KEY$5 = 'bs.modal';
  4255. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4256. var DATA_API_KEY$5 = '.data-api';
  4257. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4258. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4259. var Default$3 = {
  4260. backdrop: true,
  4261. keyboard: true,
  4262. focus: true,
  4263. show: true
  4264. };
  4265. var DefaultType$3 = {
  4266. backdrop: '(boolean|string)',
  4267. keyboard: 'boolean',
  4268. focus: 'boolean',
  4269. show: 'boolean'
  4270. };
  4271. var Event$5 = {
  4272. HIDE: "hide" + EVENT_KEY$5,
  4273. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4274. HIDDEN: "hidden" + EVENT_KEY$5,
  4275. SHOW: "show" + EVENT_KEY$5,
  4276. SHOWN: "shown" + EVENT_KEY$5,
  4277. FOCUSIN: "focusin" + EVENT_KEY$5,
  4278. RESIZE: "resize" + EVENT_KEY$5,
  4279. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4280. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4281. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4282. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4283. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4284. };
  4285. var ClassName$5 = {
  4286. SCROLLABLE: 'modal-dialog-scrollable',
  4287. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4288. BACKDROP: 'modal-backdrop',
  4289. OPEN: 'modal-open',
  4290. FADE: 'fade',
  4291. SHOW: 'show',
  4292. STATIC: 'modal-static'
  4293. };
  4294. var Selector$5 = {
  4295. DIALOG: '.modal-dialog',
  4296. MODAL_BODY: '.modal-body',
  4297. DATA_TOGGLE: '[data-toggle="modal"]',
  4298. DATA_DISMISS: '[data-dismiss="modal"]',
  4299. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4300. STICKY_CONTENT: '.sticky-top'
  4301. };
  4302. /**
  4303. * ------------------------------------------------------------------------
  4304. * Class Definition
  4305. * ------------------------------------------------------------------------
  4306. */
  4307. var Modal =
  4308. /*#__PURE__*/
  4309. function () {
  4310. function Modal(element, config) {
  4311. this._config = this._getConfig(config);
  4312. this._element = element;
  4313. this._dialog = element.querySelector(Selector$5.DIALOG);
  4314. this._backdrop = null;
  4315. this._isShown = false;
  4316. this._isBodyOverflowing = false;
  4317. this._ignoreBackdropClick = false;
  4318. this._isTransitioning = false;
  4319. this._scrollbarWidth = 0;
  4320. } // Getters
  4321. var _proto = Modal.prototype;
  4322. // Public
  4323. _proto.toggle = function toggle(relatedTarget) {
  4324. return this._isShown ? this.hide() : this.show(relatedTarget);
  4325. };
  4326. _proto.show = function show(relatedTarget) {
  4327. var _this = this;
  4328. if (this._isShown || this._isTransitioning) {
  4329. return;
  4330. }
  4331. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4332. this._isTransitioning = true;
  4333. }
  4334. var showEvent = $.Event(Event$5.SHOW, {
  4335. relatedTarget: relatedTarget
  4336. });
  4337. $(this._element).trigger(showEvent);
  4338. if (this._isShown || showEvent.isDefaultPrevented()) {
  4339. return;
  4340. }
  4341. this._isShown = true;
  4342. this._checkScrollbar();
  4343. this._setScrollbar();
  4344. this._adjustDialog();
  4345. this._setEscapeEvent();
  4346. this._setResizeEvent();
  4347. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4348. return _this.hide(event);
  4349. });
  4350. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4351. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4352. if ($(event.target).is(_this._element)) {
  4353. _this._ignoreBackdropClick = true;
  4354. }
  4355. });
  4356. });
  4357. this._showBackdrop(function () {
  4358. return _this._showElement(relatedTarget);
  4359. });
  4360. };
  4361. _proto.hide = function hide(event) {
  4362. var _this2 = this;
  4363. if (event) {
  4364. event.preventDefault();
  4365. }
  4366. if (!this._isShown || this._isTransitioning) {
  4367. return;
  4368. }
  4369. var hideEvent = $.Event(Event$5.HIDE);
  4370. $(this._element).trigger(hideEvent);
  4371. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4372. return;
  4373. }
  4374. this._isShown = false;
  4375. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4376. if (transition) {
  4377. this._isTransitioning = true;
  4378. }
  4379. this._setEscapeEvent();
  4380. this._setResizeEvent();
  4381. $(document).off(Event$5.FOCUSIN);
  4382. $(this._element).removeClass(ClassName$5.SHOW);
  4383. $(this._element).off(Event$5.CLICK_DISMISS);
  4384. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4385. if (transition) {
  4386. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4387. $(this._element).one(Util.TRANSITION_END, function (event) {
  4388. return _this2._hideModal(event);
  4389. }).emulateTransitionEnd(transitionDuration);
  4390. } else {
  4391. this._hideModal();
  4392. }
  4393. };
  4394. _proto.dispose = function dispose() {
  4395. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4396. return $(htmlElement).off(EVENT_KEY$5);
  4397. });
  4398. /**
  4399. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4400. * Do not move `document` in `htmlElements` array
  4401. * It will remove `Event.CLICK_DATA_API` event that should remain
  4402. */
  4403. $(document).off(Event$5.FOCUSIN);
  4404. $.removeData(this._element, DATA_KEY$5);
  4405. this._config = null;
  4406. this._element = null;
  4407. this._dialog = null;
  4408. this._backdrop = null;
  4409. this._isShown = null;
  4410. this._isBodyOverflowing = null;
  4411. this._ignoreBackdropClick = null;
  4412. this._isTransitioning = null;
  4413. this._scrollbarWidth = null;
  4414. };
  4415. _proto.handleUpdate = function handleUpdate() {
  4416. this._adjustDialog();
  4417. } // Private
  4418. ;
  4419. _proto._getConfig = function _getConfig(config) {
  4420. config = _objectSpread2({}, Default$3, {}, config);
  4421. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4422. return config;
  4423. };
  4424. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4425. var _this3 = this;
  4426. if (this._config.backdrop === 'static') {
  4427. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4428. $(this._element).trigger(hideEventPrevented);
  4429. if (hideEventPrevented.defaultPrevented) {
  4430. return;
  4431. }
  4432. this._element.classList.add(ClassName$5.STATIC);
  4433. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4434. $(this._element).one(Util.TRANSITION_END, function () {
  4435. _this3._element.classList.remove(ClassName$5.STATIC);
  4436. }).emulateTransitionEnd(modalTransitionDuration);
  4437. this._element.focus();
  4438. } else {
  4439. this.hide();
  4440. }
  4441. };
  4442. _proto._showElement = function _showElement(relatedTarget) {
  4443. var _this4 = this;
  4444. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4445. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4446. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4447. // Don't move modal's DOM position
  4448. document.body.appendChild(this._element);
  4449. }
  4450. this._element.style.display = 'block';
  4451. this._element.removeAttribute('aria-hidden');
  4452. this._element.setAttribute('aria-modal', true);
  4453. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4454. modalBody.scrollTop = 0;
  4455. } else {
  4456. this._element.scrollTop = 0;
  4457. }
  4458. if (transition) {
  4459. Util.reflow(this._element);
  4460. }
  4461. $(this._element).addClass(ClassName$5.SHOW);
  4462. if (this._config.focus) {
  4463. this._enforceFocus();
  4464. }
  4465. var shownEvent = $.Event(Event$5.SHOWN, {
  4466. relatedTarget: relatedTarget
  4467. });
  4468. var transitionComplete = function transitionComplete() {
  4469. if (_this4._config.focus) {
  4470. _this4._element.focus();
  4471. }
  4472. _this4._isTransitioning = false;
  4473. $(_this4._element).trigger(shownEvent);
  4474. };
  4475. if (transition) {
  4476. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4477. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4478. } else {
  4479. transitionComplete();
  4480. }
  4481. };
  4482. _proto._enforceFocus = function _enforceFocus() {
  4483. var _this5 = this;
  4484. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4485. .on(Event$5.FOCUSIN, function (event) {
  4486. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4487. _this5._element.focus();
  4488. }
  4489. });
  4490. };
  4491. _proto._setEscapeEvent = function _setEscapeEvent() {
  4492. var _this6 = this;
  4493. if (this._isShown && this._config.keyboard) {
  4494. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4495. if (event.which === ESCAPE_KEYCODE$1) {
  4496. _this6._triggerBackdropTransition();
  4497. }
  4498. });
  4499. } else if (!this._isShown) {
  4500. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4501. }
  4502. };
  4503. _proto._setResizeEvent = function _setResizeEvent() {
  4504. var _this7 = this;
  4505. if (this._isShown) {
  4506. $(window).on(Event$5.RESIZE, function (event) {
  4507. return _this7.handleUpdate(event);
  4508. });
  4509. } else {
  4510. $(window).off(Event$5.RESIZE);
  4511. }
  4512. };
  4513. _proto._hideModal = function _hideModal() {
  4514. var _this8 = this;
  4515. this._element.style.display = 'none';
  4516. this._element.setAttribute('aria-hidden', true);
  4517. this._element.removeAttribute('aria-modal');
  4518. this._isTransitioning = false;
  4519. this._showBackdrop(function () {
  4520. $(document.body).removeClass(ClassName$5.OPEN);
  4521. _this8._resetAdjustments();
  4522. _this8._resetScrollbar();
  4523. $(_this8._element).trigger(Event$5.HIDDEN);
  4524. });
  4525. };
  4526. _proto._removeBackdrop = function _removeBackdrop() {
  4527. if (this._backdrop) {
  4528. $(this._backdrop).remove();
  4529. this._backdrop = null;
  4530. }
  4531. };
  4532. _proto._showBackdrop = function _showBackdrop(callback) {
  4533. var _this9 = this;
  4534. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4535. if (this._isShown && this._config.backdrop) {
  4536. this._backdrop = document.createElement('div');
  4537. this._backdrop.className = ClassName$5.BACKDROP;
  4538. if (animate) {
  4539. this._backdrop.classList.add(animate);
  4540. }
  4541. $(this._backdrop).appendTo(document.body);
  4542. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4543. if (_this9._ignoreBackdropClick) {
  4544. _this9._ignoreBackdropClick = false;
  4545. return;
  4546. }
  4547. if (event.target !== event.currentTarget) {
  4548. return;
  4549. }
  4550. _this9._triggerBackdropTransition();
  4551. });
  4552. if (animate) {
  4553. Util.reflow(this._backdrop);
  4554. }
  4555. $(this._backdrop).addClass(ClassName$5.SHOW);
  4556. if (!callback) {
  4557. return;
  4558. }
  4559. if (!animate) {
  4560. callback();
  4561. return;
  4562. }
  4563. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4564. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4565. } else if (!this._isShown && this._backdrop) {
  4566. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4567. var callbackRemove = function callbackRemove() {
  4568. _this9._removeBackdrop();
  4569. if (callback) {
  4570. callback();
  4571. }
  4572. };
  4573. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4574. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4575. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4576. } else {
  4577. callbackRemove();
  4578. }
  4579. } else if (callback) {
  4580. callback();
  4581. }
  4582. } // ----------------------------------------------------------------------
  4583. // the following methods are used to handle overflowing modals
  4584. // todo (fat): these should probably be refactored out of modal.js
  4585. // ----------------------------------------------------------------------
  4586. ;
  4587. _proto._adjustDialog = function _adjustDialog() {
  4588. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4589. if (!this._isBodyOverflowing && isModalOverflowing) {
  4590. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4591. }
  4592. if (this._isBodyOverflowing && !isModalOverflowing) {
  4593. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4594. }
  4595. };
  4596. _proto._resetAdjustments = function _resetAdjustments() {
  4597. this._element.style.paddingLeft = '';
  4598. this._element.style.paddingRight = '';
  4599. };
  4600. _proto._checkScrollbar = function _checkScrollbar() {
  4601. var rect = document.body.getBoundingClientRect();
  4602. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4603. this._scrollbarWidth = this._getScrollbarWidth();
  4604. };
  4605. _proto._setScrollbar = function _setScrollbar() {
  4606. var _this10 = this;
  4607. if (this._isBodyOverflowing) {
  4608. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4609. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4610. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4611. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4612. $(fixedContent).each(function (index, element) {
  4613. var actualPadding = element.style.paddingRight;
  4614. var calculatedPadding = $(element).css('padding-right');
  4615. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4616. }); // Adjust sticky content margin
  4617. $(stickyContent).each(function (index, element) {
  4618. var actualMargin = element.style.marginRight;
  4619. var calculatedMargin = $(element).css('margin-right');
  4620. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4621. }); // Adjust body padding
  4622. var actualPadding = document.body.style.paddingRight;
  4623. var calculatedPadding = $(document.body).css('padding-right');
  4624. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4625. }
  4626. $(document.body).addClass(ClassName$5.OPEN);
  4627. };
  4628. _proto._resetScrollbar = function _resetScrollbar() {
  4629. // Restore fixed content padding
  4630. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4631. $(fixedContent).each(function (index, element) {
  4632. var padding = $(element).data('padding-right');
  4633. $(element).removeData('padding-right');
  4634. element.style.paddingRight = padding ? padding : '';
  4635. }); // Restore sticky content
  4636. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4637. $(elements).each(function (index, element) {
  4638. var margin = $(element).data('margin-right');
  4639. if (typeof margin !== 'undefined') {
  4640. $(element).css('margin-right', margin).removeData('margin-right');
  4641. }
  4642. }); // Restore body padding
  4643. var padding = $(document.body).data('padding-right');
  4644. $(document.body).removeData('padding-right');
  4645. document.body.style.paddingRight = padding ? padding : '';
  4646. };
  4647. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4648. // thx d.walsh
  4649. var scrollDiv = document.createElement('div');
  4650. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4651. document.body.appendChild(scrollDiv);
  4652. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4653. document.body.removeChild(scrollDiv);
  4654. return scrollbarWidth;
  4655. } // Static
  4656. ;
  4657. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4658. return this.each(function () {
  4659. var data = $(this).data(DATA_KEY$5);
  4660. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4661. if (!data) {
  4662. data = new Modal(this, _config);
  4663. $(this).data(DATA_KEY$5, data);
  4664. }
  4665. if (typeof config === 'string') {
  4666. if (typeof data[config] === 'undefined') {
  4667. throw new TypeError("No method named \"" + config + "\"");
  4668. }
  4669. data[config](relatedTarget);
  4670. } else if (_config.show) {
  4671. data.show(relatedTarget);
  4672. }
  4673. });
  4674. };
  4675. _createClass(Modal, null, [{
  4676. key: "VERSION",
  4677. get: function get() {
  4678. return VERSION$5;
  4679. }
  4680. }, {
  4681. key: "Default",
  4682. get: function get() {
  4683. return Default$3;
  4684. }
  4685. }]);
  4686. return Modal;
  4687. }();
  4688. /**
  4689. * ------------------------------------------------------------------------
  4690. * Data Api implementation
  4691. * ------------------------------------------------------------------------
  4692. */
  4693. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4694. var _this11 = this;
  4695. var target;
  4696. var selector = Util.getSelectorFromElement(this);
  4697. if (selector) {
  4698. target = document.querySelector(selector);
  4699. }
  4700. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4701. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4702. event.preventDefault();
  4703. }
  4704. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4705. if (showEvent.isDefaultPrevented()) {
  4706. // Only register focus restorer if modal will actually get shown
  4707. return;
  4708. }
  4709. $target.one(Event$5.HIDDEN, function () {
  4710. if ($(_this11).is(':visible')) {
  4711. _this11.focus();
  4712. }
  4713. });
  4714. });
  4715. Modal._jQueryInterface.call($(target), config, this);
  4716. });
  4717. /**
  4718. * ------------------------------------------------------------------------
  4719. * jQuery
  4720. * ------------------------------------------------------------------------
  4721. */
  4722. $.fn[NAME$5] = Modal._jQueryInterface;
  4723. $.fn[NAME$5].Constructor = Modal;
  4724. $.fn[NAME$5].noConflict = function () {
  4725. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4726. return Modal._jQueryInterface;
  4727. };
  4728. /**
  4729. * --------------------------------------------------------------------------
  4730. * Bootstrap (v4.4.1): tools/sanitizer.js
  4731. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4732. * --------------------------------------------------------------------------
  4733. */
  4734. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4735. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4736. var DefaultWhitelist = {
  4737. // Global attributes allowed on any supplied element below.
  4738. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4739. a: ['target', 'href', 'title', 'rel'],
  4740. area: [],
  4741. b: [],
  4742. br: [],
  4743. col: [],
  4744. code: [],
  4745. div: [],
  4746. em: [],
  4747. hr: [],
  4748. h1: [],
  4749. h2: [],
  4750. h3: [],
  4751. h4: [],
  4752. h5: [],
  4753. h6: [],
  4754. i: [],
  4755. img: ['src', 'alt', 'title', 'width', 'height'],
  4756. li: [],
  4757. ol: [],
  4758. p: [],
  4759. pre: [],
  4760. s: [],
  4761. small: [],
  4762. span: [],
  4763. sub: [],
  4764. sup: [],
  4765. strong: [],
  4766. u: [],
  4767. ul: []
  4768. };
  4769. /**
  4770. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4771. *
  4772. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4773. */
  4774. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4775. /**
  4776. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4777. *
  4778. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4779. */
  4780. 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;
  4781. function allowedAttribute(attr, allowedAttributeList) {
  4782. var attrName = attr.nodeName.toLowerCase();
  4783. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4784. if (uriAttrs.indexOf(attrName) !== -1) {
  4785. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4786. }
  4787. return true;
  4788. }
  4789. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4790. return attrRegex instanceof RegExp;
  4791. }); // Check if a regular expression validates the attribute.
  4792. for (var i = 0, l = regExp.length; i < l; i++) {
  4793. if (attrName.match(regExp[i])) {
  4794. return true;
  4795. }
  4796. }
  4797. return false;
  4798. }
  4799. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4800. if (unsafeHtml.length === 0) {
  4801. return unsafeHtml;
  4802. }
  4803. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4804. return sanitizeFn(unsafeHtml);
  4805. }
  4806. var domParser = new window.DOMParser();
  4807. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4808. var whitelistKeys = Object.keys(whiteList);
  4809. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4810. var _loop = function _loop(i, len) {
  4811. var el = elements[i];
  4812. var elName = el.nodeName.toLowerCase();
  4813. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4814. el.parentNode.removeChild(el);
  4815. return "continue";
  4816. }
  4817. var attributeList = [].slice.call(el.attributes);
  4818. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4819. attributeList.forEach(function (attr) {
  4820. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4821. el.removeAttribute(attr.nodeName);
  4822. }
  4823. });
  4824. };
  4825. for (var i = 0, len = elements.length; i < len; i++) {
  4826. var _ret = _loop(i);
  4827. if (_ret === "continue") continue;
  4828. }
  4829. return createdDocument.body.innerHTML;
  4830. }
  4831. /**
  4832. * ------------------------------------------------------------------------
  4833. * Constants
  4834. * ------------------------------------------------------------------------
  4835. */
  4836. var NAME$6 = 'tooltip';
  4837. var VERSION$6 = '4.4.1';
  4838. var DATA_KEY$6 = 'bs.tooltip';
  4839. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4840. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4841. var CLASS_PREFIX = 'bs-tooltip';
  4842. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4843. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4844. var DefaultType$4 = {
  4845. animation: 'boolean',
  4846. template: 'string',
  4847. title: '(string|element|function)',
  4848. trigger: 'string',
  4849. delay: '(number|object)',
  4850. html: 'boolean',
  4851. selector: '(string|boolean)',
  4852. placement: '(string|function)',
  4853. offset: '(number|string|function)',
  4854. container: '(string|element|boolean)',
  4855. fallbackPlacement: '(string|array)',
  4856. boundary: '(string|element)',
  4857. sanitize: 'boolean',
  4858. sanitizeFn: '(null|function)',
  4859. whiteList: 'object',
  4860. popperConfig: '(null|object)'
  4861. };
  4862. var AttachmentMap$1 = {
  4863. AUTO: 'auto',
  4864. TOP: 'top',
  4865. RIGHT: 'right',
  4866. BOTTOM: 'bottom',
  4867. LEFT: 'left'
  4868. };
  4869. var Default$4 = {
  4870. animation: true,
  4871. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4872. trigger: 'hover focus',
  4873. title: '',
  4874. delay: 0,
  4875. html: false,
  4876. selector: false,
  4877. placement: 'top',
  4878. offset: 0,
  4879. container: false,
  4880. fallbackPlacement: 'flip',
  4881. boundary: 'scrollParent',
  4882. sanitize: true,
  4883. sanitizeFn: null,
  4884. whiteList: DefaultWhitelist,
  4885. popperConfig: null
  4886. };
  4887. var HoverState = {
  4888. SHOW: 'show',
  4889. OUT: 'out'
  4890. };
  4891. var Event$6 = {
  4892. HIDE: "hide" + EVENT_KEY$6,
  4893. HIDDEN: "hidden" + EVENT_KEY$6,
  4894. SHOW: "show" + EVENT_KEY$6,
  4895. SHOWN: "shown" + EVENT_KEY$6,
  4896. INSERTED: "inserted" + EVENT_KEY$6,
  4897. CLICK: "click" + EVENT_KEY$6,
  4898. FOCUSIN: "focusin" + EVENT_KEY$6,
  4899. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4900. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4901. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4902. };
  4903. var ClassName$6 = {
  4904. FADE: 'fade',
  4905. SHOW: 'show'
  4906. };
  4907. var Selector$6 = {
  4908. TOOLTIP: '.tooltip',
  4909. TOOLTIP_INNER: '.tooltip-inner',
  4910. ARROW: '.arrow'
  4911. };
  4912. var Trigger = {
  4913. HOVER: 'hover',
  4914. FOCUS: 'focus',
  4915. CLICK: 'click',
  4916. MANUAL: 'manual'
  4917. };
  4918. /**
  4919. * ------------------------------------------------------------------------
  4920. * Class Definition
  4921. * ------------------------------------------------------------------------
  4922. */
  4923. var Tooltip =
  4924. /*#__PURE__*/
  4925. function () {
  4926. function Tooltip(element, config) {
  4927. if (typeof Popper === 'undefined') {
  4928. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4929. } // private
  4930. this._isEnabled = true;
  4931. this._timeout = 0;
  4932. this._hoverState = '';
  4933. this._activeTrigger = {};
  4934. this._popper = null; // Protected
  4935. this.element = element;
  4936. this.config = this._getConfig(config);
  4937. this.tip = null;
  4938. this._setListeners();
  4939. } // Getters
  4940. var _proto = Tooltip.prototype;
  4941. // Public
  4942. _proto.enable = function enable() {
  4943. this._isEnabled = true;
  4944. };
  4945. _proto.disable = function disable() {
  4946. this._isEnabled = false;
  4947. };
  4948. _proto.toggleEnabled = function toggleEnabled() {
  4949. this._isEnabled = !this._isEnabled;
  4950. };
  4951. _proto.toggle = function toggle(event) {
  4952. if (!this._isEnabled) {
  4953. return;
  4954. }
  4955. if (event) {
  4956. var dataKey = this.constructor.DATA_KEY;
  4957. var context = $(event.currentTarget).data(dataKey);
  4958. if (!context) {
  4959. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4960. $(event.currentTarget).data(dataKey, context);
  4961. }
  4962. context._activeTrigger.click = !context._activeTrigger.click;
  4963. if (context._isWithActiveTrigger()) {
  4964. context._enter(null, context);
  4965. } else {
  4966. context._leave(null, context);
  4967. }
  4968. } else {
  4969. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4970. this._leave(null, this);
  4971. return;
  4972. }
  4973. this._enter(null, this);
  4974. }
  4975. };
  4976. _proto.dispose = function dispose() {
  4977. clearTimeout(this._timeout);
  4978. $.removeData(this.element, this.constructor.DATA_KEY);
  4979. $(this.element).off(this.constructor.EVENT_KEY);
  4980. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4981. if (this.tip) {
  4982. $(this.tip).remove();
  4983. }
  4984. this._isEnabled = null;
  4985. this._timeout = null;
  4986. this._hoverState = null;
  4987. this._activeTrigger = null;
  4988. if (this._popper) {
  4989. this._popper.destroy();
  4990. }
  4991. this._popper = null;
  4992. this.element = null;
  4993. this.config = null;
  4994. this.tip = null;
  4995. };
  4996. _proto.show = function show() {
  4997. var _this = this;
  4998. if ($(this.element).css('display') === 'none') {
  4999. throw new Error('Please use show on visible elements');
  5000. }
  5001. var showEvent = $.Event(this.constructor.Event.SHOW);
  5002. if (this.isWithContent() && this._isEnabled) {
  5003. $(this.element).trigger(showEvent);
  5004. var shadowRoot = Util.findShadowRoot(this.element);
  5005. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5006. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5007. return;
  5008. }
  5009. var tip = this.getTipElement();
  5010. var tipId = Util.getUID(this.constructor.NAME);
  5011. tip.setAttribute('id', tipId);
  5012. this.element.setAttribute('aria-describedby', tipId);
  5013. this.setContent();
  5014. if (this.config.animation) {
  5015. $(tip).addClass(ClassName$6.FADE);
  5016. }
  5017. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5018. var attachment = this._getAttachment(placement);
  5019. this.addAttachmentClass(attachment);
  5020. var container = this._getContainer();
  5021. $(tip).data(this.constructor.DATA_KEY, this);
  5022. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5023. $(tip).appendTo(container);
  5024. }
  5025. $(this.element).trigger(this.constructor.Event.INSERTED);
  5026. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5027. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5028. // empty mouseover listeners to the body's immediate children;
  5029. // only needed because of broken event delegation on iOS
  5030. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5031. if ('ontouchstart' in document.documentElement) {
  5032. $(document.body).children().on('mouseover', null, $.noop);
  5033. }
  5034. var complete = function complete() {
  5035. if (_this.config.animation) {
  5036. _this._fixTransition();
  5037. }
  5038. var prevHoverState = _this._hoverState;
  5039. _this._hoverState = null;
  5040. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5041. if (prevHoverState === HoverState.OUT) {
  5042. _this._leave(null, _this);
  5043. }
  5044. };
  5045. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5046. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5047. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5048. } else {
  5049. complete();
  5050. }
  5051. }
  5052. };
  5053. _proto.hide = function hide(callback) {
  5054. var _this2 = this;
  5055. var tip = this.getTipElement();
  5056. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5057. var complete = function complete() {
  5058. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5059. tip.parentNode.removeChild(tip);
  5060. }
  5061. _this2._cleanTipClass();
  5062. _this2.element.removeAttribute('aria-describedby');
  5063. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5064. if (_this2._popper !== null) {
  5065. _this2._popper.destroy();
  5066. }
  5067. if (callback) {
  5068. callback();
  5069. }
  5070. };
  5071. $(this.element).trigger(hideEvent);
  5072. if (hideEvent.isDefaultPrevented()) {
  5073. return;
  5074. }
  5075. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5076. // empty mouseover listeners we added for iOS support
  5077. if ('ontouchstart' in document.documentElement) {
  5078. $(document.body).children().off('mouseover', null, $.noop);
  5079. }
  5080. this._activeTrigger[Trigger.CLICK] = false;
  5081. this._activeTrigger[Trigger.FOCUS] = false;
  5082. this._activeTrigger[Trigger.HOVER] = false;
  5083. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5084. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5085. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5086. } else {
  5087. complete();
  5088. }
  5089. this._hoverState = '';
  5090. };
  5091. _proto.update = function update() {
  5092. if (this._popper !== null) {
  5093. this._popper.scheduleUpdate();
  5094. }
  5095. } // Protected
  5096. ;
  5097. _proto.isWithContent = function isWithContent() {
  5098. return Boolean(this.getTitle());
  5099. };
  5100. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5101. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5102. };
  5103. _proto.getTipElement = function getTipElement() {
  5104. this.tip = this.tip || $(this.config.template)[0];
  5105. return this.tip;
  5106. };
  5107. _proto.setContent = function setContent() {
  5108. var tip = this.getTipElement();
  5109. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5110. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5111. };
  5112. _proto.setElementContent = function setElementContent($element, content) {
  5113. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5114. // Content is a DOM node or a jQuery
  5115. if (this.config.html) {
  5116. if (!$(content).parent().is($element)) {
  5117. $element.empty().append(content);
  5118. }
  5119. } else {
  5120. $element.text($(content).text());
  5121. }
  5122. return;
  5123. }
  5124. if (this.config.html) {
  5125. if (this.config.sanitize) {
  5126. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5127. }
  5128. $element.html(content);
  5129. } else {
  5130. $element.text(content);
  5131. }
  5132. };
  5133. _proto.getTitle = function getTitle() {
  5134. var title = this.element.getAttribute('data-original-title');
  5135. if (!title) {
  5136. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5137. }
  5138. return title;
  5139. } // Private
  5140. ;
  5141. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5142. var _this3 = this;
  5143. var defaultBsConfig = {
  5144. placement: attachment,
  5145. modifiers: {
  5146. offset: this._getOffset(),
  5147. flip: {
  5148. behavior: this.config.fallbackPlacement
  5149. },
  5150. arrow: {
  5151. element: Selector$6.ARROW
  5152. },
  5153. preventOverflow: {
  5154. boundariesElement: this.config.boundary
  5155. }
  5156. },
  5157. onCreate: function onCreate(data) {
  5158. if (data.originalPlacement !== data.placement) {
  5159. _this3._handlePopperPlacementChange(data);
  5160. }
  5161. },
  5162. onUpdate: function onUpdate(data) {
  5163. return _this3._handlePopperPlacementChange(data);
  5164. }
  5165. };
  5166. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5167. };
  5168. _proto._getOffset = function _getOffset() {
  5169. var _this4 = this;
  5170. var offset = {};
  5171. if (typeof this.config.offset === 'function') {
  5172. offset.fn = function (data) {
  5173. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5174. return data;
  5175. };
  5176. } else {
  5177. offset.offset = this.config.offset;
  5178. }
  5179. return offset;
  5180. };
  5181. _proto._getContainer = function _getContainer() {
  5182. if (this.config.container === false) {
  5183. return document.body;
  5184. }
  5185. if (Util.isElement(this.config.container)) {
  5186. return $(this.config.container);
  5187. }
  5188. return $(document).find(this.config.container);
  5189. };
  5190. _proto._getAttachment = function _getAttachment(placement) {
  5191. return AttachmentMap$1[placement.toUpperCase()];
  5192. };
  5193. _proto._setListeners = function _setListeners() {
  5194. var _this5 = this;
  5195. var triggers = this.config.trigger.split(' ');
  5196. triggers.forEach(function (trigger) {
  5197. if (trigger === 'click') {
  5198. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5199. return _this5.toggle(event);
  5200. });
  5201. } else if (trigger !== Trigger.MANUAL) {
  5202. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5203. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5204. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5205. return _this5._enter(event);
  5206. }).on(eventOut, _this5.config.selector, function (event) {
  5207. return _this5._leave(event);
  5208. });
  5209. }
  5210. });
  5211. this._hideModalHandler = function () {
  5212. if (_this5.element) {
  5213. _this5.hide();
  5214. }
  5215. };
  5216. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5217. if (this.config.selector) {
  5218. this.config = _objectSpread2({}, this.config, {
  5219. trigger: 'manual',
  5220. selector: ''
  5221. });
  5222. } else {
  5223. this._fixTitle();
  5224. }
  5225. };
  5226. _proto._fixTitle = function _fixTitle() {
  5227. var titleType = typeof this.element.getAttribute('data-original-title');
  5228. if (this.element.getAttribute('title') || titleType !== 'string') {
  5229. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5230. this.element.setAttribute('title', '');
  5231. }
  5232. };
  5233. _proto._enter = function _enter(event, context) {
  5234. var dataKey = this.constructor.DATA_KEY;
  5235. context = context || $(event.currentTarget).data(dataKey);
  5236. if (!context) {
  5237. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5238. $(event.currentTarget).data(dataKey, context);
  5239. }
  5240. if (event) {
  5241. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5242. }
  5243. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5244. context._hoverState = HoverState.SHOW;
  5245. return;
  5246. }
  5247. clearTimeout(context._timeout);
  5248. context._hoverState = HoverState.SHOW;
  5249. if (!context.config.delay || !context.config.delay.show) {
  5250. context.show();
  5251. return;
  5252. }
  5253. context._timeout = setTimeout(function () {
  5254. if (context._hoverState === HoverState.SHOW) {
  5255. context.show();
  5256. }
  5257. }, context.config.delay.show);
  5258. };
  5259. _proto._leave = function _leave(event, context) {
  5260. var dataKey = this.constructor.DATA_KEY;
  5261. context = context || $(event.currentTarget).data(dataKey);
  5262. if (!context) {
  5263. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5264. $(event.currentTarget).data(dataKey, context);
  5265. }
  5266. if (event) {
  5267. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5268. }
  5269. if (context._isWithActiveTrigger()) {
  5270. return;
  5271. }
  5272. clearTimeout(context._timeout);
  5273. context._hoverState = HoverState.OUT;
  5274. if (!context.config.delay || !context.config.delay.hide) {
  5275. context.hide();
  5276. return;
  5277. }
  5278. context._timeout = setTimeout(function () {
  5279. if (context._hoverState === HoverState.OUT) {
  5280. context.hide();
  5281. }
  5282. }, context.config.delay.hide);
  5283. };
  5284. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5285. for (var trigger in this._activeTrigger) {
  5286. if (this._activeTrigger[trigger]) {
  5287. return true;
  5288. }
  5289. }
  5290. return false;
  5291. };
  5292. _proto._getConfig = function _getConfig(config) {
  5293. var dataAttributes = $(this.element).data();
  5294. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5295. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5296. delete dataAttributes[dataAttr];
  5297. }
  5298. });
  5299. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5300. if (typeof config.delay === 'number') {
  5301. config.delay = {
  5302. show: config.delay,
  5303. hide: config.delay
  5304. };
  5305. }
  5306. if (typeof config.title === 'number') {
  5307. config.title = config.title.toString();
  5308. }
  5309. if (typeof config.content === 'number') {
  5310. config.content = config.content.toString();
  5311. }
  5312. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5313. if (config.sanitize) {
  5314. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5315. }
  5316. return config;
  5317. };
  5318. _proto._getDelegateConfig = function _getDelegateConfig() {
  5319. var config = {};
  5320. if (this.config) {
  5321. for (var key in this.config) {
  5322. if (this.constructor.Default[key] !== this.config[key]) {
  5323. config[key] = this.config[key];
  5324. }
  5325. }
  5326. }
  5327. return config;
  5328. };
  5329. _proto._cleanTipClass = function _cleanTipClass() {
  5330. var $tip = $(this.getTipElement());
  5331. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5332. if (tabClass !== null && tabClass.length) {
  5333. $tip.removeClass(tabClass.join(''));
  5334. }
  5335. };
  5336. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5337. var popperInstance = popperData.instance;
  5338. this.tip = popperInstance.popper;
  5339. this._cleanTipClass();
  5340. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5341. };
  5342. _proto._fixTransition = function _fixTransition() {
  5343. var tip = this.getTipElement();
  5344. var initConfigAnimation = this.config.animation;
  5345. if (tip.getAttribute('x-placement') !== null) {
  5346. return;
  5347. }
  5348. $(tip).removeClass(ClassName$6.FADE);
  5349. this.config.animation = false;
  5350. this.hide();
  5351. this.show();
  5352. this.config.animation = initConfigAnimation;
  5353. } // Static
  5354. ;
  5355. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5356. return this.each(function () {
  5357. var data = $(this).data(DATA_KEY$6);
  5358. var _config = typeof config === 'object' && config;
  5359. if (!data && /dispose|hide/.test(config)) {
  5360. return;
  5361. }
  5362. if (!data) {
  5363. data = new Tooltip(this, _config);
  5364. $(this).data(DATA_KEY$6, data);
  5365. }
  5366. if (typeof config === 'string') {
  5367. if (typeof data[config] === 'undefined') {
  5368. throw new TypeError("No method named \"" + config + "\"");
  5369. }
  5370. data[config]();
  5371. }
  5372. });
  5373. };
  5374. _createClass(Tooltip, null, [{
  5375. key: "VERSION",
  5376. get: function get() {
  5377. return VERSION$6;
  5378. }
  5379. }, {
  5380. key: "Default",
  5381. get: function get() {
  5382. return Default$4;
  5383. }
  5384. }, {
  5385. key: "NAME",
  5386. get: function get() {
  5387. return NAME$6;
  5388. }
  5389. }, {
  5390. key: "DATA_KEY",
  5391. get: function get() {
  5392. return DATA_KEY$6;
  5393. }
  5394. }, {
  5395. key: "Event",
  5396. get: function get() {
  5397. return Event$6;
  5398. }
  5399. }, {
  5400. key: "EVENT_KEY",
  5401. get: function get() {
  5402. return EVENT_KEY$6;
  5403. }
  5404. }, {
  5405. key: "DefaultType",
  5406. get: function get() {
  5407. return DefaultType$4;
  5408. }
  5409. }]);
  5410. return Tooltip;
  5411. }();
  5412. /**
  5413. * ------------------------------------------------------------------------
  5414. * jQuery
  5415. * ------------------------------------------------------------------------
  5416. */
  5417. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5418. $.fn[NAME$6].Constructor = Tooltip;
  5419. $.fn[NAME$6].noConflict = function () {
  5420. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5421. return Tooltip._jQueryInterface;
  5422. };
  5423. /**
  5424. * ------------------------------------------------------------------------
  5425. * Constants
  5426. * ------------------------------------------------------------------------
  5427. */
  5428. var NAME$7 = 'popover';
  5429. var VERSION$7 = '4.4.1';
  5430. var DATA_KEY$7 = 'bs.popover';
  5431. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5432. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5433. var CLASS_PREFIX$1 = 'bs-popover';
  5434. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5435. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5436. placement: 'right',
  5437. trigger: 'click',
  5438. content: '',
  5439. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5440. });
  5441. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5442. content: '(string|element|function)'
  5443. });
  5444. var ClassName$7 = {
  5445. FADE: 'fade',
  5446. SHOW: 'show'
  5447. };
  5448. var Selector$7 = {
  5449. TITLE: '.popover-header',
  5450. CONTENT: '.popover-body'
  5451. };
  5452. var Event$7 = {
  5453. HIDE: "hide" + EVENT_KEY$7,
  5454. HIDDEN: "hidden" + EVENT_KEY$7,
  5455. SHOW: "show" + EVENT_KEY$7,
  5456. SHOWN: "shown" + EVENT_KEY$7,
  5457. INSERTED: "inserted" + EVENT_KEY$7,
  5458. CLICK: "click" + EVENT_KEY$7,
  5459. FOCUSIN: "focusin" + EVENT_KEY$7,
  5460. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5461. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5462. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5463. };
  5464. /**
  5465. * ------------------------------------------------------------------------
  5466. * Class Definition
  5467. * ------------------------------------------------------------------------
  5468. */
  5469. var Popover =
  5470. /*#__PURE__*/
  5471. function (_Tooltip) {
  5472. _inheritsLoose(Popover, _Tooltip);
  5473. function Popover() {
  5474. return _Tooltip.apply(this, arguments) || this;
  5475. }
  5476. var _proto = Popover.prototype;
  5477. // Overrides
  5478. _proto.isWithContent = function isWithContent() {
  5479. return this.getTitle() || this._getContent();
  5480. };
  5481. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5482. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5483. };
  5484. _proto.getTipElement = function getTipElement() {
  5485. this.tip = this.tip || $(this.config.template)[0];
  5486. return this.tip;
  5487. };
  5488. _proto.setContent = function setContent() {
  5489. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5490. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5491. var content = this._getContent();
  5492. if (typeof content === 'function') {
  5493. content = content.call(this.element);
  5494. }
  5495. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5496. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5497. } // Private
  5498. ;
  5499. _proto._getContent = function _getContent() {
  5500. return this.element.getAttribute('data-content') || this.config.content;
  5501. };
  5502. _proto._cleanTipClass = function _cleanTipClass() {
  5503. var $tip = $(this.getTipElement());
  5504. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5505. if (tabClass !== null && tabClass.length > 0) {
  5506. $tip.removeClass(tabClass.join(''));
  5507. }
  5508. } // Static
  5509. ;
  5510. Popover._jQueryInterface = function _jQueryInterface(config) {
  5511. return this.each(function () {
  5512. var data = $(this).data(DATA_KEY$7);
  5513. var _config = typeof config === 'object' ? config : null;
  5514. if (!data && /dispose|hide/.test(config)) {
  5515. return;
  5516. }
  5517. if (!data) {
  5518. data = new Popover(this, _config);
  5519. $(this).data(DATA_KEY$7, data);
  5520. }
  5521. if (typeof config === 'string') {
  5522. if (typeof data[config] === 'undefined') {
  5523. throw new TypeError("No method named \"" + config + "\"");
  5524. }
  5525. data[config]();
  5526. }
  5527. });
  5528. };
  5529. _createClass(Popover, null, [{
  5530. key: "VERSION",
  5531. // Getters
  5532. get: function get() {
  5533. return VERSION$7;
  5534. }
  5535. }, {
  5536. key: "Default",
  5537. get: function get() {
  5538. return Default$5;
  5539. }
  5540. }, {
  5541. key: "NAME",
  5542. get: function get() {
  5543. return NAME$7;
  5544. }
  5545. }, {
  5546. key: "DATA_KEY",
  5547. get: function get() {
  5548. return DATA_KEY$7;
  5549. }
  5550. }, {
  5551. key: "Event",
  5552. get: function get() {
  5553. return Event$7;
  5554. }
  5555. }, {
  5556. key: "EVENT_KEY",
  5557. get: function get() {
  5558. return EVENT_KEY$7;
  5559. }
  5560. }, {
  5561. key: "DefaultType",
  5562. get: function get() {
  5563. return DefaultType$5;
  5564. }
  5565. }]);
  5566. return Popover;
  5567. }(Tooltip);
  5568. /**
  5569. * ------------------------------------------------------------------------
  5570. * jQuery
  5571. * ------------------------------------------------------------------------
  5572. */
  5573. $.fn[NAME$7] = Popover._jQueryInterface;
  5574. $.fn[NAME$7].Constructor = Popover;
  5575. $.fn[NAME$7].noConflict = function () {
  5576. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5577. return Popover._jQueryInterface;
  5578. };
  5579. /**
  5580. * ------------------------------------------------------------------------
  5581. * Constants
  5582. * ------------------------------------------------------------------------
  5583. */
  5584. var NAME$8 = 'scrollspy';
  5585. var VERSION$8 = '4.4.1';
  5586. var DATA_KEY$8 = 'bs.scrollspy';
  5587. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5588. var DATA_API_KEY$6 = '.data-api';
  5589. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5590. var Default$6 = {
  5591. offset: 10,
  5592. method: 'auto',
  5593. target: ''
  5594. };
  5595. var DefaultType$6 = {
  5596. offset: 'number',
  5597. method: 'string',
  5598. target: '(string|element)'
  5599. };
  5600. var Event$8 = {
  5601. ACTIVATE: "activate" + EVENT_KEY$8,
  5602. SCROLL: "scroll" + EVENT_KEY$8,
  5603. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5604. };
  5605. var ClassName$8 = {
  5606. DROPDOWN_ITEM: 'dropdown-item',
  5607. DROPDOWN_MENU: 'dropdown-menu',
  5608. ACTIVE: 'active'
  5609. };
  5610. var Selector$8 = {
  5611. DATA_SPY: '[data-spy="scroll"]',
  5612. ACTIVE: '.active',
  5613. NAV_LIST_GROUP: '.nav, .list-group',
  5614. NAV_LINKS: '.nav-link',
  5615. NAV_ITEMS: '.nav-item',
  5616. LIST_ITEMS: '.list-group-item',
  5617. DROPDOWN: '.dropdown',
  5618. DROPDOWN_ITEMS: '.dropdown-item',
  5619. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5620. };
  5621. var OffsetMethod = {
  5622. OFFSET: 'offset',
  5623. POSITION: 'position'
  5624. };
  5625. /**
  5626. * ------------------------------------------------------------------------
  5627. * Class Definition
  5628. * ------------------------------------------------------------------------
  5629. */
  5630. var ScrollSpy =
  5631. /*#__PURE__*/
  5632. function () {
  5633. function ScrollSpy(element, config) {
  5634. var _this = this;
  5635. this._element = element;
  5636. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5637. this._config = this._getConfig(config);
  5638. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5639. this._offsets = [];
  5640. this._targets = [];
  5641. this._activeTarget = null;
  5642. this._scrollHeight = 0;
  5643. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5644. return _this._process(event);
  5645. });
  5646. this.refresh();
  5647. this._process();
  5648. } // Getters
  5649. var _proto = ScrollSpy.prototype;
  5650. // Public
  5651. _proto.refresh = function refresh() {
  5652. var _this2 = this;
  5653. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5654. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5655. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5656. this._offsets = [];
  5657. this._targets = [];
  5658. this._scrollHeight = this._getScrollHeight();
  5659. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5660. targets.map(function (element) {
  5661. var target;
  5662. var targetSelector = Util.getSelectorFromElement(element);
  5663. if (targetSelector) {
  5664. target = document.querySelector(targetSelector);
  5665. }
  5666. if (target) {
  5667. var targetBCR = target.getBoundingClientRect();
  5668. if (targetBCR.width || targetBCR.height) {
  5669. // TODO (fat): remove sketch reliance on jQuery position/offset
  5670. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5671. }
  5672. }
  5673. return null;
  5674. }).filter(function (item) {
  5675. return item;
  5676. }).sort(function (a, b) {
  5677. return a[0] - b[0];
  5678. }).forEach(function (item) {
  5679. _this2._offsets.push(item[0]);
  5680. _this2._targets.push(item[1]);
  5681. });
  5682. };
  5683. _proto.dispose = function dispose() {
  5684. $.removeData(this._element, DATA_KEY$8);
  5685. $(this._scrollElement).off(EVENT_KEY$8);
  5686. this._element = null;
  5687. this._scrollElement = null;
  5688. this._config = null;
  5689. this._selector = null;
  5690. this._offsets = null;
  5691. this._targets = null;
  5692. this._activeTarget = null;
  5693. this._scrollHeight = null;
  5694. } // Private
  5695. ;
  5696. _proto._getConfig = function _getConfig(config) {
  5697. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5698. if (typeof config.target !== 'string') {
  5699. var id = $(config.target).attr('id');
  5700. if (!id) {
  5701. id = Util.getUID(NAME$8);
  5702. $(config.target).attr('id', id);
  5703. }
  5704. config.target = "#" + id;
  5705. }
  5706. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5707. return config;
  5708. };
  5709. _proto._getScrollTop = function _getScrollTop() {
  5710. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5711. };
  5712. _proto._getScrollHeight = function _getScrollHeight() {
  5713. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5714. };
  5715. _proto._getOffsetHeight = function _getOffsetHeight() {
  5716. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5717. };
  5718. _proto._process = function _process() {
  5719. var scrollTop = this._getScrollTop() + this._config.offset;
  5720. var scrollHeight = this._getScrollHeight();
  5721. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5722. if (this._scrollHeight !== scrollHeight) {
  5723. this.refresh();
  5724. }
  5725. if (scrollTop >= maxScroll) {
  5726. var target = this._targets[this._targets.length - 1];
  5727. if (this._activeTarget !== target) {
  5728. this._activate(target);
  5729. }
  5730. return;
  5731. }
  5732. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5733. this._activeTarget = null;
  5734. this._clear();
  5735. return;
  5736. }
  5737. var offsetLength = this._offsets.length;
  5738. for (var i = offsetLength; i--;) {
  5739. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5740. if (isActiveTarget) {
  5741. this._activate(this._targets[i]);
  5742. }
  5743. }
  5744. };
  5745. _proto._activate = function _activate(target) {
  5746. this._activeTarget = target;
  5747. this._clear();
  5748. var queries = this._selector.split(',').map(function (selector) {
  5749. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5750. });
  5751. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5752. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5753. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5754. $link.addClass(ClassName$8.ACTIVE);
  5755. } else {
  5756. // Set triggered link as active
  5757. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5758. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5759. $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
  5760. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5761. }
  5762. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5763. relatedTarget: target
  5764. });
  5765. };
  5766. _proto._clear = function _clear() {
  5767. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5768. return node.classList.contains(ClassName$8.ACTIVE);
  5769. }).forEach(function (node) {
  5770. return node.classList.remove(ClassName$8.ACTIVE);
  5771. });
  5772. } // Static
  5773. ;
  5774. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5775. return this.each(function () {
  5776. var data = $(this).data(DATA_KEY$8);
  5777. var _config = typeof config === 'object' && config;
  5778. if (!data) {
  5779. data = new ScrollSpy(this, _config);
  5780. $(this).data(DATA_KEY$8, data);
  5781. }
  5782. if (typeof config === 'string') {
  5783. if (typeof data[config] === 'undefined') {
  5784. throw new TypeError("No method named \"" + config + "\"");
  5785. }
  5786. data[config]();
  5787. }
  5788. });
  5789. };
  5790. _createClass(ScrollSpy, null, [{
  5791. key: "VERSION",
  5792. get: function get() {
  5793. return VERSION$8;
  5794. }
  5795. }, {
  5796. key: "Default",
  5797. get: function get() {
  5798. return Default$6;
  5799. }
  5800. }]);
  5801. return ScrollSpy;
  5802. }();
  5803. /**
  5804. * ------------------------------------------------------------------------
  5805. * Data Api implementation
  5806. * ------------------------------------------------------------------------
  5807. */
  5808. $(window).on(Event$8.LOAD_DATA_API, function () {
  5809. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5810. var scrollSpysLength = scrollSpys.length;
  5811. for (var i = scrollSpysLength; i--;) {
  5812. var $spy = $(scrollSpys[i]);
  5813. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5814. }
  5815. });
  5816. /**
  5817. * ------------------------------------------------------------------------
  5818. * jQuery
  5819. * ------------------------------------------------------------------------
  5820. */
  5821. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5822. $.fn[NAME$8].Constructor = ScrollSpy;
  5823. $.fn[NAME$8].noConflict = function () {
  5824. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5825. return ScrollSpy._jQueryInterface;
  5826. };
  5827. /**
  5828. * ------------------------------------------------------------------------
  5829. * Constants
  5830. * ------------------------------------------------------------------------
  5831. */
  5832. var NAME$9 = 'tab';
  5833. var VERSION$9 = '4.4.1';
  5834. var DATA_KEY$9 = 'bs.tab';
  5835. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5836. var DATA_API_KEY$7 = '.data-api';
  5837. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5838. var Event$9 = {
  5839. HIDE: "hide" + EVENT_KEY$9,
  5840. HIDDEN: "hidden" + EVENT_KEY$9,
  5841. SHOW: "show" + EVENT_KEY$9,
  5842. SHOWN: "shown" + EVENT_KEY$9,
  5843. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5844. };
  5845. var ClassName$9 = {
  5846. DROPDOWN_MENU: 'dropdown-menu',
  5847. ACTIVE: 'active',
  5848. DISABLED: 'disabled',
  5849. FADE: 'fade',
  5850. SHOW: 'show'
  5851. };
  5852. var Selector$9 = {
  5853. DROPDOWN: '.dropdown',
  5854. NAV_LIST_GROUP: '.nav, .list-group',
  5855. ACTIVE: '.active',
  5856. ACTIVE_UL: '> li > .active',
  5857. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5858. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5859. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5860. };
  5861. /**
  5862. * ------------------------------------------------------------------------
  5863. * Class Definition
  5864. * ------------------------------------------------------------------------
  5865. */
  5866. var Tab =
  5867. /*#__PURE__*/
  5868. function () {
  5869. function Tab(element) {
  5870. this._element = element;
  5871. } // Getters
  5872. var _proto = Tab.prototype;
  5873. // Public
  5874. _proto.show = function show() {
  5875. var _this = this;
  5876. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5877. return;
  5878. }
  5879. var target;
  5880. var previous;
  5881. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5882. var selector = Util.getSelectorFromElement(this._element);
  5883. if (listElement) {
  5884. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5885. previous = $.makeArray($(listElement).find(itemSelector));
  5886. previous = previous[previous.length - 1];
  5887. }
  5888. var hideEvent = $.Event(Event$9.HIDE, {
  5889. relatedTarget: this._element
  5890. });
  5891. var showEvent = $.Event(Event$9.SHOW, {
  5892. relatedTarget: previous
  5893. });
  5894. if (previous) {
  5895. $(previous).trigger(hideEvent);
  5896. }
  5897. $(this._element).trigger(showEvent);
  5898. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5899. return;
  5900. }
  5901. if (selector) {
  5902. target = document.querySelector(selector);
  5903. }
  5904. this._activate(this._element, listElement);
  5905. var complete = function complete() {
  5906. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5907. relatedTarget: _this._element
  5908. });
  5909. var shownEvent = $.Event(Event$9.SHOWN, {
  5910. relatedTarget: previous
  5911. });
  5912. $(previous).trigger(hiddenEvent);
  5913. $(_this._element).trigger(shownEvent);
  5914. };
  5915. if (target) {
  5916. this._activate(target, target.parentNode, complete);
  5917. } else {
  5918. complete();
  5919. }
  5920. };
  5921. _proto.dispose = function dispose() {
  5922. $.removeData(this._element, DATA_KEY$9);
  5923. this._element = null;
  5924. } // Private
  5925. ;
  5926. _proto._activate = function _activate(element, container, callback) {
  5927. var _this2 = this;
  5928. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5929. var active = activeElements[0];
  5930. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5931. var complete = function complete() {
  5932. return _this2._transitionComplete(element, active, callback);
  5933. };
  5934. if (active && isTransitioning) {
  5935. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5936. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5937. } else {
  5938. complete();
  5939. }
  5940. };
  5941. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5942. if (active) {
  5943. $(active).removeClass(ClassName$9.ACTIVE);
  5944. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5945. if (dropdownChild) {
  5946. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5947. }
  5948. if (active.getAttribute('role') === 'tab') {
  5949. active.setAttribute('aria-selected', false);
  5950. }
  5951. }
  5952. $(element).addClass(ClassName$9.ACTIVE);
  5953. if (element.getAttribute('role') === 'tab') {
  5954. element.setAttribute('aria-selected', true);
  5955. }
  5956. Util.reflow(element);
  5957. if (element.classList.contains(ClassName$9.FADE)) {
  5958. element.classList.add(ClassName$9.SHOW);
  5959. }
  5960. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5961. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5962. if (dropdownElement) {
  5963. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5964. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5965. }
  5966. element.setAttribute('aria-expanded', true);
  5967. }
  5968. if (callback) {
  5969. callback();
  5970. }
  5971. } // Static
  5972. ;
  5973. Tab._jQueryInterface = function _jQueryInterface(config) {
  5974. return this.each(function () {
  5975. var $this = $(this);
  5976. var data = $this.data(DATA_KEY$9);
  5977. if (!data) {
  5978. data = new Tab(this);
  5979. $this.data(DATA_KEY$9, data);
  5980. }
  5981. if (typeof config === 'string') {
  5982. if (typeof data[config] === 'undefined') {
  5983. throw new TypeError("No method named \"" + config + "\"");
  5984. }
  5985. data[config]();
  5986. }
  5987. });
  5988. };
  5989. _createClass(Tab, null, [{
  5990. key: "VERSION",
  5991. get: function get() {
  5992. return VERSION$9;
  5993. }
  5994. }]);
  5995. return Tab;
  5996. }();
  5997. /**
  5998. * ------------------------------------------------------------------------
  5999. * Data Api implementation
  6000. * ------------------------------------------------------------------------
  6001. */
  6002. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6003. event.preventDefault();
  6004. Tab._jQueryInterface.call($(this), 'show');
  6005. });
  6006. /**
  6007. * ------------------------------------------------------------------------
  6008. * jQuery
  6009. * ------------------------------------------------------------------------
  6010. */
  6011. $.fn[NAME$9] = Tab._jQueryInterface;
  6012. $.fn[NAME$9].Constructor = Tab;
  6013. $.fn[NAME$9].noConflict = function () {
  6014. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6015. return Tab._jQueryInterface;
  6016. };
  6017. /**
  6018. * ------------------------------------------------------------------------
  6019. * Constants
  6020. * ------------------------------------------------------------------------
  6021. */
  6022. var NAME$a = 'toast';
  6023. var VERSION$a = '4.4.1';
  6024. var DATA_KEY$a = 'bs.toast';
  6025. var EVENT_KEY$a = "." + DATA_KEY$a;
  6026. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6027. var Event$a = {
  6028. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6029. HIDE: "hide" + EVENT_KEY$a,
  6030. HIDDEN: "hidden" + EVENT_KEY$a,
  6031. SHOW: "show" + EVENT_KEY$a,
  6032. SHOWN: "shown" + EVENT_KEY$a
  6033. };
  6034. var ClassName$a = {
  6035. FADE: 'fade',
  6036. HIDE: 'hide',
  6037. SHOW: 'show',
  6038. SHOWING: 'showing'
  6039. };
  6040. var DefaultType$7 = {
  6041. animation: 'boolean',
  6042. autohide: 'boolean',
  6043. delay: 'number'
  6044. };
  6045. var Default$7 = {
  6046. animation: true,
  6047. autohide: true,
  6048. delay: 500
  6049. };
  6050. var Selector$a = {
  6051. DATA_DISMISS: '[data-dismiss="toast"]'
  6052. };
  6053. /**
  6054. * ------------------------------------------------------------------------
  6055. * Class Definition
  6056. * ------------------------------------------------------------------------
  6057. */
  6058. var Toast =
  6059. /*#__PURE__*/
  6060. function () {
  6061. function Toast(element, config) {
  6062. this._element = element;
  6063. this._config = this._getConfig(config);
  6064. this._timeout = null;
  6065. this._setListeners();
  6066. } // Getters
  6067. var _proto = Toast.prototype;
  6068. // Public
  6069. _proto.show = function show() {
  6070. var _this = this;
  6071. var showEvent = $.Event(Event$a.SHOW);
  6072. $(this._element).trigger(showEvent);
  6073. if (showEvent.isDefaultPrevented()) {
  6074. return;
  6075. }
  6076. if (this._config.animation) {
  6077. this._element.classList.add(ClassName$a.FADE);
  6078. }
  6079. var complete = function complete() {
  6080. _this._element.classList.remove(ClassName$a.SHOWING);
  6081. _this._element.classList.add(ClassName$a.SHOW);
  6082. $(_this._element).trigger(Event$a.SHOWN);
  6083. if (_this._config.autohide) {
  6084. _this._timeout = setTimeout(function () {
  6085. _this.hide();
  6086. }, _this._config.delay);
  6087. }
  6088. };
  6089. this._element.classList.remove(ClassName$a.HIDE);
  6090. Util.reflow(this._element);
  6091. this._element.classList.add(ClassName$a.SHOWING);
  6092. if (this._config.animation) {
  6093. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6094. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6095. } else {
  6096. complete();
  6097. }
  6098. };
  6099. _proto.hide = function hide() {
  6100. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6101. return;
  6102. }
  6103. var hideEvent = $.Event(Event$a.HIDE);
  6104. $(this._element).trigger(hideEvent);
  6105. if (hideEvent.isDefaultPrevented()) {
  6106. return;
  6107. }
  6108. this._close();
  6109. };
  6110. _proto.dispose = function dispose() {
  6111. clearTimeout(this._timeout);
  6112. this._timeout = null;
  6113. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6114. this._element.classList.remove(ClassName$a.SHOW);
  6115. }
  6116. $(this._element).off(Event$a.CLICK_DISMISS);
  6117. $.removeData(this._element, DATA_KEY$a);
  6118. this._element = null;
  6119. this._config = null;
  6120. } // Private
  6121. ;
  6122. _proto._getConfig = function _getConfig(config) {
  6123. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6124. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6125. return config;
  6126. };
  6127. _proto._setListeners = function _setListeners() {
  6128. var _this2 = this;
  6129. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6130. return _this2.hide();
  6131. });
  6132. };
  6133. _proto._close = function _close() {
  6134. var _this3 = this;
  6135. var complete = function complete() {
  6136. _this3._element.classList.add(ClassName$a.HIDE);
  6137. $(_this3._element).trigger(Event$a.HIDDEN);
  6138. };
  6139. this._element.classList.remove(ClassName$a.SHOW);
  6140. if (this._config.animation) {
  6141. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6142. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6143. } else {
  6144. complete();
  6145. }
  6146. } // Static
  6147. ;
  6148. Toast._jQueryInterface = function _jQueryInterface(config) {
  6149. return this.each(function () {
  6150. var $element = $(this);
  6151. var data = $element.data(DATA_KEY$a);
  6152. var _config = typeof config === 'object' && config;
  6153. if (!data) {
  6154. data = new Toast(this, _config);
  6155. $element.data(DATA_KEY$a, data);
  6156. }
  6157. if (typeof config === 'string') {
  6158. if (typeof data[config] === 'undefined') {
  6159. throw new TypeError("No method named \"" + config + "\"");
  6160. }
  6161. data[config](this);
  6162. }
  6163. });
  6164. };
  6165. _createClass(Toast, null, [{
  6166. key: "VERSION",
  6167. get: function get() {
  6168. return VERSION$a;
  6169. }
  6170. }, {
  6171. key: "DefaultType",
  6172. get: function get() {
  6173. return DefaultType$7;
  6174. }
  6175. }, {
  6176. key: "Default",
  6177. get: function get() {
  6178. return Default$7;
  6179. }
  6180. }]);
  6181. return Toast;
  6182. }();
  6183. /**
  6184. * ------------------------------------------------------------------------
  6185. * jQuery
  6186. * ------------------------------------------------------------------------
  6187. */
  6188. $.fn[NAME$a] = Toast._jQueryInterface;
  6189. $.fn[NAME$a].Constructor = Toast;
  6190. $.fn[NAME$a].noConflict = function () {
  6191. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6192. return Toast._jQueryInterface;
  6193. };
  6194. exports.Alert = Alert;
  6195. exports.Button = Button;
  6196. exports.Carousel = Carousel;
  6197. exports.Collapse = Collapse;
  6198. exports.Dropdown = Dropdown;
  6199. exports.Modal = Modal;
  6200. exports.Popover = Popover;
  6201. exports.Scrollspy = ScrollSpy;
  6202. exports.Tab = Tab;
  6203. exports.Toast = Toast;
  6204. exports.Tooltip = Tooltip;
  6205. exports.Util = Util;
  6206. Object.defineProperty(exports, '__esModule', { value: true });
  6207. })));
  6208. //# sourceMappingURL=bootstrap.js.map
  6209. /***/ }),
  6210. /***/ "./node_modules/buffer/index.js":
  6211. /*!**************************************!*\
  6212. !*** ./node_modules/buffer/index.js ***!
  6213. \**************************************/
  6214. /*! no static exports found */
  6215. /***/ (function(module, exports, __webpack_require__) {
  6216. "use strict";
  6217. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6218. * The buffer module from node.js, for the browser.
  6219. *
  6220. * @author Feross Aboukhadijeh <http://feross.org>
  6221. * @license MIT
  6222. */
  6223. /* eslint-disable no-proto */
  6224. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6225. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6226. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6227. exports.Buffer = Buffer
  6228. exports.SlowBuffer = SlowBuffer
  6229. exports.INSPECT_MAX_BYTES = 50
  6230. /**
  6231. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6232. * === true Use Uint8Array implementation (fastest)
  6233. * === false Use Object implementation (most compatible, even IE6)
  6234. *
  6235. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6236. * Opera 11.6+, iOS 4.2+.
  6237. *
  6238. * Due to various browser bugs, sometimes the Object implementation will be used even
  6239. * when the browser supports typed arrays.
  6240. *
  6241. * Note:
  6242. *
  6243. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6244. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6245. *
  6246. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6247. *
  6248. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6249. * incorrect length in some situations.
  6250. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6251. * get the Object implementation, which is slower but behaves correctly.
  6252. */
  6253. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6254. ? global.TYPED_ARRAY_SUPPORT
  6255. : typedArraySupport()
  6256. /*
  6257. * Export kMaxLength after typed array support is determined.
  6258. */
  6259. exports.kMaxLength = kMaxLength()
  6260. function typedArraySupport () {
  6261. try {
  6262. var arr = new Uint8Array(1)
  6263. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6264. return arr.foo() === 42 && // typed array instances can be augmented
  6265. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6266. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6267. } catch (e) {
  6268. return false
  6269. }
  6270. }
  6271. function kMaxLength () {
  6272. return Buffer.TYPED_ARRAY_SUPPORT
  6273. ? 0x7fffffff
  6274. : 0x3fffffff
  6275. }
  6276. function createBuffer (that, length) {
  6277. if (kMaxLength() < length) {
  6278. throw new RangeError('Invalid typed array length')
  6279. }
  6280. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6281. // Return an augmented `Uint8Array` instance, for best performance
  6282. that = new Uint8Array(length)
  6283. that.__proto__ = Buffer.prototype
  6284. } else {
  6285. // Fallback: Return an object instance of the Buffer class
  6286. if (that === null) {
  6287. that = new Buffer(length)
  6288. }
  6289. that.length = length
  6290. }
  6291. return that
  6292. }
  6293. /**
  6294. * The Buffer constructor returns instances of `Uint8Array` that have their
  6295. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6296. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6297. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6298. * returns a single octet.
  6299. *
  6300. * The `Uint8Array` prototype remains unmodified.
  6301. */
  6302. function Buffer (arg, encodingOrOffset, length) {
  6303. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6304. return new Buffer(arg, encodingOrOffset, length)
  6305. }
  6306. // Common case.
  6307. if (typeof arg === 'number') {
  6308. if (typeof encodingOrOffset === 'string') {
  6309. throw new Error(
  6310. 'If encoding is specified then the first argument must be a string'
  6311. )
  6312. }
  6313. return allocUnsafe(this, arg)
  6314. }
  6315. return from(this, arg, encodingOrOffset, length)
  6316. }
  6317. Buffer.poolSize = 8192 // not used by this implementation
  6318. // TODO: Legacy, not needed anymore. Remove in next major version.
  6319. Buffer._augment = function (arr) {
  6320. arr.__proto__ = Buffer.prototype
  6321. return arr
  6322. }
  6323. function from (that, value, encodingOrOffset, length) {
  6324. if (typeof value === 'number') {
  6325. throw new TypeError('"value" argument must not be a number')
  6326. }
  6327. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6328. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6329. }
  6330. if (typeof value === 'string') {
  6331. return fromString(that, value, encodingOrOffset)
  6332. }
  6333. return fromObject(that, value)
  6334. }
  6335. /**
  6336. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6337. * if value is a number.
  6338. * Buffer.from(str[, encoding])
  6339. * Buffer.from(array)
  6340. * Buffer.from(buffer)
  6341. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6342. **/
  6343. Buffer.from = function (value, encodingOrOffset, length) {
  6344. return from(null, value, encodingOrOffset, length)
  6345. }
  6346. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6347. Buffer.prototype.__proto__ = Uint8Array.prototype
  6348. Buffer.__proto__ = Uint8Array
  6349. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6350. Buffer[Symbol.species] === Buffer) {
  6351. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6352. Object.defineProperty(Buffer, Symbol.species, {
  6353. value: null,
  6354. configurable: true
  6355. })
  6356. }
  6357. }
  6358. function assertSize (size) {
  6359. if (typeof size !== 'number') {
  6360. throw new TypeError('"size" argument must be a number')
  6361. } else if (size < 0) {
  6362. throw new RangeError('"size" argument must not be negative')
  6363. }
  6364. }
  6365. function alloc (that, size, fill, encoding) {
  6366. assertSize(size)
  6367. if (size <= 0) {
  6368. return createBuffer(that, size)
  6369. }
  6370. if (fill !== undefined) {
  6371. // Only pay attention to encoding if it's a string. This
  6372. // prevents accidentally sending in a number that would
  6373. // be interpretted as a start offset.
  6374. return typeof encoding === 'string'
  6375. ? createBuffer(that, size).fill(fill, encoding)
  6376. : createBuffer(that, size).fill(fill)
  6377. }
  6378. return createBuffer(that, size)
  6379. }
  6380. /**
  6381. * Creates a new filled Buffer instance.
  6382. * alloc(size[, fill[, encoding]])
  6383. **/
  6384. Buffer.alloc = function (size, fill, encoding) {
  6385. return alloc(null, size, fill, encoding)
  6386. }
  6387. function allocUnsafe (that, size) {
  6388. assertSize(size)
  6389. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6390. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6391. for (var i = 0; i < size; ++i) {
  6392. that[i] = 0
  6393. }
  6394. }
  6395. return that
  6396. }
  6397. /**
  6398. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6399. * */
  6400. Buffer.allocUnsafe = function (size) {
  6401. return allocUnsafe(null, size)
  6402. }
  6403. /**
  6404. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6405. */
  6406. Buffer.allocUnsafeSlow = function (size) {
  6407. return allocUnsafe(null, size)
  6408. }
  6409. function fromString (that, string, encoding) {
  6410. if (typeof encoding !== 'string' || encoding === '') {
  6411. encoding = 'utf8'
  6412. }
  6413. if (!Buffer.isEncoding(encoding)) {
  6414. throw new TypeError('"encoding" must be a valid string encoding')
  6415. }
  6416. var length = byteLength(string, encoding) | 0
  6417. that = createBuffer(that, length)
  6418. var actual = that.write(string, encoding)
  6419. if (actual !== length) {
  6420. // Writing a hex string, for example, that contains invalid characters will
  6421. // cause everything after the first invalid character to be ignored. (e.g.
  6422. // 'abxxcd' will be treated as 'ab')
  6423. that = that.slice(0, actual)
  6424. }
  6425. return that
  6426. }
  6427. function fromArrayLike (that, array) {
  6428. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6429. that = createBuffer(that, length)
  6430. for (var i = 0; i < length; i += 1) {
  6431. that[i] = array[i] & 255
  6432. }
  6433. return that
  6434. }
  6435. function fromArrayBuffer (that, array, byteOffset, length) {
  6436. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6437. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6438. throw new RangeError('\'offset\' is out of bounds')
  6439. }
  6440. if (array.byteLength < byteOffset + (length || 0)) {
  6441. throw new RangeError('\'length\' is out of bounds')
  6442. }
  6443. if (byteOffset === undefined && length === undefined) {
  6444. array = new Uint8Array(array)
  6445. } else if (length === undefined) {
  6446. array = new Uint8Array(array, byteOffset)
  6447. } else {
  6448. array = new Uint8Array(array, byteOffset, length)
  6449. }
  6450. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6451. // Return an augmented `Uint8Array` instance, for best performance
  6452. that = array
  6453. that.__proto__ = Buffer.prototype
  6454. } else {
  6455. // Fallback: Return an object instance of the Buffer class
  6456. that = fromArrayLike(that, array)
  6457. }
  6458. return that
  6459. }
  6460. function fromObject (that, obj) {
  6461. if (Buffer.isBuffer(obj)) {
  6462. var len = checked(obj.length) | 0
  6463. that = createBuffer(that, len)
  6464. if (that.length === 0) {
  6465. return that
  6466. }
  6467. obj.copy(that, 0, 0, len)
  6468. return that
  6469. }
  6470. if (obj) {
  6471. if ((typeof ArrayBuffer !== 'undefined' &&
  6472. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6473. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6474. return createBuffer(that, 0)
  6475. }
  6476. return fromArrayLike(that, obj)
  6477. }
  6478. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6479. return fromArrayLike(that, obj.data)
  6480. }
  6481. }
  6482. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6483. }
  6484. function checked (length) {
  6485. // Note: cannot use `length < kMaxLength()` here because that fails when
  6486. // length is NaN (which is otherwise coerced to zero.)
  6487. if (length >= kMaxLength()) {
  6488. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6489. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6490. }
  6491. return length | 0
  6492. }
  6493. function SlowBuffer (length) {
  6494. if (+length != length) { // eslint-disable-line eqeqeq
  6495. length = 0
  6496. }
  6497. return Buffer.alloc(+length)
  6498. }
  6499. Buffer.isBuffer = function isBuffer (b) {
  6500. return !!(b != null && b._isBuffer)
  6501. }
  6502. Buffer.compare = function compare (a, b) {
  6503. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6504. throw new TypeError('Arguments must be Buffers')
  6505. }
  6506. if (a === b) return 0
  6507. var x = a.length
  6508. var y = b.length
  6509. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6510. if (a[i] !== b[i]) {
  6511. x = a[i]
  6512. y = b[i]
  6513. break
  6514. }
  6515. }
  6516. if (x < y) return -1
  6517. if (y < x) return 1
  6518. return 0
  6519. }
  6520. Buffer.isEncoding = function isEncoding (encoding) {
  6521. switch (String(encoding).toLowerCase()) {
  6522. case 'hex':
  6523. case 'utf8':
  6524. case 'utf-8':
  6525. case 'ascii':
  6526. case 'latin1':
  6527. case 'binary':
  6528. case 'base64':
  6529. case 'ucs2':
  6530. case 'ucs-2':
  6531. case 'utf16le':
  6532. case 'utf-16le':
  6533. return true
  6534. default:
  6535. return false
  6536. }
  6537. }
  6538. Buffer.concat = function concat (list, length) {
  6539. if (!isArray(list)) {
  6540. throw new TypeError('"list" argument must be an Array of Buffers')
  6541. }
  6542. if (list.length === 0) {
  6543. return Buffer.alloc(0)
  6544. }
  6545. var i
  6546. if (length === undefined) {
  6547. length = 0
  6548. for (i = 0; i < list.length; ++i) {
  6549. length += list[i].length
  6550. }
  6551. }
  6552. var buffer = Buffer.allocUnsafe(length)
  6553. var pos = 0
  6554. for (i = 0; i < list.length; ++i) {
  6555. var buf = list[i]
  6556. if (!Buffer.isBuffer(buf)) {
  6557. throw new TypeError('"list" argument must be an Array of Buffers')
  6558. }
  6559. buf.copy(buffer, pos)
  6560. pos += buf.length
  6561. }
  6562. return buffer
  6563. }
  6564. function byteLength (string, encoding) {
  6565. if (Buffer.isBuffer(string)) {
  6566. return string.length
  6567. }
  6568. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6569. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6570. return string.byteLength
  6571. }
  6572. if (typeof string !== 'string') {
  6573. string = '' + string
  6574. }
  6575. var len = string.length
  6576. if (len === 0) return 0
  6577. // Use a for loop to avoid recursion
  6578. var loweredCase = false
  6579. for (;;) {
  6580. switch (encoding) {
  6581. case 'ascii':
  6582. case 'latin1':
  6583. case 'binary':
  6584. return len
  6585. case 'utf8':
  6586. case 'utf-8':
  6587. case undefined:
  6588. return utf8ToBytes(string).length
  6589. case 'ucs2':
  6590. case 'ucs-2':
  6591. case 'utf16le':
  6592. case 'utf-16le':
  6593. return len * 2
  6594. case 'hex':
  6595. return len >>> 1
  6596. case 'base64':
  6597. return base64ToBytes(string).length
  6598. default:
  6599. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6600. encoding = ('' + encoding).toLowerCase()
  6601. loweredCase = true
  6602. }
  6603. }
  6604. }
  6605. Buffer.byteLength = byteLength
  6606. function slowToString (encoding, start, end) {
  6607. var loweredCase = false
  6608. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6609. // property of a typed array.
  6610. // This behaves neither like String nor Uint8Array in that we set start/end
  6611. // to their upper/lower bounds if the value passed is out of range.
  6612. // undefined is handled specially as per ECMA-262 6th Edition,
  6613. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6614. if (start === undefined || start < 0) {
  6615. start = 0
  6616. }
  6617. // Return early if start > this.length. Done here to prevent potential uint32
  6618. // coercion fail below.
  6619. if (start > this.length) {
  6620. return ''
  6621. }
  6622. if (end === undefined || end > this.length) {
  6623. end = this.length
  6624. }
  6625. if (end <= 0) {
  6626. return ''
  6627. }
  6628. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6629. end >>>= 0
  6630. start >>>= 0
  6631. if (end <= start) {
  6632. return ''
  6633. }
  6634. if (!encoding) encoding = 'utf8'
  6635. while (true) {
  6636. switch (encoding) {
  6637. case 'hex':
  6638. return hexSlice(this, start, end)
  6639. case 'utf8':
  6640. case 'utf-8':
  6641. return utf8Slice(this, start, end)
  6642. case 'ascii':
  6643. return asciiSlice(this, start, end)
  6644. case 'latin1':
  6645. case 'binary':
  6646. return latin1Slice(this, start, end)
  6647. case 'base64':
  6648. return base64Slice(this, start, end)
  6649. case 'ucs2':
  6650. case 'ucs-2':
  6651. case 'utf16le':
  6652. case 'utf-16le':
  6653. return utf16leSlice(this, start, end)
  6654. default:
  6655. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6656. encoding = (encoding + '').toLowerCase()
  6657. loweredCase = true
  6658. }
  6659. }
  6660. }
  6661. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6662. // Buffer instances.
  6663. Buffer.prototype._isBuffer = true
  6664. function swap (b, n, m) {
  6665. var i = b[n]
  6666. b[n] = b[m]
  6667. b[m] = i
  6668. }
  6669. Buffer.prototype.swap16 = function swap16 () {
  6670. var len = this.length
  6671. if (len % 2 !== 0) {
  6672. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6673. }
  6674. for (var i = 0; i < len; i += 2) {
  6675. swap(this, i, i + 1)
  6676. }
  6677. return this
  6678. }
  6679. Buffer.prototype.swap32 = function swap32 () {
  6680. var len = this.length
  6681. if (len % 4 !== 0) {
  6682. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6683. }
  6684. for (var i = 0; i < len; i += 4) {
  6685. swap(this, i, i + 3)
  6686. swap(this, i + 1, i + 2)
  6687. }
  6688. return this
  6689. }
  6690. Buffer.prototype.swap64 = function swap64 () {
  6691. var len = this.length
  6692. if (len % 8 !== 0) {
  6693. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6694. }
  6695. for (var i = 0; i < len; i += 8) {
  6696. swap(this, i, i + 7)
  6697. swap(this, i + 1, i + 6)
  6698. swap(this, i + 2, i + 5)
  6699. swap(this, i + 3, i + 4)
  6700. }
  6701. return this
  6702. }
  6703. Buffer.prototype.toString = function toString () {
  6704. var length = this.length | 0
  6705. if (length === 0) return ''
  6706. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6707. return slowToString.apply(this, arguments)
  6708. }
  6709. Buffer.prototype.equals = function equals (b) {
  6710. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6711. if (this === b) return true
  6712. return Buffer.compare(this, b) === 0
  6713. }
  6714. Buffer.prototype.inspect = function inspect () {
  6715. var str = ''
  6716. var max = exports.INSPECT_MAX_BYTES
  6717. if (this.length > 0) {
  6718. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6719. if (this.length > max) str += ' ... '
  6720. }
  6721. return '<Buffer ' + str + '>'
  6722. }
  6723. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6724. if (!Buffer.isBuffer(target)) {
  6725. throw new TypeError('Argument must be a Buffer')
  6726. }
  6727. if (start === undefined) {
  6728. start = 0
  6729. }
  6730. if (end === undefined) {
  6731. end = target ? target.length : 0
  6732. }
  6733. if (thisStart === undefined) {
  6734. thisStart = 0
  6735. }
  6736. if (thisEnd === undefined) {
  6737. thisEnd = this.length
  6738. }
  6739. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6740. throw new RangeError('out of range index')
  6741. }
  6742. if (thisStart >= thisEnd && start >= end) {
  6743. return 0
  6744. }
  6745. if (thisStart >= thisEnd) {
  6746. return -1
  6747. }
  6748. if (start >= end) {
  6749. return 1
  6750. }
  6751. start >>>= 0
  6752. end >>>= 0
  6753. thisStart >>>= 0
  6754. thisEnd >>>= 0
  6755. if (this === target) return 0
  6756. var x = thisEnd - thisStart
  6757. var y = end - start
  6758. var len = Math.min(x, y)
  6759. var thisCopy = this.slice(thisStart, thisEnd)
  6760. var targetCopy = target.slice(start, end)
  6761. for (var i = 0; i < len; ++i) {
  6762. if (thisCopy[i] !== targetCopy[i]) {
  6763. x = thisCopy[i]
  6764. y = targetCopy[i]
  6765. break
  6766. }
  6767. }
  6768. if (x < y) return -1
  6769. if (y < x) return 1
  6770. return 0
  6771. }
  6772. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6773. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6774. //
  6775. // Arguments:
  6776. // - buffer - a Buffer to search
  6777. // - val - a string, Buffer, or number
  6778. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6779. // - encoding - an optional encoding, relevant is val is a string
  6780. // - dir - true for indexOf, false for lastIndexOf
  6781. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6782. // Empty buffer means no match
  6783. if (buffer.length === 0) return -1
  6784. // Normalize byteOffset
  6785. if (typeof byteOffset === 'string') {
  6786. encoding = byteOffset
  6787. byteOffset = 0
  6788. } else if (byteOffset > 0x7fffffff) {
  6789. byteOffset = 0x7fffffff
  6790. } else if (byteOffset < -0x80000000) {
  6791. byteOffset = -0x80000000
  6792. }
  6793. byteOffset = +byteOffset // Coerce to Number.
  6794. if (isNaN(byteOffset)) {
  6795. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6796. byteOffset = dir ? 0 : (buffer.length - 1)
  6797. }
  6798. // Normalize byteOffset: negative offsets start from the end of the buffer
  6799. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6800. if (byteOffset >= buffer.length) {
  6801. if (dir) return -1
  6802. else byteOffset = buffer.length - 1
  6803. } else if (byteOffset < 0) {
  6804. if (dir) byteOffset = 0
  6805. else return -1
  6806. }
  6807. // Normalize val
  6808. if (typeof val === 'string') {
  6809. val = Buffer.from(val, encoding)
  6810. }
  6811. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6812. if (Buffer.isBuffer(val)) {
  6813. // Special case: looking for empty string/buffer always fails
  6814. if (val.length === 0) {
  6815. return -1
  6816. }
  6817. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6818. } else if (typeof val === 'number') {
  6819. val = val & 0xFF // Search for a byte value [0-255]
  6820. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6821. typeof Uint8Array.prototype.indexOf === 'function') {
  6822. if (dir) {
  6823. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6824. } else {
  6825. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6826. }
  6827. }
  6828. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6829. }
  6830. throw new TypeError('val must be string, number or Buffer')
  6831. }
  6832. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6833. var indexSize = 1
  6834. var arrLength = arr.length
  6835. var valLength = val.length
  6836. if (encoding !== undefined) {
  6837. encoding = String(encoding).toLowerCase()
  6838. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6839. encoding === 'utf16le' || encoding === 'utf-16le') {
  6840. if (arr.length < 2 || val.length < 2) {
  6841. return -1
  6842. }
  6843. indexSize = 2
  6844. arrLength /= 2
  6845. valLength /= 2
  6846. byteOffset /= 2
  6847. }
  6848. }
  6849. function read (buf, i) {
  6850. if (indexSize === 1) {
  6851. return buf[i]
  6852. } else {
  6853. return buf.readUInt16BE(i * indexSize)
  6854. }
  6855. }
  6856. var i
  6857. if (dir) {
  6858. var foundIndex = -1
  6859. for (i = byteOffset; i < arrLength; i++) {
  6860. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6861. if (foundIndex === -1) foundIndex = i
  6862. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6863. } else {
  6864. if (foundIndex !== -1) i -= i - foundIndex
  6865. foundIndex = -1
  6866. }
  6867. }
  6868. } else {
  6869. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6870. for (i = byteOffset; i >= 0; i--) {
  6871. var found = true
  6872. for (var j = 0; j < valLength; j++) {
  6873. if (read(arr, i + j) !== read(val, j)) {
  6874. found = false
  6875. break
  6876. }
  6877. }
  6878. if (found) return i
  6879. }
  6880. }
  6881. return -1
  6882. }
  6883. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6884. return this.indexOf(val, byteOffset, encoding) !== -1
  6885. }
  6886. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6887. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6888. }
  6889. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6890. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6891. }
  6892. function hexWrite (buf, string, offset, length) {
  6893. offset = Number(offset) || 0
  6894. var remaining = buf.length - offset
  6895. if (!length) {
  6896. length = remaining
  6897. } else {
  6898. length = Number(length)
  6899. if (length > remaining) {
  6900. length = remaining
  6901. }
  6902. }
  6903. // must be an even number of digits
  6904. var strLen = string.length
  6905. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6906. if (length > strLen / 2) {
  6907. length = strLen / 2
  6908. }
  6909. for (var i = 0; i < length; ++i) {
  6910. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6911. if (isNaN(parsed)) return i
  6912. buf[offset + i] = parsed
  6913. }
  6914. return i
  6915. }
  6916. function utf8Write (buf, string, offset, length) {
  6917. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6918. }
  6919. function asciiWrite (buf, string, offset, length) {
  6920. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6921. }
  6922. function latin1Write (buf, string, offset, length) {
  6923. return asciiWrite(buf, string, offset, length)
  6924. }
  6925. function base64Write (buf, string, offset, length) {
  6926. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6927. }
  6928. function ucs2Write (buf, string, offset, length) {
  6929. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6930. }
  6931. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6932. // Buffer#write(string)
  6933. if (offset === undefined) {
  6934. encoding = 'utf8'
  6935. length = this.length
  6936. offset = 0
  6937. // Buffer#write(string, encoding)
  6938. } else if (length === undefined && typeof offset === 'string') {
  6939. encoding = offset
  6940. length = this.length
  6941. offset = 0
  6942. // Buffer#write(string, offset[, length][, encoding])
  6943. } else if (isFinite(offset)) {
  6944. offset = offset | 0
  6945. if (isFinite(length)) {
  6946. length = length | 0
  6947. if (encoding === undefined) encoding = 'utf8'
  6948. } else {
  6949. encoding = length
  6950. length = undefined
  6951. }
  6952. // legacy write(string, encoding, offset, length) - remove in v0.13
  6953. } else {
  6954. throw new Error(
  6955. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6956. )
  6957. }
  6958. var remaining = this.length - offset
  6959. if (length === undefined || length > remaining) length = remaining
  6960. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6961. throw new RangeError('Attempt to write outside buffer bounds')
  6962. }
  6963. if (!encoding) encoding = 'utf8'
  6964. var loweredCase = false
  6965. for (;;) {
  6966. switch (encoding) {
  6967. case 'hex':
  6968. return hexWrite(this, string, offset, length)
  6969. case 'utf8':
  6970. case 'utf-8':
  6971. return utf8Write(this, string, offset, length)
  6972. case 'ascii':
  6973. return asciiWrite(this, string, offset, length)
  6974. case 'latin1':
  6975. case 'binary':
  6976. return latin1Write(this, string, offset, length)
  6977. case 'base64':
  6978. // Warning: maxLength not taken into account in base64Write
  6979. return base64Write(this, string, offset, length)
  6980. case 'ucs2':
  6981. case 'ucs-2':
  6982. case 'utf16le':
  6983. case 'utf-16le':
  6984. return ucs2Write(this, string, offset, length)
  6985. default:
  6986. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6987. encoding = ('' + encoding).toLowerCase()
  6988. loweredCase = true
  6989. }
  6990. }
  6991. }
  6992. Buffer.prototype.toJSON = function toJSON () {
  6993. return {
  6994. type: 'Buffer',
  6995. data: Array.prototype.slice.call(this._arr || this, 0)
  6996. }
  6997. }
  6998. function base64Slice (buf, start, end) {
  6999. if (start === 0 && end === buf.length) {
  7000. return base64.fromByteArray(buf)
  7001. } else {
  7002. return base64.fromByteArray(buf.slice(start, end))
  7003. }
  7004. }
  7005. function utf8Slice (buf, start, end) {
  7006. end = Math.min(buf.length, end)
  7007. var res = []
  7008. var i = start
  7009. while (i < end) {
  7010. var firstByte = buf[i]
  7011. var codePoint = null
  7012. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7013. : (firstByte > 0xDF) ? 3
  7014. : (firstByte > 0xBF) ? 2
  7015. : 1
  7016. if (i + bytesPerSequence <= end) {
  7017. var secondByte, thirdByte, fourthByte, tempCodePoint
  7018. switch (bytesPerSequence) {
  7019. case 1:
  7020. if (firstByte < 0x80) {
  7021. codePoint = firstByte
  7022. }
  7023. break
  7024. case 2:
  7025. secondByte = buf[i + 1]
  7026. if ((secondByte & 0xC0) === 0x80) {
  7027. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7028. if (tempCodePoint > 0x7F) {
  7029. codePoint = tempCodePoint
  7030. }
  7031. }
  7032. break
  7033. case 3:
  7034. secondByte = buf[i + 1]
  7035. thirdByte = buf[i + 2]
  7036. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7037. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7038. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7039. codePoint = tempCodePoint
  7040. }
  7041. }
  7042. break
  7043. case 4:
  7044. secondByte = buf[i + 1]
  7045. thirdByte = buf[i + 2]
  7046. fourthByte = buf[i + 3]
  7047. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7048. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7049. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7050. codePoint = tempCodePoint
  7051. }
  7052. }
  7053. }
  7054. }
  7055. if (codePoint === null) {
  7056. // we did not generate a valid codePoint so insert a
  7057. // replacement char (U+FFFD) and advance only 1 byte
  7058. codePoint = 0xFFFD
  7059. bytesPerSequence = 1
  7060. } else if (codePoint > 0xFFFF) {
  7061. // encode to utf16 (surrogate pair dance)
  7062. codePoint -= 0x10000
  7063. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7064. codePoint = 0xDC00 | codePoint & 0x3FF
  7065. }
  7066. res.push(codePoint)
  7067. i += bytesPerSequence
  7068. }
  7069. return decodeCodePointsArray(res)
  7070. }
  7071. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7072. // the lowest limit is Chrome, with 0x10000 args.
  7073. // We go 1 magnitude less, for safety
  7074. var MAX_ARGUMENTS_LENGTH = 0x1000
  7075. function decodeCodePointsArray (codePoints) {
  7076. var len = codePoints.length
  7077. if (len <= MAX_ARGUMENTS_LENGTH) {
  7078. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7079. }
  7080. // Decode in chunks to avoid "call stack size exceeded".
  7081. var res = ''
  7082. var i = 0
  7083. while (i < len) {
  7084. res += String.fromCharCode.apply(
  7085. String,
  7086. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7087. )
  7088. }
  7089. return res
  7090. }
  7091. function asciiSlice (buf, start, end) {
  7092. var ret = ''
  7093. end = Math.min(buf.length, end)
  7094. for (var i = start; i < end; ++i) {
  7095. ret += String.fromCharCode(buf[i] & 0x7F)
  7096. }
  7097. return ret
  7098. }
  7099. function latin1Slice (buf, start, end) {
  7100. var ret = ''
  7101. end = Math.min(buf.length, end)
  7102. for (var i = start; i < end; ++i) {
  7103. ret += String.fromCharCode(buf[i])
  7104. }
  7105. return ret
  7106. }
  7107. function hexSlice (buf, start, end) {
  7108. var len = buf.length
  7109. if (!start || start < 0) start = 0
  7110. if (!end || end < 0 || end > len) end = len
  7111. var out = ''
  7112. for (var i = start; i < end; ++i) {
  7113. out += toHex(buf[i])
  7114. }
  7115. return out
  7116. }
  7117. function utf16leSlice (buf, start, end) {
  7118. var bytes = buf.slice(start, end)
  7119. var res = ''
  7120. for (var i = 0; i < bytes.length; i += 2) {
  7121. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7122. }
  7123. return res
  7124. }
  7125. Buffer.prototype.slice = function slice (start, end) {
  7126. var len = this.length
  7127. start = ~~start
  7128. end = end === undefined ? len : ~~end
  7129. if (start < 0) {
  7130. start += len
  7131. if (start < 0) start = 0
  7132. } else if (start > len) {
  7133. start = len
  7134. }
  7135. if (end < 0) {
  7136. end += len
  7137. if (end < 0) end = 0
  7138. } else if (end > len) {
  7139. end = len
  7140. }
  7141. if (end < start) end = start
  7142. var newBuf
  7143. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7144. newBuf = this.subarray(start, end)
  7145. newBuf.__proto__ = Buffer.prototype
  7146. } else {
  7147. var sliceLen = end - start
  7148. newBuf = new Buffer(sliceLen, undefined)
  7149. for (var i = 0; i < sliceLen; ++i) {
  7150. newBuf[i] = this[i + start]
  7151. }
  7152. }
  7153. return newBuf
  7154. }
  7155. /*
  7156. * Need to make sure that buffer isn't trying to write out of bounds.
  7157. */
  7158. function checkOffset (offset, ext, length) {
  7159. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7160. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7161. }
  7162. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7163. offset = offset | 0
  7164. byteLength = byteLength | 0
  7165. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7166. var val = this[offset]
  7167. var mul = 1
  7168. var i = 0
  7169. while (++i < byteLength && (mul *= 0x100)) {
  7170. val += this[offset + i] * mul
  7171. }
  7172. return val
  7173. }
  7174. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7175. offset = offset | 0
  7176. byteLength = byteLength | 0
  7177. if (!noAssert) {
  7178. checkOffset(offset, byteLength, this.length)
  7179. }
  7180. var val = this[offset + --byteLength]
  7181. var mul = 1
  7182. while (byteLength > 0 && (mul *= 0x100)) {
  7183. val += this[offset + --byteLength] * mul
  7184. }
  7185. return val
  7186. }
  7187. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7188. if (!noAssert) checkOffset(offset, 1, this.length)
  7189. return this[offset]
  7190. }
  7191. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7192. if (!noAssert) checkOffset(offset, 2, this.length)
  7193. return this[offset] | (this[offset + 1] << 8)
  7194. }
  7195. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7196. if (!noAssert) checkOffset(offset, 2, this.length)
  7197. return (this[offset] << 8) | this[offset + 1]
  7198. }
  7199. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7200. if (!noAssert) checkOffset(offset, 4, this.length)
  7201. return ((this[offset]) |
  7202. (this[offset + 1] << 8) |
  7203. (this[offset + 2] << 16)) +
  7204. (this[offset + 3] * 0x1000000)
  7205. }
  7206. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7207. if (!noAssert) checkOffset(offset, 4, this.length)
  7208. return (this[offset] * 0x1000000) +
  7209. ((this[offset + 1] << 16) |
  7210. (this[offset + 2] << 8) |
  7211. this[offset + 3])
  7212. }
  7213. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7214. offset = offset | 0
  7215. byteLength = byteLength | 0
  7216. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7217. var val = this[offset]
  7218. var mul = 1
  7219. var i = 0
  7220. while (++i < byteLength && (mul *= 0x100)) {
  7221. val += this[offset + i] * mul
  7222. }
  7223. mul *= 0x80
  7224. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7225. return val
  7226. }
  7227. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7228. offset = offset | 0
  7229. byteLength = byteLength | 0
  7230. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7231. var i = byteLength
  7232. var mul = 1
  7233. var val = this[offset + --i]
  7234. while (i > 0 && (mul *= 0x100)) {
  7235. val += this[offset + --i] * mul
  7236. }
  7237. mul *= 0x80
  7238. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7239. return val
  7240. }
  7241. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7242. if (!noAssert) checkOffset(offset, 1, this.length)
  7243. if (!(this[offset] & 0x80)) return (this[offset])
  7244. return ((0xff - this[offset] + 1) * -1)
  7245. }
  7246. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7247. if (!noAssert) checkOffset(offset, 2, this.length)
  7248. var val = this[offset] | (this[offset + 1] << 8)
  7249. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7250. }
  7251. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7252. if (!noAssert) checkOffset(offset, 2, this.length)
  7253. var val = this[offset + 1] | (this[offset] << 8)
  7254. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7255. }
  7256. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7257. if (!noAssert) checkOffset(offset, 4, this.length)
  7258. return (this[offset]) |
  7259. (this[offset + 1] << 8) |
  7260. (this[offset + 2] << 16) |
  7261. (this[offset + 3] << 24)
  7262. }
  7263. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7264. if (!noAssert) checkOffset(offset, 4, this.length)
  7265. return (this[offset] << 24) |
  7266. (this[offset + 1] << 16) |
  7267. (this[offset + 2] << 8) |
  7268. (this[offset + 3])
  7269. }
  7270. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7271. if (!noAssert) checkOffset(offset, 4, this.length)
  7272. return ieee754.read(this, offset, true, 23, 4)
  7273. }
  7274. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7275. if (!noAssert) checkOffset(offset, 4, this.length)
  7276. return ieee754.read(this, offset, false, 23, 4)
  7277. }
  7278. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7279. if (!noAssert) checkOffset(offset, 8, this.length)
  7280. return ieee754.read(this, offset, true, 52, 8)
  7281. }
  7282. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7283. if (!noAssert) checkOffset(offset, 8, this.length)
  7284. return ieee754.read(this, offset, false, 52, 8)
  7285. }
  7286. function checkInt (buf, value, offset, ext, max, min) {
  7287. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7288. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7289. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7290. }
  7291. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7292. value = +value
  7293. offset = offset | 0
  7294. byteLength = byteLength | 0
  7295. if (!noAssert) {
  7296. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7297. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7298. }
  7299. var mul = 1
  7300. var i = 0
  7301. this[offset] = value & 0xFF
  7302. while (++i < byteLength && (mul *= 0x100)) {
  7303. this[offset + i] = (value / mul) & 0xFF
  7304. }
  7305. return offset + byteLength
  7306. }
  7307. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7308. value = +value
  7309. offset = offset | 0
  7310. byteLength = byteLength | 0
  7311. if (!noAssert) {
  7312. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7313. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7314. }
  7315. var i = byteLength - 1
  7316. var mul = 1
  7317. this[offset + i] = value & 0xFF
  7318. while (--i >= 0 && (mul *= 0x100)) {
  7319. this[offset + i] = (value / mul) & 0xFF
  7320. }
  7321. return offset + byteLength
  7322. }
  7323. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7324. value = +value
  7325. offset = offset | 0
  7326. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7327. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7328. this[offset] = (value & 0xff)
  7329. return offset + 1
  7330. }
  7331. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7332. if (value < 0) value = 0xffff + value + 1
  7333. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7334. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7335. (littleEndian ? i : 1 - i) * 8
  7336. }
  7337. }
  7338. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7339. value = +value
  7340. offset = offset | 0
  7341. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7342. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7343. this[offset] = (value & 0xff)
  7344. this[offset + 1] = (value >>> 8)
  7345. } else {
  7346. objectWriteUInt16(this, value, offset, true)
  7347. }
  7348. return offset + 2
  7349. }
  7350. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7351. value = +value
  7352. offset = offset | 0
  7353. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7354. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7355. this[offset] = (value >>> 8)
  7356. this[offset + 1] = (value & 0xff)
  7357. } else {
  7358. objectWriteUInt16(this, value, offset, false)
  7359. }
  7360. return offset + 2
  7361. }
  7362. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7363. if (value < 0) value = 0xffffffff + value + 1
  7364. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7365. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7366. }
  7367. }
  7368. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7369. value = +value
  7370. offset = offset | 0
  7371. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7372. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7373. this[offset + 3] = (value >>> 24)
  7374. this[offset + 2] = (value >>> 16)
  7375. this[offset + 1] = (value >>> 8)
  7376. this[offset] = (value & 0xff)
  7377. } else {
  7378. objectWriteUInt32(this, value, offset, true)
  7379. }
  7380. return offset + 4
  7381. }
  7382. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7383. value = +value
  7384. offset = offset | 0
  7385. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7386. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7387. this[offset] = (value >>> 24)
  7388. this[offset + 1] = (value >>> 16)
  7389. this[offset + 2] = (value >>> 8)
  7390. this[offset + 3] = (value & 0xff)
  7391. } else {
  7392. objectWriteUInt32(this, value, offset, false)
  7393. }
  7394. return offset + 4
  7395. }
  7396. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7397. value = +value
  7398. offset = offset | 0
  7399. if (!noAssert) {
  7400. var limit = Math.pow(2, 8 * byteLength - 1)
  7401. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7402. }
  7403. var i = 0
  7404. var mul = 1
  7405. var sub = 0
  7406. this[offset] = value & 0xFF
  7407. while (++i < byteLength && (mul *= 0x100)) {
  7408. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7409. sub = 1
  7410. }
  7411. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7412. }
  7413. return offset + byteLength
  7414. }
  7415. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7416. value = +value
  7417. offset = offset | 0
  7418. if (!noAssert) {
  7419. var limit = Math.pow(2, 8 * byteLength - 1)
  7420. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7421. }
  7422. var i = byteLength - 1
  7423. var mul = 1
  7424. var sub = 0
  7425. this[offset + i] = value & 0xFF
  7426. while (--i >= 0 && (mul *= 0x100)) {
  7427. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7428. sub = 1
  7429. }
  7430. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7431. }
  7432. return offset + byteLength
  7433. }
  7434. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7435. value = +value
  7436. offset = offset | 0
  7437. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7438. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7439. if (value < 0) value = 0xff + value + 1
  7440. this[offset] = (value & 0xff)
  7441. return offset + 1
  7442. }
  7443. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7444. value = +value
  7445. offset = offset | 0
  7446. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7447. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7448. this[offset] = (value & 0xff)
  7449. this[offset + 1] = (value >>> 8)
  7450. } else {
  7451. objectWriteUInt16(this, value, offset, true)
  7452. }
  7453. return offset + 2
  7454. }
  7455. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7456. value = +value
  7457. offset = offset | 0
  7458. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7459. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7460. this[offset] = (value >>> 8)
  7461. this[offset + 1] = (value & 0xff)
  7462. } else {
  7463. objectWriteUInt16(this, value, offset, false)
  7464. }
  7465. return offset + 2
  7466. }
  7467. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7468. value = +value
  7469. offset = offset | 0
  7470. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7471. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7472. this[offset] = (value & 0xff)
  7473. this[offset + 1] = (value >>> 8)
  7474. this[offset + 2] = (value >>> 16)
  7475. this[offset + 3] = (value >>> 24)
  7476. } else {
  7477. objectWriteUInt32(this, value, offset, true)
  7478. }
  7479. return offset + 4
  7480. }
  7481. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7482. value = +value
  7483. offset = offset | 0
  7484. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7485. if (value < 0) value = 0xffffffff + value + 1
  7486. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7487. this[offset] = (value >>> 24)
  7488. this[offset + 1] = (value >>> 16)
  7489. this[offset + 2] = (value >>> 8)
  7490. this[offset + 3] = (value & 0xff)
  7491. } else {
  7492. objectWriteUInt32(this, value, offset, false)
  7493. }
  7494. return offset + 4
  7495. }
  7496. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7497. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7498. if (offset < 0) throw new RangeError('Index out of range')
  7499. }
  7500. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7501. if (!noAssert) {
  7502. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7503. }
  7504. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7505. return offset + 4
  7506. }
  7507. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7508. return writeFloat(this, value, offset, true, noAssert)
  7509. }
  7510. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7511. return writeFloat(this, value, offset, false, noAssert)
  7512. }
  7513. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7514. if (!noAssert) {
  7515. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7516. }
  7517. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7518. return offset + 8
  7519. }
  7520. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7521. return writeDouble(this, value, offset, true, noAssert)
  7522. }
  7523. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7524. return writeDouble(this, value, offset, false, noAssert)
  7525. }
  7526. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7527. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7528. if (!start) start = 0
  7529. if (!end && end !== 0) end = this.length
  7530. if (targetStart >= target.length) targetStart = target.length
  7531. if (!targetStart) targetStart = 0
  7532. if (end > 0 && end < start) end = start
  7533. // Copy 0 bytes; we're done
  7534. if (end === start) return 0
  7535. if (target.length === 0 || this.length === 0) return 0
  7536. // Fatal error conditions
  7537. if (targetStart < 0) {
  7538. throw new RangeError('targetStart out of bounds')
  7539. }
  7540. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7541. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7542. // Are we oob?
  7543. if (end > this.length) end = this.length
  7544. if (target.length - targetStart < end - start) {
  7545. end = target.length - targetStart + start
  7546. }
  7547. var len = end - start
  7548. var i
  7549. if (this === target && start < targetStart && targetStart < end) {
  7550. // descending copy from end
  7551. for (i = len - 1; i >= 0; --i) {
  7552. target[i + targetStart] = this[i + start]
  7553. }
  7554. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7555. // ascending copy from start
  7556. for (i = 0; i < len; ++i) {
  7557. target[i + targetStart] = this[i + start]
  7558. }
  7559. } else {
  7560. Uint8Array.prototype.set.call(
  7561. target,
  7562. this.subarray(start, start + len),
  7563. targetStart
  7564. )
  7565. }
  7566. return len
  7567. }
  7568. // Usage:
  7569. // buffer.fill(number[, offset[, end]])
  7570. // buffer.fill(buffer[, offset[, end]])
  7571. // buffer.fill(string[, offset[, end]][, encoding])
  7572. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7573. // Handle string cases:
  7574. if (typeof val === 'string') {
  7575. if (typeof start === 'string') {
  7576. encoding = start
  7577. start = 0
  7578. end = this.length
  7579. } else if (typeof end === 'string') {
  7580. encoding = end
  7581. end = this.length
  7582. }
  7583. if (val.length === 1) {
  7584. var code = val.charCodeAt(0)
  7585. if (code < 256) {
  7586. val = code
  7587. }
  7588. }
  7589. if (encoding !== undefined && typeof encoding !== 'string') {
  7590. throw new TypeError('encoding must be a string')
  7591. }
  7592. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7593. throw new TypeError('Unknown encoding: ' + encoding)
  7594. }
  7595. } else if (typeof val === 'number') {
  7596. val = val & 255
  7597. }
  7598. // Invalid ranges are not set to a default, so can range check early.
  7599. if (start < 0 || this.length < start || this.length < end) {
  7600. throw new RangeError('Out of range index')
  7601. }
  7602. if (end <= start) {
  7603. return this
  7604. }
  7605. start = start >>> 0
  7606. end = end === undefined ? this.length : end >>> 0
  7607. if (!val) val = 0
  7608. var i
  7609. if (typeof val === 'number') {
  7610. for (i = start; i < end; ++i) {
  7611. this[i] = val
  7612. }
  7613. } else {
  7614. var bytes = Buffer.isBuffer(val)
  7615. ? val
  7616. : utf8ToBytes(new Buffer(val, encoding).toString())
  7617. var len = bytes.length
  7618. for (i = 0; i < end - start; ++i) {
  7619. this[i + start] = bytes[i % len]
  7620. }
  7621. }
  7622. return this
  7623. }
  7624. // HELPER FUNCTIONS
  7625. // ================
  7626. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7627. function base64clean (str) {
  7628. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7629. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7630. // Node converts strings with length < 2 to ''
  7631. if (str.length < 2) return ''
  7632. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7633. while (str.length % 4 !== 0) {
  7634. str = str + '='
  7635. }
  7636. return str
  7637. }
  7638. function stringtrim (str) {
  7639. if (str.trim) return str.trim()
  7640. return str.replace(/^\s+|\s+$/g, '')
  7641. }
  7642. function toHex (n) {
  7643. if (n < 16) return '0' + n.toString(16)
  7644. return n.toString(16)
  7645. }
  7646. function utf8ToBytes (string, units) {
  7647. units = units || Infinity
  7648. var codePoint
  7649. var length = string.length
  7650. var leadSurrogate = null
  7651. var bytes = []
  7652. for (var i = 0; i < length; ++i) {
  7653. codePoint = string.charCodeAt(i)
  7654. // is surrogate component
  7655. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7656. // last char was a lead
  7657. if (!leadSurrogate) {
  7658. // no lead yet
  7659. if (codePoint > 0xDBFF) {
  7660. // unexpected trail
  7661. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7662. continue
  7663. } else if (i + 1 === length) {
  7664. // unpaired lead
  7665. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7666. continue
  7667. }
  7668. // valid lead
  7669. leadSurrogate = codePoint
  7670. continue
  7671. }
  7672. // 2 leads in a row
  7673. if (codePoint < 0xDC00) {
  7674. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7675. leadSurrogate = codePoint
  7676. continue
  7677. }
  7678. // valid surrogate pair
  7679. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7680. } else if (leadSurrogate) {
  7681. // valid bmp char, but last char was a lead
  7682. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7683. }
  7684. leadSurrogate = null
  7685. // encode utf8
  7686. if (codePoint < 0x80) {
  7687. if ((units -= 1) < 0) break
  7688. bytes.push(codePoint)
  7689. } else if (codePoint < 0x800) {
  7690. if ((units -= 2) < 0) break
  7691. bytes.push(
  7692. codePoint >> 0x6 | 0xC0,
  7693. codePoint & 0x3F | 0x80
  7694. )
  7695. } else if (codePoint < 0x10000) {
  7696. if ((units -= 3) < 0) break
  7697. bytes.push(
  7698. codePoint >> 0xC | 0xE0,
  7699. codePoint >> 0x6 & 0x3F | 0x80,
  7700. codePoint & 0x3F | 0x80
  7701. )
  7702. } else if (codePoint < 0x110000) {
  7703. if ((units -= 4) < 0) break
  7704. bytes.push(
  7705. codePoint >> 0x12 | 0xF0,
  7706. codePoint >> 0xC & 0x3F | 0x80,
  7707. codePoint >> 0x6 & 0x3F | 0x80,
  7708. codePoint & 0x3F | 0x80
  7709. )
  7710. } else {
  7711. throw new Error('Invalid code point')
  7712. }
  7713. }
  7714. return bytes
  7715. }
  7716. function asciiToBytes (str) {
  7717. var byteArray = []
  7718. for (var i = 0; i < str.length; ++i) {
  7719. // Node's code seems to be doing this and not & 0x7F..
  7720. byteArray.push(str.charCodeAt(i) & 0xFF)
  7721. }
  7722. return byteArray
  7723. }
  7724. function utf16leToBytes (str, units) {
  7725. var c, hi, lo
  7726. var byteArray = []
  7727. for (var i = 0; i < str.length; ++i) {
  7728. if ((units -= 2) < 0) break
  7729. c = str.charCodeAt(i)
  7730. hi = c >> 8
  7731. lo = c % 256
  7732. byteArray.push(lo)
  7733. byteArray.push(hi)
  7734. }
  7735. return byteArray
  7736. }
  7737. function base64ToBytes (str) {
  7738. return base64.toByteArray(base64clean(str))
  7739. }
  7740. function blitBuffer (src, dst, offset, length) {
  7741. for (var i = 0; i < length; ++i) {
  7742. if ((i + offset >= dst.length) || (i >= src.length)) break
  7743. dst[i + offset] = src[i]
  7744. }
  7745. return i
  7746. }
  7747. function isnan (val) {
  7748. return val !== val // eslint-disable-line no-self-compare
  7749. }
  7750. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7751. /***/ }),
  7752. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7753. /*!**************************************************!*\
  7754. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7755. \**************************************************/
  7756. /*! no static exports found */
  7757. /***/ (function(module, exports, __webpack_require__) {
  7758. /*!
  7759. * clipboard.js v2.0.4
  7760. * https://zenorocha.github.io/clipboard.js
  7761. *
  7762. * Licensed MIT © Zeno Rocha
  7763. */
  7764. (function webpackUniversalModuleDefinition(root, factory) {
  7765. if(true)
  7766. module.exports = factory();
  7767. else {}
  7768. })(this, function() {
  7769. return /******/ (function(modules) { // webpackBootstrap
  7770. /******/ // The module cache
  7771. /******/ var installedModules = {};
  7772. /******/
  7773. /******/ // The require function
  7774. /******/ function __webpack_require__(moduleId) {
  7775. /******/
  7776. /******/ // Check if module is in cache
  7777. /******/ if(installedModules[moduleId]) {
  7778. /******/ return installedModules[moduleId].exports;
  7779. /******/ }
  7780. /******/ // Create a new module (and put it into the cache)
  7781. /******/ var module = installedModules[moduleId] = {
  7782. /******/ i: moduleId,
  7783. /******/ l: false,
  7784. /******/ exports: {}
  7785. /******/ };
  7786. /******/
  7787. /******/ // Execute the module function
  7788. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7789. /******/
  7790. /******/ // Flag the module as loaded
  7791. /******/ module.l = true;
  7792. /******/
  7793. /******/ // Return the exports of the module
  7794. /******/ return module.exports;
  7795. /******/ }
  7796. /******/
  7797. /******/
  7798. /******/ // expose the modules object (__webpack_modules__)
  7799. /******/ __webpack_require__.m = modules;
  7800. /******/
  7801. /******/ // expose the module cache
  7802. /******/ __webpack_require__.c = installedModules;
  7803. /******/
  7804. /******/ // define getter function for harmony exports
  7805. /******/ __webpack_require__.d = function(exports, name, getter) {
  7806. /******/ if(!__webpack_require__.o(exports, name)) {
  7807. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7808. /******/ }
  7809. /******/ };
  7810. /******/
  7811. /******/ // define __esModule on exports
  7812. /******/ __webpack_require__.r = function(exports) {
  7813. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7814. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7815. /******/ }
  7816. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7817. /******/ };
  7818. /******/
  7819. /******/ // create a fake namespace object
  7820. /******/ // mode & 1: value is a module id, require it
  7821. /******/ // mode & 2: merge all properties of value into the ns
  7822. /******/ // mode & 4: return value when already ns object
  7823. /******/ // mode & 8|1: behave like require
  7824. /******/ __webpack_require__.t = function(value, mode) {
  7825. /******/ if(mode & 1) value = __webpack_require__(value);
  7826. /******/ if(mode & 8) return value;
  7827. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7828. /******/ var ns = Object.create(null);
  7829. /******/ __webpack_require__.r(ns);
  7830. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7831. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7832. /******/ return ns;
  7833. /******/ };
  7834. /******/
  7835. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7836. /******/ __webpack_require__.n = function(module) {
  7837. /******/ var getter = module && module.__esModule ?
  7838. /******/ function getDefault() { return module['default']; } :
  7839. /******/ function getModuleExports() { return module; };
  7840. /******/ __webpack_require__.d(getter, 'a', getter);
  7841. /******/ return getter;
  7842. /******/ };
  7843. /******/
  7844. /******/ // Object.prototype.hasOwnProperty.call
  7845. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7846. /******/
  7847. /******/ // __webpack_public_path__
  7848. /******/ __webpack_require__.p = "";
  7849. /******/
  7850. /******/
  7851. /******/ // Load entry module and return exports
  7852. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7853. /******/ })
  7854. /************************************************************************/
  7855. /******/ ([
  7856. /* 0 */
  7857. /***/ (function(module, exports, __webpack_require__) {
  7858. "use strict";
  7859. 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; };
  7860. 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; }; }();
  7861. var _clipboardAction = __webpack_require__(1);
  7862. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7863. var _tinyEmitter = __webpack_require__(3);
  7864. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7865. var _goodListener = __webpack_require__(4);
  7866. var _goodListener2 = _interopRequireDefault(_goodListener);
  7867. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7868. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7869. 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; }
  7870. 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; }
  7871. /**
  7872. * Base class which takes one or more elements, adds event listeners to them,
  7873. * and instantiates a new `ClipboardAction` on each click.
  7874. */
  7875. var Clipboard = function (_Emitter) {
  7876. _inherits(Clipboard, _Emitter);
  7877. /**
  7878. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7879. * @param {Object} options
  7880. */
  7881. function Clipboard(trigger, options) {
  7882. _classCallCheck(this, Clipboard);
  7883. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7884. _this.resolveOptions(options);
  7885. _this.listenClick(trigger);
  7886. return _this;
  7887. }
  7888. /**
  7889. * Defines if attributes would be resolved using internal setter functions
  7890. * or custom functions that were passed in the constructor.
  7891. * @param {Object} options
  7892. */
  7893. _createClass(Clipboard, [{
  7894. key: 'resolveOptions',
  7895. value: function resolveOptions() {
  7896. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7897. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7898. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7899. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7900. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7901. }
  7902. /**
  7903. * Adds a click event listener to the passed trigger.
  7904. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7905. */
  7906. }, {
  7907. key: 'listenClick',
  7908. value: function listenClick(trigger) {
  7909. var _this2 = this;
  7910. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7911. return _this2.onClick(e);
  7912. });
  7913. }
  7914. /**
  7915. * Defines a new `ClipboardAction` on each click event.
  7916. * @param {Event} e
  7917. */
  7918. }, {
  7919. key: 'onClick',
  7920. value: function onClick(e) {
  7921. var trigger = e.delegateTarget || e.currentTarget;
  7922. if (this.clipboardAction) {
  7923. this.clipboardAction = null;
  7924. }
  7925. this.clipboardAction = new _clipboardAction2.default({
  7926. action: this.action(trigger),
  7927. target: this.target(trigger),
  7928. text: this.text(trigger),
  7929. container: this.container,
  7930. trigger: trigger,
  7931. emitter: this
  7932. });
  7933. }
  7934. /**
  7935. * Default `action` lookup function.
  7936. * @param {Element} trigger
  7937. */
  7938. }, {
  7939. key: 'defaultAction',
  7940. value: function defaultAction(trigger) {
  7941. return getAttributeValue('action', trigger);
  7942. }
  7943. /**
  7944. * Default `target` lookup function.
  7945. * @param {Element} trigger
  7946. */
  7947. }, {
  7948. key: 'defaultTarget',
  7949. value: function defaultTarget(trigger) {
  7950. var selector = getAttributeValue('target', trigger);
  7951. if (selector) {
  7952. return document.querySelector(selector);
  7953. }
  7954. }
  7955. /**
  7956. * Returns the support of the given action, or all actions if no action is
  7957. * given.
  7958. * @param {String} [action]
  7959. */
  7960. }, {
  7961. key: 'defaultText',
  7962. /**
  7963. * Default `text` lookup function.
  7964. * @param {Element} trigger
  7965. */
  7966. value: function defaultText(trigger) {
  7967. return getAttributeValue('text', trigger);
  7968. }
  7969. /**
  7970. * Destroy lifecycle.
  7971. */
  7972. }, {
  7973. key: 'destroy',
  7974. value: function destroy() {
  7975. this.listener.destroy();
  7976. if (this.clipboardAction) {
  7977. this.clipboardAction.destroy();
  7978. this.clipboardAction = null;
  7979. }
  7980. }
  7981. }], [{
  7982. key: 'isSupported',
  7983. value: function isSupported() {
  7984. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7985. var actions = typeof action === 'string' ? [action] : action;
  7986. var support = !!document.queryCommandSupported;
  7987. actions.forEach(function (action) {
  7988. support = support && !!document.queryCommandSupported(action);
  7989. });
  7990. return support;
  7991. }
  7992. }]);
  7993. return Clipboard;
  7994. }(_tinyEmitter2.default);
  7995. /**
  7996. * Helper function to retrieve attribute value.
  7997. * @param {String} suffix
  7998. * @param {Element} element
  7999. */
  8000. function getAttributeValue(suffix, element) {
  8001. var attribute = 'data-clipboard-' + suffix;
  8002. if (!element.hasAttribute(attribute)) {
  8003. return;
  8004. }
  8005. return element.getAttribute(attribute);
  8006. }
  8007. module.exports = Clipboard;
  8008. /***/ }),
  8009. /* 1 */
  8010. /***/ (function(module, exports, __webpack_require__) {
  8011. "use strict";
  8012. 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; };
  8013. 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; }; }();
  8014. var _select = __webpack_require__(2);
  8015. var _select2 = _interopRequireDefault(_select);
  8016. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8017. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8018. /**
  8019. * Inner class which performs selection from either `text` or `target`
  8020. * properties and then executes copy or cut operations.
  8021. */
  8022. var ClipboardAction = function () {
  8023. /**
  8024. * @param {Object} options
  8025. */
  8026. function ClipboardAction(options) {
  8027. _classCallCheck(this, ClipboardAction);
  8028. this.resolveOptions(options);
  8029. this.initSelection();
  8030. }
  8031. /**
  8032. * Defines base properties passed from constructor.
  8033. * @param {Object} options
  8034. */
  8035. _createClass(ClipboardAction, [{
  8036. key: 'resolveOptions',
  8037. value: function resolveOptions() {
  8038. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8039. this.action = options.action;
  8040. this.container = options.container;
  8041. this.emitter = options.emitter;
  8042. this.target = options.target;
  8043. this.text = options.text;
  8044. this.trigger = options.trigger;
  8045. this.selectedText = '';
  8046. }
  8047. /**
  8048. * Decides which selection strategy is going to be applied based
  8049. * on the existence of `text` and `target` properties.
  8050. */
  8051. }, {
  8052. key: 'initSelection',
  8053. value: function initSelection() {
  8054. if (this.text) {
  8055. this.selectFake();
  8056. } else if (this.target) {
  8057. this.selectTarget();
  8058. }
  8059. }
  8060. /**
  8061. * Creates a fake textarea element, sets its value from `text` property,
  8062. * and makes a selection on it.
  8063. */
  8064. }, {
  8065. key: 'selectFake',
  8066. value: function selectFake() {
  8067. var _this = this;
  8068. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8069. this.removeFake();
  8070. this.fakeHandlerCallback = function () {
  8071. return _this.removeFake();
  8072. };
  8073. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8074. this.fakeElem = document.createElement('textarea');
  8075. // Prevent zooming on iOS
  8076. this.fakeElem.style.fontSize = '12pt';
  8077. // Reset box model
  8078. this.fakeElem.style.border = '0';
  8079. this.fakeElem.style.padding = '0';
  8080. this.fakeElem.style.margin = '0';
  8081. // Move element out of screen horizontally
  8082. this.fakeElem.style.position = 'absolute';
  8083. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8084. // Move element to the same position vertically
  8085. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8086. this.fakeElem.style.top = yPosition + 'px';
  8087. this.fakeElem.setAttribute('readonly', '');
  8088. this.fakeElem.value = this.text;
  8089. this.container.appendChild(this.fakeElem);
  8090. this.selectedText = (0, _select2.default)(this.fakeElem);
  8091. this.copyText();
  8092. }
  8093. /**
  8094. * Only removes the fake element after another click event, that way
  8095. * a user can hit `Ctrl+C` to copy because selection still exists.
  8096. */
  8097. }, {
  8098. key: 'removeFake',
  8099. value: function removeFake() {
  8100. if (this.fakeHandler) {
  8101. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8102. this.fakeHandler = null;
  8103. this.fakeHandlerCallback = null;
  8104. }
  8105. if (this.fakeElem) {
  8106. this.container.removeChild(this.fakeElem);
  8107. this.fakeElem = null;
  8108. }
  8109. }
  8110. /**
  8111. * Selects the content from element passed on `target` property.
  8112. */
  8113. }, {
  8114. key: 'selectTarget',
  8115. value: function selectTarget() {
  8116. this.selectedText = (0, _select2.default)(this.target);
  8117. this.copyText();
  8118. }
  8119. /**
  8120. * Executes the copy operation based on the current selection.
  8121. */
  8122. }, {
  8123. key: 'copyText',
  8124. value: function copyText() {
  8125. var succeeded = void 0;
  8126. try {
  8127. succeeded = document.execCommand(this.action);
  8128. } catch (err) {
  8129. succeeded = false;
  8130. }
  8131. this.handleResult(succeeded);
  8132. }
  8133. /**
  8134. * Fires an event based on the copy operation result.
  8135. * @param {Boolean} succeeded
  8136. */
  8137. }, {
  8138. key: 'handleResult',
  8139. value: function handleResult(succeeded) {
  8140. this.emitter.emit(succeeded ? 'success' : 'error', {
  8141. action: this.action,
  8142. text: this.selectedText,
  8143. trigger: this.trigger,
  8144. clearSelection: this.clearSelection.bind(this)
  8145. });
  8146. }
  8147. /**
  8148. * Moves focus away from `target` and back to the trigger, removes current selection.
  8149. */
  8150. }, {
  8151. key: 'clearSelection',
  8152. value: function clearSelection() {
  8153. if (this.trigger) {
  8154. this.trigger.focus();
  8155. }
  8156. window.getSelection().removeAllRanges();
  8157. }
  8158. /**
  8159. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8160. * @param {String} action
  8161. */
  8162. }, {
  8163. key: 'destroy',
  8164. /**
  8165. * Destroy lifecycle.
  8166. */
  8167. value: function destroy() {
  8168. this.removeFake();
  8169. }
  8170. }, {
  8171. key: 'action',
  8172. set: function set() {
  8173. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8174. this._action = action;
  8175. if (this._action !== 'copy' && this._action !== 'cut') {
  8176. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8177. }
  8178. }
  8179. /**
  8180. * Gets the `action` property.
  8181. * @return {String}
  8182. */
  8183. ,
  8184. get: function get() {
  8185. return this._action;
  8186. }
  8187. /**
  8188. * Sets the `target` property using an element
  8189. * that will be have its content copied.
  8190. * @param {Element} target
  8191. */
  8192. }, {
  8193. key: 'target',
  8194. set: function set(target) {
  8195. if (target !== undefined) {
  8196. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8197. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8198. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8199. }
  8200. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8201. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8202. }
  8203. this._target = target;
  8204. } else {
  8205. throw new Error('Invalid "target" value, use a valid Element');
  8206. }
  8207. }
  8208. }
  8209. /**
  8210. * Gets the `target` property.
  8211. * @return {String|HTMLElement}
  8212. */
  8213. ,
  8214. get: function get() {
  8215. return this._target;
  8216. }
  8217. }]);
  8218. return ClipboardAction;
  8219. }();
  8220. module.exports = ClipboardAction;
  8221. /***/ }),
  8222. /* 2 */
  8223. /***/ (function(module, exports) {
  8224. function select(element) {
  8225. var selectedText;
  8226. if (element.nodeName === 'SELECT') {
  8227. element.focus();
  8228. selectedText = element.value;
  8229. }
  8230. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8231. var isReadOnly = element.hasAttribute('readonly');
  8232. if (!isReadOnly) {
  8233. element.setAttribute('readonly', '');
  8234. }
  8235. element.select();
  8236. element.setSelectionRange(0, element.value.length);
  8237. if (!isReadOnly) {
  8238. element.removeAttribute('readonly');
  8239. }
  8240. selectedText = element.value;
  8241. }
  8242. else {
  8243. if (element.hasAttribute('contenteditable')) {
  8244. element.focus();
  8245. }
  8246. var selection = window.getSelection();
  8247. var range = document.createRange();
  8248. range.selectNodeContents(element);
  8249. selection.removeAllRanges();
  8250. selection.addRange(range);
  8251. selectedText = selection.toString();
  8252. }
  8253. return selectedText;
  8254. }
  8255. module.exports = select;
  8256. /***/ }),
  8257. /* 3 */
  8258. /***/ (function(module, exports) {
  8259. function E () {
  8260. // Keep this empty so it's easier to inherit from
  8261. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8262. }
  8263. E.prototype = {
  8264. on: function (name, callback, ctx) {
  8265. var e = this.e || (this.e = {});
  8266. (e[name] || (e[name] = [])).push({
  8267. fn: callback,
  8268. ctx: ctx
  8269. });
  8270. return this;
  8271. },
  8272. once: function (name, callback, ctx) {
  8273. var self = this;
  8274. function listener () {
  8275. self.off(name, listener);
  8276. callback.apply(ctx, arguments);
  8277. };
  8278. listener._ = callback
  8279. return this.on(name, listener, ctx);
  8280. },
  8281. emit: function (name) {
  8282. var data = [].slice.call(arguments, 1);
  8283. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8284. var i = 0;
  8285. var len = evtArr.length;
  8286. for (i; i < len; i++) {
  8287. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8288. }
  8289. return this;
  8290. },
  8291. off: function (name, callback) {
  8292. var e = this.e || (this.e = {});
  8293. var evts = e[name];
  8294. var liveEvents = [];
  8295. if (evts && callback) {
  8296. for (var i = 0, len = evts.length; i < len; i++) {
  8297. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8298. liveEvents.push(evts[i]);
  8299. }
  8300. }
  8301. // Remove event from queue to prevent memory leak
  8302. // Suggested by https://github.com/lazd
  8303. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8304. (liveEvents.length)
  8305. ? e[name] = liveEvents
  8306. : delete e[name];
  8307. return this;
  8308. }
  8309. };
  8310. module.exports = E;
  8311. /***/ }),
  8312. /* 4 */
  8313. /***/ (function(module, exports, __webpack_require__) {
  8314. var is = __webpack_require__(5);
  8315. var delegate = __webpack_require__(6);
  8316. /**
  8317. * Validates all params and calls the right
  8318. * listener function based on its target type.
  8319. *
  8320. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8321. * @param {String} type
  8322. * @param {Function} callback
  8323. * @return {Object}
  8324. */
  8325. function listen(target, type, callback) {
  8326. if (!target && !type && !callback) {
  8327. throw new Error('Missing required arguments');
  8328. }
  8329. if (!is.string(type)) {
  8330. throw new TypeError('Second argument must be a String');
  8331. }
  8332. if (!is.fn(callback)) {
  8333. throw new TypeError('Third argument must be a Function');
  8334. }
  8335. if (is.node(target)) {
  8336. return listenNode(target, type, callback);
  8337. }
  8338. else if (is.nodeList(target)) {
  8339. return listenNodeList(target, type, callback);
  8340. }
  8341. else if (is.string(target)) {
  8342. return listenSelector(target, type, callback);
  8343. }
  8344. else {
  8345. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8346. }
  8347. }
  8348. /**
  8349. * Adds an event listener to a HTML element
  8350. * and returns a remove listener function.
  8351. *
  8352. * @param {HTMLElement} node
  8353. * @param {String} type
  8354. * @param {Function} callback
  8355. * @return {Object}
  8356. */
  8357. function listenNode(node, type, callback) {
  8358. node.addEventListener(type, callback);
  8359. return {
  8360. destroy: function() {
  8361. node.removeEventListener(type, callback);
  8362. }
  8363. }
  8364. }
  8365. /**
  8366. * Add an event listener to a list of HTML elements
  8367. * and returns a remove listener function.
  8368. *
  8369. * @param {NodeList|HTMLCollection} nodeList
  8370. * @param {String} type
  8371. * @param {Function} callback
  8372. * @return {Object}
  8373. */
  8374. function listenNodeList(nodeList, type, callback) {
  8375. Array.prototype.forEach.call(nodeList, function(node) {
  8376. node.addEventListener(type, callback);
  8377. });
  8378. return {
  8379. destroy: function() {
  8380. Array.prototype.forEach.call(nodeList, function(node) {
  8381. node.removeEventListener(type, callback);
  8382. });
  8383. }
  8384. }
  8385. }
  8386. /**
  8387. * Add an event listener to a selector
  8388. * and returns a remove listener function.
  8389. *
  8390. * @param {String} selector
  8391. * @param {String} type
  8392. * @param {Function} callback
  8393. * @return {Object}
  8394. */
  8395. function listenSelector(selector, type, callback) {
  8396. return delegate(document.body, selector, type, callback);
  8397. }
  8398. module.exports = listen;
  8399. /***/ }),
  8400. /* 5 */
  8401. /***/ (function(module, exports) {
  8402. /**
  8403. * Check if argument is a HTML element.
  8404. *
  8405. * @param {Object} value
  8406. * @return {Boolean}
  8407. */
  8408. exports.node = function(value) {
  8409. return value !== undefined
  8410. && value instanceof HTMLElement
  8411. && value.nodeType === 1;
  8412. };
  8413. /**
  8414. * Check if argument is a list of HTML elements.
  8415. *
  8416. * @param {Object} value
  8417. * @return {Boolean}
  8418. */
  8419. exports.nodeList = function(value) {
  8420. var type = Object.prototype.toString.call(value);
  8421. return value !== undefined
  8422. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8423. && ('length' in value)
  8424. && (value.length === 0 || exports.node(value[0]));
  8425. };
  8426. /**
  8427. * Check if argument is a string.
  8428. *
  8429. * @param {Object} value
  8430. * @return {Boolean}
  8431. */
  8432. exports.string = function(value) {
  8433. return typeof value === 'string'
  8434. || value instanceof String;
  8435. };
  8436. /**
  8437. * Check if argument is a function.
  8438. *
  8439. * @param {Object} value
  8440. * @return {Boolean}
  8441. */
  8442. exports.fn = function(value) {
  8443. var type = Object.prototype.toString.call(value);
  8444. return type === '[object Function]';
  8445. };
  8446. /***/ }),
  8447. /* 6 */
  8448. /***/ (function(module, exports, __webpack_require__) {
  8449. var closest = __webpack_require__(7);
  8450. /**
  8451. * Delegates event to a selector.
  8452. *
  8453. * @param {Element} element
  8454. * @param {String} selector
  8455. * @param {String} type
  8456. * @param {Function} callback
  8457. * @param {Boolean} useCapture
  8458. * @return {Object}
  8459. */
  8460. function _delegate(element, selector, type, callback, useCapture) {
  8461. var listenerFn = listener.apply(this, arguments);
  8462. element.addEventListener(type, listenerFn, useCapture);
  8463. return {
  8464. destroy: function() {
  8465. element.removeEventListener(type, listenerFn, useCapture);
  8466. }
  8467. }
  8468. }
  8469. /**
  8470. * Delegates event to a selector.
  8471. *
  8472. * @param {Element|String|Array} [elements]
  8473. * @param {String} selector
  8474. * @param {String} type
  8475. * @param {Function} callback
  8476. * @param {Boolean} useCapture
  8477. * @return {Object}
  8478. */
  8479. function delegate(elements, selector, type, callback, useCapture) {
  8480. // Handle the regular Element usage
  8481. if (typeof elements.addEventListener === 'function') {
  8482. return _delegate.apply(null, arguments);
  8483. }
  8484. // Handle Element-less usage, it defaults to global delegation
  8485. if (typeof type === 'function') {
  8486. // Use `document` as the first parameter, then apply arguments
  8487. // This is a short way to .unshift `arguments` without running into deoptimizations
  8488. return _delegate.bind(null, document).apply(null, arguments);
  8489. }
  8490. // Handle Selector-based usage
  8491. if (typeof elements === 'string') {
  8492. elements = document.querySelectorAll(elements);
  8493. }
  8494. // Handle Array-like based usage
  8495. return Array.prototype.map.call(elements, function (element) {
  8496. return _delegate(element, selector, type, callback, useCapture);
  8497. });
  8498. }
  8499. /**
  8500. * Finds closest match and invokes callback.
  8501. *
  8502. * @param {Element} element
  8503. * @param {String} selector
  8504. * @param {String} type
  8505. * @param {Function} callback
  8506. * @return {Function}
  8507. */
  8508. function listener(element, selector, type, callback) {
  8509. return function(e) {
  8510. e.delegateTarget = closest(e.target, selector);
  8511. if (e.delegateTarget) {
  8512. callback.call(element, e);
  8513. }
  8514. }
  8515. }
  8516. module.exports = delegate;
  8517. /***/ }),
  8518. /* 7 */
  8519. /***/ (function(module, exports) {
  8520. var DOCUMENT_NODE_TYPE = 9;
  8521. /**
  8522. * A polyfill for Element.matches()
  8523. */
  8524. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8525. var proto = Element.prototype;
  8526. proto.matches = proto.matchesSelector ||
  8527. proto.mozMatchesSelector ||
  8528. proto.msMatchesSelector ||
  8529. proto.oMatchesSelector ||
  8530. proto.webkitMatchesSelector;
  8531. }
  8532. /**
  8533. * Finds the closest parent that matches a selector.
  8534. *
  8535. * @param {Element} element
  8536. * @param {String} selector
  8537. * @return {Function}
  8538. */
  8539. function closest (element, selector) {
  8540. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8541. if (typeof element.matches === 'function' &&
  8542. element.matches(selector)) {
  8543. return element;
  8544. }
  8545. element = element.parentNode;
  8546. }
  8547. }
  8548. module.exports = closest;
  8549. /***/ })
  8550. /******/ ]);
  8551. });
  8552. /***/ }),
  8553. /***/ "./node_modules/ieee754/index.js":
  8554. /*!***************************************!*\
  8555. !*** ./node_modules/ieee754/index.js ***!
  8556. \***************************************/
  8557. /*! no static exports found */
  8558. /***/ (function(module, exports) {
  8559. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8560. var e, m
  8561. var eLen = (nBytes * 8) - mLen - 1
  8562. var eMax = (1 << eLen) - 1
  8563. var eBias = eMax >> 1
  8564. var nBits = -7
  8565. var i = isLE ? (nBytes - 1) : 0
  8566. var d = isLE ? -1 : 1
  8567. var s = buffer[offset + i]
  8568. i += d
  8569. e = s & ((1 << (-nBits)) - 1)
  8570. s >>= (-nBits)
  8571. nBits += eLen
  8572. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8573. m = e & ((1 << (-nBits)) - 1)
  8574. e >>= (-nBits)
  8575. nBits += mLen
  8576. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8577. if (e === 0) {
  8578. e = 1 - eBias
  8579. } else if (e === eMax) {
  8580. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8581. } else {
  8582. m = m + Math.pow(2, mLen)
  8583. e = e - eBias
  8584. }
  8585. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8586. }
  8587. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8588. var e, m, c
  8589. var eLen = (nBytes * 8) - mLen - 1
  8590. var eMax = (1 << eLen) - 1
  8591. var eBias = eMax >> 1
  8592. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8593. var i = isLE ? 0 : (nBytes - 1)
  8594. var d = isLE ? 1 : -1
  8595. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8596. value = Math.abs(value)
  8597. if (isNaN(value) || value === Infinity) {
  8598. m = isNaN(value) ? 1 : 0
  8599. e = eMax
  8600. } else {
  8601. e = Math.floor(Math.log(value) / Math.LN2)
  8602. if (value * (c = Math.pow(2, -e)) < 1) {
  8603. e--
  8604. c *= 2
  8605. }
  8606. if (e + eBias >= 1) {
  8607. value += rt / c
  8608. } else {
  8609. value += rt * Math.pow(2, 1 - eBias)
  8610. }
  8611. if (value * c >= 2) {
  8612. e++
  8613. c /= 2
  8614. }
  8615. if (e + eBias >= eMax) {
  8616. m = 0
  8617. e = eMax
  8618. } else if (e + eBias >= 1) {
  8619. m = ((value * c) - 1) * Math.pow(2, mLen)
  8620. e = e + eBias
  8621. } else {
  8622. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8623. e = 0
  8624. }
  8625. }
  8626. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8627. e = (e << mLen) | m
  8628. eLen += mLen
  8629. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8630. buffer[offset + i - d] |= s * 128
  8631. }
  8632. /***/ }),
  8633. /***/ "./node_modules/isarray/index.js":
  8634. /*!***************************************!*\
  8635. !*** ./node_modules/isarray/index.js ***!
  8636. \***************************************/
  8637. /*! no static exports found */
  8638. /***/ (function(module, exports) {
  8639. var toString = {}.toString;
  8640. module.exports = Array.isArray || function (arr) {
  8641. return toString.call(arr) == '[object Array]';
  8642. };
  8643. /***/ }),
  8644. /***/ "./node_modules/jquery/dist/jquery.js":
  8645. /*!********************************************!*\
  8646. !*** ./node_modules/jquery/dist/jquery.js ***!
  8647. \********************************************/
  8648. /*! no static exports found */
  8649. /***/ (function(module, exports, __webpack_require__) {
  8650. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8651. * jQuery JavaScript Library v3.4.1
  8652. * https://jquery.com/
  8653. *
  8654. * Includes Sizzle.js
  8655. * https://sizzlejs.com/
  8656. *
  8657. * Copyright JS Foundation and other contributors
  8658. * Released under the MIT license
  8659. * https://jquery.org/license
  8660. *
  8661. * Date: 2019-05-01T21:04Z
  8662. */
  8663. ( function( global, factory ) {
  8664. "use strict";
  8665. if ( true && typeof module.exports === "object" ) {
  8666. // For CommonJS and CommonJS-like environments where a proper `window`
  8667. // is present, execute the factory and get jQuery.
  8668. // For environments that do not have a `window` with a `document`
  8669. // (such as Node.js), expose a factory as module.exports.
  8670. // This accentuates the need for the creation of a real `window`.
  8671. // e.g. var jQuery = require("jquery")(window);
  8672. // See ticket #14549 for more info.
  8673. module.exports = global.document ?
  8674. factory( global, true ) :
  8675. function( w ) {
  8676. if ( !w.document ) {
  8677. throw new Error( "jQuery requires a window with a document" );
  8678. }
  8679. return factory( w );
  8680. };
  8681. } else {
  8682. factory( global );
  8683. }
  8684. // Pass this if window is not defined yet
  8685. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8686. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8687. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8688. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8689. // enough that all such attempts are guarded in a try block.
  8690. "use strict";
  8691. var arr = [];
  8692. var document = window.document;
  8693. var getProto = Object.getPrototypeOf;
  8694. var slice = arr.slice;
  8695. var concat = arr.concat;
  8696. var push = arr.push;
  8697. var indexOf = arr.indexOf;
  8698. var class2type = {};
  8699. var toString = class2type.toString;
  8700. var hasOwn = class2type.hasOwnProperty;
  8701. var fnToString = hasOwn.toString;
  8702. var ObjectFunctionString = fnToString.call( Object );
  8703. var support = {};
  8704. var isFunction = function isFunction( obj ) {
  8705. // Support: Chrome <=57, Firefox <=52
  8706. // In some browsers, typeof returns "function" for HTML <object> elements
  8707. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8708. // We don't want to classify *any* DOM node as a function.
  8709. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8710. };
  8711. var isWindow = function isWindow( obj ) {
  8712. return obj != null && obj === obj.window;
  8713. };
  8714. var preservedScriptAttributes = {
  8715. type: true,
  8716. src: true,
  8717. nonce: true,
  8718. noModule: true
  8719. };
  8720. function DOMEval( code, node, doc ) {
  8721. doc = doc || document;
  8722. var i, val,
  8723. script = doc.createElement( "script" );
  8724. script.text = code;
  8725. if ( node ) {
  8726. for ( i in preservedScriptAttributes ) {
  8727. // Support: Firefox 64+, Edge 18+
  8728. // Some browsers don't support the "nonce" property on scripts.
  8729. // On the other hand, just using `getAttribute` is not enough as
  8730. // the `nonce` attribute is reset to an empty string whenever it
  8731. // becomes browsing-context connected.
  8732. // See https://github.com/whatwg/html/issues/2369
  8733. // See https://html.spec.whatwg.org/#nonce-attributes
  8734. // The `node.getAttribute` check was added for the sake of
  8735. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8736. // via an object.
  8737. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8738. if ( val ) {
  8739. script.setAttribute( i, val );
  8740. }
  8741. }
  8742. }
  8743. doc.head.appendChild( script ).parentNode.removeChild( script );
  8744. }
  8745. function toType( obj ) {
  8746. if ( obj == null ) {
  8747. return obj + "";
  8748. }
  8749. // Support: Android <=2.3 only (functionish RegExp)
  8750. return typeof obj === "object" || typeof obj === "function" ?
  8751. class2type[ toString.call( obj ) ] || "object" :
  8752. typeof obj;
  8753. }
  8754. /* global Symbol */
  8755. // Defining this global in .eslintrc.json would create a danger of using the global
  8756. // unguarded in another place, it seems safer to define global only for this module
  8757. var
  8758. version = "3.4.1",
  8759. // Define a local copy of jQuery
  8760. jQuery = function( selector, context ) {
  8761. // The jQuery object is actually just the init constructor 'enhanced'
  8762. // Need init if jQuery is called (just allow error to be thrown if not included)
  8763. return new jQuery.fn.init( selector, context );
  8764. },
  8765. // Support: Android <=4.0 only
  8766. // Make sure we trim BOM and NBSP
  8767. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8768. jQuery.fn = jQuery.prototype = {
  8769. // The current version of jQuery being used
  8770. jquery: version,
  8771. constructor: jQuery,
  8772. // The default length of a jQuery object is 0
  8773. length: 0,
  8774. toArray: function() {
  8775. return slice.call( this );
  8776. },
  8777. // Get the Nth element in the matched element set OR
  8778. // Get the whole matched element set as a clean array
  8779. get: function( num ) {
  8780. // Return all the elements in a clean array
  8781. if ( num == null ) {
  8782. return slice.call( this );
  8783. }
  8784. // Return just the one element from the set
  8785. return num < 0 ? this[ num + this.length ] : this[ num ];
  8786. },
  8787. // Take an array of elements and push it onto the stack
  8788. // (returning the new matched element set)
  8789. pushStack: function( elems ) {
  8790. // Build a new jQuery matched element set
  8791. var ret = jQuery.merge( this.constructor(), elems );
  8792. // Add the old object onto the stack (as a reference)
  8793. ret.prevObject = this;
  8794. // Return the newly-formed element set
  8795. return ret;
  8796. },
  8797. // Execute a callback for every element in the matched set.
  8798. each: function( callback ) {
  8799. return jQuery.each( this, callback );
  8800. },
  8801. map: function( callback ) {
  8802. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8803. return callback.call( elem, i, elem );
  8804. } ) );
  8805. },
  8806. slice: function() {
  8807. return this.pushStack( slice.apply( this, arguments ) );
  8808. },
  8809. first: function() {
  8810. return this.eq( 0 );
  8811. },
  8812. last: function() {
  8813. return this.eq( -1 );
  8814. },
  8815. eq: function( i ) {
  8816. var len = this.length,
  8817. j = +i + ( i < 0 ? len : 0 );
  8818. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8819. },
  8820. end: function() {
  8821. return this.prevObject || this.constructor();
  8822. },
  8823. // For internal use only.
  8824. // Behaves like an Array's method, not like a jQuery method.
  8825. push: push,
  8826. sort: arr.sort,
  8827. splice: arr.splice
  8828. };
  8829. jQuery.extend = jQuery.fn.extend = function() {
  8830. var options, name, src, copy, copyIsArray, clone,
  8831. target = arguments[ 0 ] || {},
  8832. i = 1,
  8833. length = arguments.length,
  8834. deep = false;
  8835. // Handle a deep copy situation
  8836. if ( typeof target === "boolean" ) {
  8837. deep = target;
  8838. // Skip the boolean and the target
  8839. target = arguments[ i ] || {};
  8840. i++;
  8841. }
  8842. // Handle case when target is a string or something (possible in deep copy)
  8843. if ( typeof target !== "object" && !isFunction( target ) ) {
  8844. target = {};
  8845. }
  8846. // Extend jQuery itself if only one argument is passed
  8847. if ( i === length ) {
  8848. target = this;
  8849. i--;
  8850. }
  8851. for ( ; i < length; i++ ) {
  8852. // Only deal with non-null/undefined values
  8853. if ( ( options = arguments[ i ] ) != null ) {
  8854. // Extend the base object
  8855. for ( name in options ) {
  8856. copy = options[ name ];
  8857. // Prevent Object.prototype pollution
  8858. // Prevent never-ending loop
  8859. if ( name === "__proto__" || target === copy ) {
  8860. continue;
  8861. }
  8862. // Recurse if we're merging plain objects or arrays
  8863. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8864. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8865. src = target[ name ];
  8866. // Ensure proper type for the source value
  8867. if ( copyIsArray && !Array.isArray( src ) ) {
  8868. clone = [];
  8869. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8870. clone = {};
  8871. } else {
  8872. clone = src;
  8873. }
  8874. copyIsArray = false;
  8875. // Never move original objects, clone them
  8876. target[ name ] = jQuery.extend( deep, clone, copy );
  8877. // Don't bring in undefined values
  8878. } else if ( copy !== undefined ) {
  8879. target[ name ] = copy;
  8880. }
  8881. }
  8882. }
  8883. }
  8884. // Return the modified object
  8885. return target;
  8886. };
  8887. jQuery.extend( {
  8888. // Unique for each copy of jQuery on the page
  8889. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8890. // Assume jQuery is ready without the ready module
  8891. isReady: true,
  8892. error: function( msg ) {
  8893. throw new Error( msg );
  8894. },
  8895. noop: function() {},
  8896. isPlainObject: function( obj ) {
  8897. var proto, Ctor;
  8898. // Detect obvious negatives
  8899. // Use toString instead of jQuery.type to catch host objects
  8900. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8901. return false;
  8902. }
  8903. proto = getProto( obj );
  8904. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8905. if ( !proto ) {
  8906. return true;
  8907. }
  8908. // Objects with prototype are plain iff they were constructed by a global Object function
  8909. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8910. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8911. },
  8912. isEmptyObject: function( obj ) {
  8913. var name;
  8914. for ( name in obj ) {
  8915. return false;
  8916. }
  8917. return true;
  8918. },
  8919. // Evaluates a script in a global context
  8920. globalEval: function( code, options ) {
  8921. DOMEval( code, { nonce: options && options.nonce } );
  8922. },
  8923. each: function( obj, callback ) {
  8924. var length, i = 0;
  8925. if ( isArrayLike( obj ) ) {
  8926. length = obj.length;
  8927. for ( ; i < length; i++ ) {
  8928. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8929. break;
  8930. }
  8931. }
  8932. } else {
  8933. for ( i in obj ) {
  8934. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8935. break;
  8936. }
  8937. }
  8938. }
  8939. return obj;
  8940. },
  8941. // Support: Android <=4.0 only
  8942. trim: function( text ) {
  8943. return text == null ?
  8944. "" :
  8945. ( text + "" ).replace( rtrim, "" );
  8946. },
  8947. // results is for internal usage only
  8948. makeArray: function( arr, results ) {
  8949. var ret = results || [];
  8950. if ( arr != null ) {
  8951. if ( isArrayLike( Object( arr ) ) ) {
  8952. jQuery.merge( ret,
  8953. typeof arr === "string" ?
  8954. [ arr ] : arr
  8955. );
  8956. } else {
  8957. push.call( ret, arr );
  8958. }
  8959. }
  8960. return ret;
  8961. },
  8962. inArray: function( elem, arr, i ) {
  8963. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8964. },
  8965. // Support: Android <=4.0 only, PhantomJS 1 only
  8966. // push.apply(_, arraylike) throws on ancient WebKit
  8967. merge: function( first, second ) {
  8968. var len = +second.length,
  8969. j = 0,
  8970. i = first.length;
  8971. for ( ; j < len; j++ ) {
  8972. first[ i++ ] = second[ j ];
  8973. }
  8974. first.length = i;
  8975. return first;
  8976. },
  8977. grep: function( elems, callback, invert ) {
  8978. var callbackInverse,
  8979. matches = [],
  8980. i = 0,
  8981. length = elems.length,
  8982. callbackExpect = !invert;
  8983. // Go through the array, only saving the items
  8984. // that pass the validator function
  8985. for ( ; i < length; i++ ) {
  8986. callbackInverse = !callback( elems[ i ], i );
  8987. if ( callbackInverse !== callbackExpect ) {
  8988. matches.push( elems[ i ] );
  8989. }
  8990. }
  8991. return matches;
  8992. },
  8993. // arg is for internal usage only
  8994. map: function( elems, callback, arg ) {
  8995. var length, value,
  8996. i = 0,
  8997. ret = [];
  8998. // Go through the array, translating each of the items to their new values
  8999. if ( isArrayLike( elems ) ) {
  9000. length = elems.length;
  9001. for ( ; i < length; i++ ) {
  9002. value = callback( elems[ i ], i, arg );
  9003. if ( value != null ) {
  9004. ret.push( value );
  9005. }
  9006. }
  9007. // Go through every key on the object,
  9008. } else {
  9009. for ( i in elems ) {
  9010. value = callback( elems[ i ], i, arg );
  9011. if ( value != null ) {
  9012. ret.push( value );
  9013. }
  9014. }
  9015. }
  9016. // Flatten any nested arrays
  9017. return concat.apply( [], ret );
  9018. },
  9019. // A global GUID counter for objects
  9020. guid: 1,
  9021. // jQuery.support is not used in Core but other projects attach their
  9022. // properties to it so it needs to exist.
  9023. support: support
  9024. } );
  9025. if ( typeof Symbol === "function" ) {
  9026. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9027. }
  9028. // Populate the class2type map
  9029. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9030. function( i, name ) {
  9031. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9032. } );
  9033. function isArrayLike( obj ) {
  9034. // Support: real iOS 8.2 only (not reproducible in simulator)
  9035. // `in` check used to prevent JIT error (gh-2145)
  9036. // hasOwn isn't used here due to false negatives
  9037. // regarding Nodelist length in IE
  9038. var length = !!obj && "length" in obj && obj.length,
  9039. type = toType( obj );
  9040. if ( isFunction( obj ) || isWindow( obj ) ) {
  9041. return false;
  9042. }
  9043. return type === "array" || length === 0 ||
  9044. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9045. }
  9046. var Sizzle =
  9047. /*!
  9048. * Sizzle CSS Selector Engine v2.3.4
  9049. * https://sizzlejs.com/
  9050. *
  9051. * Copyright JS Foundation and other contributors
  9052. * Released under the MIT license
  9053. * https://js.foundation/
  9054. *
  9055. * Date: 2019-04-08
  9056. */
  9057. (function( window ) {
  9058. var i,
  9059. support,
  9060. Expr,
  9061. getText,
  9062. isXML,
  9063. tokenize,
  9064. compile,
  9065. select,
  9066. outermostContext,
  9067. sortInput,
  9068. hasDuplicate,
  9069. // Local document vars
  9070. setDocument,
  9071. document,
  9072. docElem,
  9073. documentIsHTML,
  9074. rbuggyQSA,
  9075. rbuggyMatches,
  9076. matches,
  9077. contains,
  9078. // Instance-specific data
  9079. expando = "sizzle" + 1 * new Date(),
  9080. preferredDoc = window.document,
  9081. dirruns = 0,
  9082. done = 0,
  9083. classCache = createCache(),
  9084. tokenCache = createCache(),
  9085. compilerCache = createCache(),
  9086. nonnativeSelectorCache = createCache(),
  9087. sortOrder = function( a, b ) {
  9088. if ( a === b ) {
  9089. hasDuplicate = true;
  9090. }
  9091. return 0;
  9092. },
  9093. // Instance methods
  9094. hasOwn = ({}).hasOwnProperty,
  9095. arr = [],
  9096. pop = arr.pop,
  9097. push_native = arr.push,
  9098. push = arr.push,
  9099. slice = arr.slice,
  9100. // Use a stripped-down indexOf as it's faster than native
  9101. // https://jsperf.com/thor-indexof-vs-for/5
  9102. indexOf = function( list, elem ) {
  9103. var i = 0,
  9104. len = list.length;
  9105. for ( ; i < len; i++ ) {
  9106. if ( list[i] === elem ) {
  9107. return i;
  9108. }
  9109. }
  9110. return -1;
  9111. },
  9112. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9113. // Regular expressions
  9114. // http://www.w3.org/TR/css3-selectors/#whitespace
  9115. whitespace = "[\\x20\\t\\r\\n\\f]",
  9116. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9117. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9118. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9119. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9120. // Operator (capture 2)
  9121. "*([*^$|!~]?=)" + whitespace +
  9122. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9123. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9124. "*\\]",
  9125. pseudos = ":(" + identifier + ")(?:\\((" +
  9126. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9127. // 1. quoted (capture 3; capture 4 or capture 5)
  9128. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9129. // 2. simple (capture 6)
  9130. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9131. // 3. anything else (capture 2)
  9132. ".*" +
  9133. ")\\)|)",
  9134. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9135. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9136. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9137. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9138. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9139. rdescend = new RegExp( whitespace + "|>" ),
  9140. rpseudo = new RegExp( pseudos ),
  9141. ridentifier = new RegExp( "^" + identifier + "$" ),
  9142. matchExpr = {
  9143. "ID": new RegExp( "^#(" + identifier + ")" ),
  9144. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9145. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9146. "ATTR": new RegExp( "^" + attributes ),
  9147. "PSEUDO": new RegExp( "^" + pseudos ),
  9148. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9149. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9150. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9151. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9152. // For use in libraries implementing .is()
  9153. // We use this for POS matching in `select`
  9154. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9155. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9156. },
  9157. rhtml = /HTML$/i,
  9158. rinputs = /^(?:input|select|textarea|button)$/i,
  9159. rheader = /^h\d$/i,
  9160. rnative = /^[^{]+\{\s*\[native \w/,
  9161. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9162. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9163. rsibling = /[+~]/,
  9164. // CSS escapes
  9165. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9166. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9167. funescape = function( _, escaped, escapedWhitespace ) {
  9168. var high = "0x" + escaped - 0x10000;
  9169. // NaN means non-codepoint
  9170. // Support: Firefox<24
  9171. // Workaround erroneous numeric interpretation of +"0x"
  9172. return high !== high || escapedWhitespace ?
  9173. escaped :
  9174. high < 0 ?
  9175. // BMP codepoint
  9176. String.fromCharCode( high + 0x10000 ) :
  9177. // Supplemental Plane codepoint (surrogate pair)
  9178. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9179. },
  9180. // CSS string/identifier serialization
  9181. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9182. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9183. fcssescape = function( ch, asCodePoint ) {
  9184. if ( asCodePoint ) {
  9185. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9186. if ( ch === "\0" ) {
  9187. return "\uFFFD";
  9188. }
  9189. // Control characters and (dependent upon position) numbers get escaped as code points
  9190. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9191. }
  9192. // Other potentially-special ASCII characters get backslash-escaped
  9193. return "\\" + ch;
  9194. },
  9195. // Used for iframes
  9196. // See setDocument()
  9197. // Removing the function wrapper causes a "Permission Denied"
  9198. // error in IE
  9199. unloadHandler = function() {
  9200. setDocument();
  9201. },
  9202. inDisabledFieldset = addCombinator(
  9203. function( elem ) {
  9204. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9205. },
  9206. { dir: "parentNode", next: "legend" }
  9207. );
  9208. // Optimize for push.apply( _, NodeList )
  9209. try {
  9210. push.apply(
  9211. (arr = slice.call( preferredDoc.childNodes )),
  9212. preferredDoc.childNodes
  9213. );
  9214. // Support: Android<4.0
  9215. // Detect silently failing push.apply
  9216. arr[ preferredDoc.childNodes.length ].nodeType;
  9217. } catch ( e ) {
  9218. push = { apply: arr.length ?
  9219. // Leverage slice if possible
  9220. function( target, els ) {
  9221. push_native.apply( target, slice.call(els) );
  9222. } :
  9223. // Support: IE<9
  9224. // Otherwise append directly
  9225. function( target, els ) {
  9226. var j = target.length,
  9227. i = 0;
  9228. // Can't trust NodeList.length
  9229. while ( (target[j++] = els[i++]) ) {}
  9230. target.length = j - 1;
  9231. }
  9232. };
  9233. }
  9234. function Sizzle( selector, context, results, seed ) {
  9235. var m, i, elem, nid, match, groups, newSelector,
  9236. newContext = context && context.ownerDocument,
  9237. // nodeType defaults to 9, since context defaults to document
  9238. nodeType = context ? context.nodeType : 9;
  9239. results = results || [];
  9240. // Return early from calls with invalid selector or context
  9241. if ( typeof selector !== "string" || !selector ||
  9242. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9243. return results;
  9244. }
  9245. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9246. if ( !seed ) {
  9247. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9248. setDocument( context );
  9249. }
  9250. context = context || document;
  9251. if ( documentIsHTML ) {
  9252. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9253. // (excepting DocumentFragment context, where the methods don't exist)
  9254. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9255. // ID selector
  9256. if ( (m = match[1]) ) {
  9257. // Document context
  9258. if ( nodeType === 9 ) {
  9259. if ( (elem = context.getElementById( m )) ) {
  9260. // Support: IE, Opera, Webkit
  9261. // TODO: identify versions
  9262. // getElementById can match elements by name instead of ID
  9263. if ( elem.id === m ) {
  9264. results.push( elem );
  9265. return results;
  9266. }
  9267. } else {
  9268. return results;
  9269. }
  9270. // Element context
  9271. } else {
  9272. // Support: IE, Opera, Webkit
  9273. // TODO: identify versions
  9274. // getElementById can match elements by name instead of ID
  9275. if ( newContext && (elem = newContext.getElementById( m )) &&
  9276. contains( context, elem ) &&
  9277. elem.id === m ) {
  9278. results.push( elem );
  9279. return results;
  9280. }
  9281. }
  9282. // Type selector
  9283. } else if ( match[2] ) {
  9284. push.apply( results, context.getElementsByTagName( selector ) );
  9285. return results;
  9286. // Class selector
  9287. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9288. context.getElementsByClassName ) {
  9289. push.apply( results, context.getElementsByClassName( m ) );
  9290. return results;
  9291. }
  9292. }
  9293. // Take advantage of querySelectorAll
  9294. if ( support.qsa &&
  9295. !nonnativeSelectorCache[ selector + " " ] &&
  9296. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9297. // Support: IE 8 only
  9298. // Exclude object elements
  9299. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9300. newSelector = selector;
  9301. newContext = context;
  9302. // qSA considers elements outside a scoping root when evaluating child or
  9303. // descendant combinators, which is not what we want.
  9304. // In such cases, we work around the behavior by prefixing every selector in the
  9305. // list with an ID selector referencing the scope context.
  9306. // Thanks to Andrew Dupont for this technique.
  9307. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9308. // Capture the context ID, setting it first if necessary
  9309. if ( (nid = context.getAttribute( "id" )) ) {
  9310. nid = nid.replace( rcssescape, fcssescape );
  9311. } else {
  9312. context.setAttribute( "id", (nid = expando) );
  9313. }
  9314. // Prefix every selector in the list
  9315. groups = tokenize( selector );
  9316. i = groups.length;
  9317. while ( i-- ) {
  9318. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9319. }
  9320. newSelector = groups.join( "," );
  9321. // Expand context for sibling selectors
  9322. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9323. context;
  9324. }
  9325. try {
  9326. push.apply( results,
  9327. newContext.querySelectorAll( newSelector )
  9328. );
  9329. return results;
  9330. } catch ( qsaError ) {
  9331. nonnativeSelectorCache( selector, true );
  9332. } finally {
  9333. if ( nid === expando ) {
  9334. context.removeAttribute( "id" );
  9335. }
  9336. }
  9337. }
  9338. }
  9339. }
  9340. // All others
  9341. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9342. }
  9343. /**
  9344. * Create key-value caches of limited size
  9345. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9346. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9347. * deleting the oldest entry
  9348. */
  9349. function createCache() {
  9350. var keys = [];
  9351. function cache( key, value ) {
  9352. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9353. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9354. // Only keep the most recent entries
  9355. delete cache[ keys.shift() ];
  9356. }
  9357. return (cache[ key + " " ] = value);
  9358. }
  9359. return cache;
  9360. }
  9361. /**
  9362. * Mark a function for special use by Sizzle
  9363. * @param {Function} fn The function to mark
  9364. */
  9365. function markFunction( fn ) {
  9366. fn[ expando ] = true;
  9367. return fn;
  9368. }
  9369. /**
  9370. * Support testing using an element
  9371. * @param {Function} fn Passed the created element and returns a boolean result
  9372. */
  9373. function assert( fn ) {
  9374. var el = document.createElement("fieldset");
  9375. try {
  9376. return !!fn( el );
  9377. } catch (e) {
  9378. return false;
  9379. } finally {
  9380. // Remove from its parent by default
  9381. if ( el.parentNode ) {
  9382. el.parentNode.removeChild( el );
  9383. }
  9384. // release memory in IE
  9385. el = null;
  9386. }
  9387. }
  9388. /**
  9389. * Adds the same handler for all of the specified attrs
  9390. * @param {String} attrs Pipe-separated list of attributes
  9391. * @param {Function} handler The method that will be applied
  9392. */
  9393. function addHandle( attrs, handler ) {
  9394. var arr = attrs.split("|"),
  9395. i = arr.length;
  9396. while ( i-- ) {
  9397. Expr.attrHandle[ arr[i] ] = handler;
  9398. }
  9399. }
  9400. /**
  9401. * Checks document order of two siblings
  9402. * @param {Element} a
  9403. * @param {Element} b
  9404. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9405. */
  9406. function siblingCheck( a, b ) {
  9407. var cur = b && a,
  9408. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9409. a.sourceIndex - b.sourceIndex;
  9410. // Use IE sourceIndex if available on both nodes
  9411. if ( diff ) {
  9412. return diff;
  9413. }
  9414. // Check if b follows a
  9415. if ( cur ) {
  9416. while ( (cur = cur.nextSibling) ) {
  9417. if ( cur === b ) {
  9418. return -1;
  9419. }
  9420. }
  9421. }
  9422. return a ? 1 : -1;
  9423. }
  9424. /**
  9425. * Returns a function to use in pseudos for input types
  9426. * @param {String} type
  9427. */
  9428. function createInputPseudo( type ) {
  9429. return function( elem ) {
  9430. var name = elem.nodeName.toLowerCase();
  9431. return name === "input" && elem.type === type;
  9432. };
  9433. }
  9434. /**
  9435. * Returns a function to use in pseudos for buttons
  9436. * @param {String} type
  9437. */
  9438. function createButtonPseudo( type ) {
  9439. return function( elem ) {
  9440. var name = elem.nodeName.toLowerCase();
  9441. return (name === "input" || name === "button") && elem.type === type;
  9442. };
  9443. }
  9444. /**
  9445. * Returns a function to use in pseudos for :enabled/:disabled
  9446. * @param {Boolean} disabled true for :disabled; false for :enabled
  9447. */
  9448. function createDisabledPseudo( disabled ) {
  9449. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9450. return function( elem ) {
  9451. // Only certain elements can match :enabled or :disabled
  9452. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9453. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9454. if ( "form" in elem ) {
  9455. // Check for inherited disabledness on relevant non-disabled elements:
  9456. // * listed form-associated elements in a disabled fieldset
  9457. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9458. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9459. // * option elements in a disabled optgroup
  9460. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9461. // All such elements have a "form" property.
  9462. if ( elem.parentNode && elem.disabled === false ) {
  9463. // Option elements defer to a parent optgroup if present
  9464. if ( "label" in elem ) {
  9465. if ( "label" in elem.parentNode ) {
  9466. return elem.parentNode.disabled === disabled;
  9467. } else {
  9468. return elem.disabled === disabled;
  9469. }
  9470. }
  9471. // Support: IE 6 - 11
  9472. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9473. return elem.isDisabled === disabled ||
  9474. // Where there is no isDisabled, check manually
  9475. /* jshint -W018 */
  9476. elem.isDisabled !== !disabled &&
  9477. inDisabledFieldset( elem ) === disabled;
  9478. }
  9479. return elem.disabled === disabled;
  9480. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9481. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9482. // even exist on them, let alone have a boolean value.
  9483. } else if ( "label" in elem ) {
  9484. return elem.disabled === disabled;
  9485. }
  9486. // Remaining elements are neither :enabled nor :disabled
  9487. return false;
  9488. };
  9489. }
  9490. /**
  9491. * Returns a function to use in pseudos for positionals
  9492. * @param {Function} fn
  9493. */
  9494. function createPositionalPseudo( fn ) {
  9495. return markFunction(function( argument ) {
  9496. argument = +argument;
  9497. return markFunction(function( seed, matches ) {
  9498. var j,
  9499. matchIndexes = fn( [], seed.length, argument ),
  9500. i = matchIndexes.length;
  9501. // Match elements found at the specified indexes
  9502. while ( i-- ) {
  9503. if ( seed[ (j = matchIndexes[i]) ] ) {
  9504. seed[j] = !(matches[j] = seed[j]);
  9505. }
  9506. }
  9507. });
  9508. });
  9509. }
  9510. /**
  9511. * Checks a node for validity as a Sizzle context
  9512. * @param {Element|Object=} context
  9513. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9514. */
  9515. function testContext( context ) {
  9516. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9517. }
  9518. // Expose support vars for convenience
  9519. support = Sizzle.support = {};
  9520. /**
  9521. * Detects XML nodes
  9522. * @param {Element|Object} elem An element or a document
  9523. * @returns {Boolean} True iff elem is a non-HTML XML node
  9524. */
  9525. isXML = Sizzle.isXML = function( elem ) {
  9526. var namespace = elem.namespaceURI,
  9527. docElem = (elem.ownerDocument || elem).documentElement;
  9528. // Support: IE <=8
  9529. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9530. // https://bugs.jquery.com/ticket/4833
  9531. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9532. };
  9533. /**
  9534. * Sets document-related variables once based on the current document
  9535. * @param {Element|Object} [doc] An element or document object to use to set the document
  9536. * @returns {Object} Returns the current document
  9537. */
  9538. setDocument = Sizzle.setDocument = function( node ) {
  9539. var hasCompare, subWindow,
  9540. doc = node ? node.ownerDocument || node : preferredDoc;
  9541. // Return early if doc is invalid or already selected
  9542. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9543. return document;
  9544. }
  9545. // Update global variables
  9546. document = doc;
  9547. docElem = document.documentElement;
  9548. documentIsHTML = !isXML( document );
  9549. // Support: IE 9-11, Edge
  9550. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9551. if ( preferredDoc !== document &&
  9552. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9553. // Support: IE 11, Edge
  9554. if ( subWindow.addEventListener ) {
  9555. subWindow.addEventListener( "unload", unloadHandler, false );
  9556. // Support: IE 9 - 10 only
  9557. } else if ( subWindow.attachEvent ) {
  9558. subWindow.attachEvent( "onunload", unloadHandler );
  9559. }
  9560. }
  9561. /* Attributes
  9562. ---------------------------------------------------------------------- */
  9563. // Support: IE<8
  9564. // Verify that getAttribute really returns attributes and not properties
  9565. // (excepting IE8 booleans)
  9566. support.attributes = assert(function( el ) {
  9567. el.className = "i";
  9568. return !el.getAttribute("className");
  9569. });
  9570. /* getElement(s)By*
  9571. ---------------------------------------------------------------------- */
  9572. // Check if getElementsByTagName("*") returns only elements
  9573. support.getElementsByTagName = assert(function( el ) {
  9574. el.appendChild( document.createComment("") );
  9575. return !el.getElementsByTagName("*").length;
  9576. });
  9577. // Support: IE<9
  9578. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9579. // Support: IE<10
  9580. // Check if getElementById returns elements by name
  9581. // The broken getElementById methods don't pick up programmatically-set names,
  9582. // so use a roundabout getElementsByName test
  9583. support.getById = assert(function( el ) {
  9584. docElem.appendChild( el ).id = expando;
  9585. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9586. });
  9587. // ID filter and find
  9588. if ( support.getById ) {
  9589. Expr.filter["ID"] = function( id ) {
  9590. var attrId = id.replace( runescape, funescape );
  9591. return function( elem ) {
  9592. return elem.getAttribute("id") === attrId;
  9593. };
  9594. };
  9595. Expr.find["ID"] = function( id, context ) {
  9596. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9597. var elem = context.getElementById( id );
  9598. return elem ? [ elem ] : [];
  9599. }
  9600. };
  9601. } else {
  9602. Expr.filter["ID"] = function( id ) {
  9603. var attrId = id.replace( runescape, funescape );
  9604. return function( elem ) {
  9605. var node = typeof elem.getAttributeNode !== "undefined" &&
  9606. elem.getAttributeNode("id");
  9607. return node && node.value === attrId;
  9608. };
  9609. };
  9610. // Support: IE 6 - 7 only
  9611. // getElementById is not reliable as a find shortcut
  9612. Expr.find["ID"] = function( id, context ) {
  9613. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9614. var node, i, elems,
  9615. elem = context.getElementById( id );
  9616. if ( elem ) {
  9617. // Verify the id attribute
  9618. node = elem.getAttributeNode("id");
  9619. if ( node && node.value === id ) {
  9620. return [ elem ];
  9621. }
  9622. // Fall back on getElementsByName
  9623. elems = context.getElementsByName( id );
  9624. i = 0;
  9625. while ( (elem = elems[i++]) ) {
  9626. node = elem.getAttributeNode("id");
  9627. if ( node && node.value === id ) {
  9628. return [ elem ];
  9629. }
  9630. }
  9631. }
  9632. return [];
  9633. }
  9634. };
  9635. }
  9636. // Tag
  9637. Expr.find["TAG"] = support.getElementsByTagName ?
  9638. function( tag, context ) {
  9639. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9640. return context.getElementsByTagName( tag );
  9641. // DocumentFragment nodes don't have gEBTN
  9642. } else if ( support.qsa ) {
  9643. return context.querySelectorAll( tag );
  9644. }
  9645. } :
  9646. function( tag, context ) {
  9647. var elem,
  9648. tmp = [],
  9649. i = 0,
  9650. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9651. results = context.getElementsByTagName( tag );
  9652. // Filter out possible comments
  9653. if ( tag === "*" ) {
  9654. while ( (elem = results[i++]) ) {
  9655. if ( elem.nodeType === 1 ) {
  9656. tmp.push( elem );
  9657. }
  9658. }
  9659. return tmp;
  9660. }
  9661. return results;
  9662. };
  9663. // Class
  9664. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9665. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9666. return context.getElementsByClassName( className );
  9667. }
  9668. };
  9669. /* QSA/matchesSelector
  9670. ---------------------------------------------------------------------- */
  9671. // QSA and matchesSelector support
  9672. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9673. rbuggyMatches = [];
  9674. // qSa(:focus) reports false when true (Chrome 21)
  9675. // We allow this because of a bug in IE8/9 that throws an error
  9676. // whenever `document.activeElement` is accessed on an iframe
  9677. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9678. // See https://bugs.jquery.com/ticket/13378
  9679. rbuggyQSA = [];
  9680. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9681. // Build QSA regex
  9682. // Regex strategy adopted from Diego Perini
  9683. assert(function( el ) {
  9684. // Select is set to empty string on purpose
  9685. // This is to test IE's treatment of not explicitly
  9686. // setting a boolean content attribute,
  9687. // since its presence should be enough
  9688. // https://bugs.jquery.com/ticket/12359
  9689. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9690. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9691. "<option selected=''></option></select>";
  9692. // Support: IE8, Opera 11-12.16
  9693. // Nothing should be selected when empty strings follow ^= or $= or *=
  9694. // The test attribute must be unknown in Opera but "safe" for WinRT
  9695. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9696. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9697. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9698. }
  9699. // Support: IE8
  9700. // Boolean attributes and "value" are not treated correctly
  9701. if ( !el.querySelectorAll("[selected]").length ) {
  9702. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9703. }
  9704. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9705. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9706. rbuggyQSA.push("~=");
  9707. }
  9708. // Webkit/Opera - :checked should return selected option elements
  9709. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9710. // IE8 throws error here and will not see later tests
  9711. if ( !el.querySelectorAll(":checked").length ) {
  9712. rbuggyQSA.push(":checked");
  9713. }
  9714. // Support: Safari 8+, iOS 8+
  9715. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9716. // In-page `selector#id sibling-combinator selector` fails
  9717. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9718. rbuggyQSA.push(".#.+[+~]");
  9719. }
  9720. });
  9721. assert(function( el ) {
  9722. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9723. "<select disabled='disabled'><option/></select>";
  9724. // Support: Windows 8 Native Apps
  9725. // The type and name attributes are restricted during .innerHTML assignment
  9726. var input = document.createElement("input");
  9727. input.setAttribute( "type", "hidden" );
  9728. el.appendChild( input ).setAttribute( "name", "D" );
  9729. // Support: IE8
  9730. // Enforce case-sensitivity of name attribute
  9731. if ( el.querySelectorAll("[name=d]").length ) {
  9732. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9733. }
  9734. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9735. // IE8 throws error here and will not see later tests
  9736. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9737. rbuggyQSA.push( ":enabled", ":disabled" );
  9738. }
  9739. // Support: IE9-11+
  9740. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9741. docElem.appendChild( el ).disabled = true;
  9742. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9743. rbuggyQSA.push( ":enabled", ":disabled" );
  9744. }
  9745. // Opera 10-11 does not throw on post-comma invalid pseudos
  9746. el.querySelectorAll("*,:x");
  9747. rbuggyQSA.push(",.*:");
  9748. });
  9749. }
  9750. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9751. docElem.webkitMatchesSelector ||
  9752. docElem.mozMatchesSelector ||
  9753. docElem.oMatchesSelector ||
  9754. docElem.msMatchesSelector) )) ) {
  9755. assert(function( el ) {
  9756. // Check to see if it's possible to do matchesSelector
  9757. // on a disconnected node (IE 9)
  9758. support.disconnectedMatch = matches.call( el, "*" );
  9759. // This should fail with an exception
  9760. // Gecko does not error, returns false instead
  9761. matches.call( el, "[s!='']:x" );
  9762. rbuggyMatches.push( "!=", pseudos );
  9763. });
  9764. }
  9765. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9766. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9767. /* Contains
  9768. ---------------------------------------------------------------------- */
  9769. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9770. // Element contains another
  9771. // Purposefully self-exclusive
  9772. // As in, an element does not contain itself
  9773. contains = hasCompare || rnative.test( docElem.contains ) ?
  9774. function( a, b ) {
  9775. var adown = a.nodeType === 9 ? a.documentElement : a,
  9776. bup = b && b.parentNode;
  9777. return a === bup || !!( bup && bup.nodeType === 1 && (
  9778. adown.contains ?
  9779. adown.contains( bup ) :
  9780. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9781. ));
  9782. } :
  9783. function( a, b ) {
  9784. if ( b ) {
  9785. while ( (b = b.parentNode) ) {
  9786. if ( b === a ) {
  9787. return true;
  9788. }
  9789. }
  9790. }
  9791. return false;
  9792. };
  9793. /* Sorting
  9794. ---------------------------------------------------------------------- */
  9795. // Document order sorting
  9796. sortOrder = hasCompare ?
  9797. function( a, b ) {
  9798. // Flag for duplicate removal
  9799. if ( a === b ) {
  9800. hasDuplicate = true;
  9801. return 0;
  9802. }
  9803. // Sort on method existence if only one input has compareDocumentPosition
  9804. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9805. if ( compare ) {
  9806. return compare;
  9807. }
  9808. // Calculate position if both inputs belong to the same document
  9809. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9810. a.compareDocumentPosition( b ) :
  9811. // Otherwise we know they are disconnected
  9812. 1;
  9813. // Disconnected nodes
  9814. if ( compare & 1 ||
  9815. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9816. // Choose the first element that is related to our preferred document
  9817. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9818. return -1;
  9819. }
  9820. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9821. return 1;
  9822. }
  9823. // Maintain original order
  9824. return sortInput ?
  9825. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9826. 0;
  9827. }
  9828. return compare & 4 ? -1 : 1;
  9829. } :
  9830. function( a, b ) {
  9831. // Exit early if the nodes are identical
  9832. if ( a === b ) {
  9833. hasDuplicate = true;
  9834. return 0;
  9835. }
  9836. var cur,
  9837. i = 0,
  9838. aup = a.parentNode,
  9839. bup = b.parentNode,
  9840. ap = [ a ],
  9841. bp = [ b ];
  9842. // Parentless nodes are either documents or disconnected
  9843. if ( !aup || !bup ) {
  9844. return a === document ? -1 :
  9845. b === document ? 1 :
  9846. aup ? -1 :
  9847. bup ? 1 :
  9848. sortInput ?
  9849. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9850. 0;
  9851. // If the nodes are siblings, we can do a quick check
  9852. } else if ( aup === bup ) {
  9853. return siblingCheck( a, b );
  9854. }
  9855. // Otherwise we need full lists of their ancestors for comparison
  9856. cur = a;
  9857. while ( (cur = cur.parentNode) ) {
  9858. ap.unshift( cur );
  9859. }
  9860. cur = b;
  9861. while ( (cur = cur.parentNode) ) {
  9862. bp.unshift( cur );
  9863. }
  9864. // Walk down the tree looking for a discrepancy
  9865. while ( ap[i] === bp[i] ) {
  9866. i++;
  9867. }
  9868. return i ?
  9869. // Do a sibling check if the nodes have a common ancestor
  9870. siblingCheck( ap[i], bp[i] ) :
  9871. // Otherwise nodes in our document sort first
  9872. ap[i] === preferredDoc ? -1 :
  9873. bp[i] === preferredDoc ? 1 :
  9874. 0;
  9875. };
  9876. return document;
  9877. };
  9878. Sizzle.matches = function( expr, elements ) {
  9879. return Sizzle( expr, null, null, elements );
  9880. };
  9881. Sizzle.matchesSelector = function( elem, expr ) {
  9882. // Set document vars if needed
  9883. if ( ( elem.ownerDocument || elem ) !== document ) {
  9884. setDocument( elem );
  9885. }
  9886. if ( support.matchesSelector && documentIsHTML &&
  9887. !nonnativeSelectorCache[ expr + " " ] &&
  9888. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9889. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9890. try {
  9891. var ret = matches.call( elem, expr );
  9892. // IE 9's matchesSelector returns false on disconnected nodes
  9893. if ( ret || support.disconnectedMatch ||
  9894. // As well, disconnected nodes are said to be in a document
  9895. // fragment in IE 9
  9896. elem.document && elem.document.nodeType !== 11 ) {
  9897. return ret;
  9898. }
  9899. } catch (e) {
  9900. nonnativeSelectorCache( expr, true );
  9901. }
  9902. }
  9903. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9904. };
  9905. Sizzle.contains = function( context, elem ) {
  9906. // Set document vars if needed
  9907. if ( ( context.ownerDocument || context ) !== document ) {
  9908. setDocument( context );
  9909. }
  9910. return contains( context, elem );
  9911. };
  9912. Sizzle.attr = function( elem, name ) {
  9913. // Set document vars if needed
  9914. if ( ( elem.ownerDocument || elem ) !== document ) {
  9915. setDocument( elem );
  9916. }
  9917. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9918. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9919. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9920. fn( elem, name, !documentIsHTML ) :
  9921. undefined;
  9922. return val !== undefined ?
  9923. val :
  9924. support.attributes || !documentIsHTML ?
  9925. elem.getAttribute( name ) :
  9926. (val = elem.getAttributeNode(name)) && val.specified ?
  9927. val.value :
  9928. null;
  9929. };
  9930. Sizzle.escape = function( sel ) {
  9931. return (sel + "").replace( rcssescape, fcssescape );
  9932. };
  9933. Sizzle.error = function( msg ) {
  9934. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9935. };
  9936. /**
  9937. * Document sorting and removing duplicates
  9938. * @param {ArrayLike} results
  9939. */
  9940. Sizzle.uniqueSort = function( results ) {
  9941. var elem,
  9942. duplicates = [],
  9943. j = 0,
  9944. i = 0;
  9945. // Unless we *know* we can detect duplicates, assume their presence
  9946. hasDuplicate = !support.detectDuplicates;
  9947. sortInput = !support.sortStable && results.slice( 0 );
  9948. results.sort( sortOrder );
  9949. if ( hasDuplicate ) {
  9950. while ( (elem = results[i++]) ) {
  9951. if ( elem === results[ i ] ) {
  9952. j = duplicates.push( i );
  9953. }
  9954. }
  9955. while ( j-- ) {
  9956. results.splice( duplicates[ j ], 1 );
  9957. }
  9958. }
  9959. // Clear input after sorting to release objects
  9960. // See https://github.com/jquery/sizzle/pull/225
  9961. sortInput = null;
  9962. return results;
  9963. };
  9964. /**
  9965. * Utility function for retrieving the text value of an array of DOM nodes
  9966. * @param {Array|Element} elem
  9967. */
  9968. getText = Sizzle.getText = function( elem ) {
  9969. var node,
  9970. ret = "",
  9971. i = 0,
  9972. nodeType = elem.nodeType;
  9973. if ( !nodeType ) {
  9974. // If no nodeType, this is expected to be an array
  9975. while ( (node = elem[i++]) ) {
  9976. // Do not traverse comment nodes
  9977. ret += getText( node );
  9978. }
  9979. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9980. // Use textContent for elements
  9981. // innerText usage removed for consistency of new lines (jQuery #11153)
  9982. if ( typeof elem.textContent === "string" ) {
  9983. return elem.textContent;
  9984. } else {
  9985. // Traverse its children
  9986. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9987. ret += getText( elem );
  9988. }
  9989. }
  9990. } else if ( nodeType === 3 || nodeType === 4 ) {
  9991. return elem.nodeValue;
  9992. }
  9993. // Do not include comment or processing instruction nodes
  9994. return ret;
  9995. };
  9996. Expr = Sizzle.selectors = {
  9997. // Can be adjusted by the user
  9998. cacheLength: 50,
  9999. createPseudo: markFunction,
  10000. match: matchExpr,
  10001. attrHandle: {},
  10002. find: {},
  10003. relative: {
  10004. ">": { dir: "parentNode", first: true },
  10005. " ": { dir: "parentNode" },
  10006. "+": { dir: "previousSibling", first: true },
  10007. "~": { dir: "previousSibling" }
  10008. },
  10009. preFilter: {
  10010. "ATTR": function( match ) {
  10011. match[1] = match[1].replace( runescape, funescape );
  10012. // Move the given value to match[3] whether quoted or unquoted
  10013. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10014. if ( match[2] === "~=" ) {
  10015. match[3] = " " + match[3] + " ";
  10016. }
  10017. return match.slice( 0, 4 );
  10018. },
  10019. "CHILD": function( match ) {
  10020. /* matches from matchExpr["CHILD"]
  10021. 1 type (only|nth|...)
  10022. 2 what (child|of-type)
  10023. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10024. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10025. 5 sign of xn-component
  10026. 6 x of xn-component
  10027. 7 sign of y-component
  10028. 8 y of y-component
  10029. */
  10030. match[1] = match[1].toLowerCase();
  10031. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10032. // nth-* requires argument
  10033. if ( !match[3] ) {
  10034. Sizzle.error( match[0] );
  10035. }
  10036. // numeric x and y parameters for Expr.filter.CHILD
  10037. // remember that false/true cast respectively to 0/1
  10038. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10039. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10040. // other types prohibit arguments
  10041. } else if ( match[3] ) {
  10042. Sizzle.error( match[0] );
  10043. }
  10044. return match;
  10045. },
  10046. "PSEUDO": function( match ) {
  10047. var excess,
  10048. unquoted = !match[6] && match[2];
  10049. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10050. return null;
  10051. }
  10052. // Accept quoted arguments as-is
  10053. if ( match[3] ) {
  10054. match[2] = match[4] || match[5] || "";
  10055. // Strip excess characters from unquoted arguments
  10056. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10057. // Get excess from tokenize (recursively)
  10058. (excess = tokenize( unquoted, true )) &&
  10059. // advance to the next closing parenthesis
  10060. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10061. // excess is a negative index
  10062. match[0] = match[0].slice( 0, excess );
  10063. match[2] = unquoted.slice( 0, excess );
  10064. }
  10065. // Return only captures needed by the pseudo filter method (type and argument)
  10066. return match.slice( 0, 3 );
  10067. }
  10068. },
  10069. filter: {
  10070. "TAG": function( nodeNameSelector ) {
  10071. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10072. return nodeNameSelector === "*" ?
  10073. function() { return true; } :
  10074. function( elem ) {
  10075. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10076. };
  10077. },
  10078. "CLASS": function( className ) {
  10079. var pattern = classCache[ className + " " ];
  10080. return pattern ||
  10081. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10082. classCache( className, function( elem ) {
  10083. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10084. });
  10085. },
  10086. "ATTR": function( name, operator, check ) {
  10087. return function( elem ) {
  10088. var result = Sizzle.attr( elem, name );
  10089. if ( result == null ) {
  10090. return operator === "!=";
  10091. }
  10092. if ( !operator ) {
  10093. return true;
  10094. }
  10095. result += "";
  10096. return operator === "=" ? result === check :
  10097. operator === "!=" ? result !== check :
  10098. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10099. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10100. operator === "$=" ? check && result.slice( -check.length ) === check :
  10101. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10102. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10103. false;
  10104. };
  10105. },
  10106. "CHILD": function( type, what, argument, first, last ) {
  10107. var simple = type.slice( 0, 3 ) !== "nth",
  10108. forward = type.slice( -4 ) !== "last",
  10109. ofType = what === "of-type";
  10110. return first === 1 && last === 0 ?
  10111. // Shortcut for :nth-*(n)
  10112. function( elem ) {
  10113. return !!elem.parentNode;
  10114. } :
  10115. function( elem, context, xml ) {
  10116. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10117. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10118. parent = elem.parentNode,
  10119. name = ofType && elem.nodeName.toLowerCase(),
  10120. useCache = !xml && !ofType,
  10121. diff = false;
  10122. if ( parent ) {
  10123. // :(first|last|only)-(child|of-type)
  10124. if ( simple ) {
  10125. while ( dir ) {
  10126. node = elem;
  10127. while ( (node = node[ dir ]) ) {
  10128. if ( ofType ?
  10129. node.nodeName.toLowerCase() === name :
  10130. node.nodeType === 1 ) {
  10131. return false;
  10132. }
  10133. }
  10134. // Reverse direction for :only-* (if we haven't yet done so)
  10135. start = dir = type === "only" && !start && "nextSibling";
  10136. }
  10137. return true;
  10138. }
  10139. start = [ forward ? parent.firstChild : parent.lastChild ];
  10140. // non-xml :nth-child(...) stores cache data on `parent`
  10141. if ( forward && useCache ) {
  10142. // Seek `elem` from a previously-cached index
  10143. // ...in a gzip-friendly way
  10144. node = parent;
  10145. outerCache = node[ expando ] || (node[ expando ] = {});
  10146. // Support: IE <9 only
  10147. // Defend against cloned attroperties (jQuery gh-1709)
  10148. uniqueCache = outerCache[ node.uniqueID ] ||
  10149. (outerCache[ node.uniqueID ] = {});
  10150. cache = uniqueCache[ type ] || [];
  10151. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10152. diff = nodeIndex && cache[ 2 ];
  10153. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10154. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10155. // Fallback to seeking `elem` from the start
  10156. (diff = nodeIndex = 0) || start.pop()) ) {
  10157. // When found, cache indexes on `parent` and break
  10158. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10159. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10160. break;
  10161. }
  10162. }
  10163. } else {
  10164. // Use previously-cached element index if available
  10165. if ( useCache ) {
  10166. // ...in a gzip-friendly way
  10167. node = elem;
  10168. outerCache = node[ expando ] || (node[ expando ] = {});
  10169. // Support: IE <9 only
  10170. // Defend against cloned attroperties (jQuery gh-1709)
  10171. uniqueCache = outerCache[ node.uniqueID ] ||
  10172. (outerCache[ node.uniqueID ] = {});
  10173. cache = uniqueCache[ type ] || [];
  10174. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10175. diff = nodeIndex;
  10176. }
  10177. // xml :nth-child(...)
  10178. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10179. if ( diff === false ) {
  10180. // Use the same loop as above to seek `elem` from the start
  10181. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10182. (diff = nodeIndex = 0) || start.pop()) ) {
  10183. if ( ( ofType ?
  10184. node.nodeName.toLowerCase() === name :
  10185. node.nodeType === 1 ) &&
  10186. ++diff ) {
  10187. // Cache the index of each encountered element
  10188. if ( useCache ) {
  10189. outerCache = node[ expando ] || (node[ expando ] = {});
  10190. // Support: IE <9 only
  10191. // Defend against cloned attroperties (jQuery gh-1709)
  10192. uniqueCache = outerCache[ node.uniqueID ] ||
  10193. (outerCache[ node.uniqueID ] = {});
  10194. uniqueCache[ type ] = [ dirruns, diff ];
  10195. }
  10196. if ( node === elem ) {
  10197. break;
  10198. }
  10199. }
  10200. }
  10201. }
  10202. }
  10203. // Incorporate the offset, then check against cycle size
  10204. diff -= last;
  10205. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10206. }
  10207. };
  10208. },
  10209. "PSEUDO": function( pseudo, argument ) {
  10210. // pseudo-class names are case-insensitive
  10211. // http://www.w3.org/TR/selectors/#pseudo-classes
  10212. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10213. // Remember that setFilters inherits from pseudos
  10214. var args,
  10215. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10216. Sizzle.error( "unsupported pseudo: " + pseudo );
  10217. // The user may use createPseudo to indicate that
  10218. // arguments are needed to create the filter function
  10219. // just as Sizzle does
  10220. if ( fn[ expando ] ) {
  10221. return fn( argument );
  10222. }
  10223. // But maintain support for old signatures
  10224. if ( fn.length > 1 ) {
  10225. args = [ pseudo, pseudo, "", argument ];
  10226. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10227. markFunction(function( seed, matches ) {
  10228. var idx,
  10229. matched = fn( seed, argument ),
  10230. i = matched.length;
  10231. while ( i-- ) {
  10232. idx = indexOf( seed, matched[i] );
  10233. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10234. }
  10235. }) :
  10236. function( elem ) {
  10237. return fn( elem, 0, args );
  10238. };
  10239. }
  10240. return fn;
  10241. }
  10242. },
  10243. pseudos: {
  10244. // Potentially complex pseudos
  10245. "not": markFunction(function( selector ) {
  10246. // Trim the selector passed to compile
  10247. // to avoid treating leading and trailing
  10248. // spaces as combinators
  10249. var input = [],
  10250. results = [],
  10251. matcher = compile( selector.replace( rtrim, "$1" ) );
  10252. return matcher[ expando ] ?
  10253. markFunction(function( seed, matches, context, xml ) {
  10254. var elem,
  10255. unmatched = matcher( seed, null, xml, [] ),
  10256. i = seed.length;
  10257. // Match elements unmatched by `matcher`
  10258. while ( i-- ) {
  10259. if ( (elem = unmatched[i]) ) {
  10260. seed[i] = !(matches[i] = elem);
  10261. }
  10262. }
  10263. }) :
  10264. function( elem, context, xml ) {
  10265. input[0] = elem;
  10266. matcher( input, null, xml, results );
  10267. // Don't keep the element (issue #299)
  10268. input[0] = null;
  10269. return !results.pop();
  10270. };
  10271. }),
  10272. "has": markFunction(function( selector ) {
  10273. return function( elem ) {
  10274. return Sizzle( selector, elem ).length > 0;
  10275. };
  10276. }),
  10277. "contains": markFunction(function( text ) {
  10278. text = text.replace( runescape, funescape );
  10279. return function( elem ) {
  10280. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10281. };
  10282. }),
  10283. // "Whether an element is represented by a :lang() selector
  10284. // is based solely on the element's language value
  10285. // being equal to the identifier C,
  10286. // or beginning with the identifier C immediately followed by "-".
  10287. // The matching of C against the element's language value is performed case-insensitively.
  10288. // The identifier C does not have to be a valid language name."
  10289. // http://www.w3.org/TR/selectors/#lang-pseudo
  10290. "lang": markFunction( function( lang ) {
  10291. // lang value must be a valid identifier
  10292. if ( !ridentifier.test(lang || "") ) {
  10293. Sizzle.error( "unsupported lang: " + lang );
  10294. }
  10295. lang = lang.replace( runescape, funescape ).toLowerCase();
  10296. return function( elem ) {
  10297. var elemLang;
  10298. do {
  10299. if ( (elemLang = documentIsHTML ?
  10300. elem.lang :
  10301. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10302. elemLang = elemLang.toLowerCase();
  10303. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10304. }
  10305. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10306. return false;
  10307. };
  10308. }),
  10309. // Miscellaneous
  10310. "target": function( elem ) {
  10311. var hash = window.location && window.location.hash;
  10312. return hash && hash.slice( 1 ) === elem.id;
  10313. },
  10314. "root": function( elem ) {
  10315. return elem === docElem;
  10316. },
  10317. "focus": function( elem ) {
  10318. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10319. },
  10320. // Boolean properties
  10321. "enabled": createDisabledPseudo( false ),
  10322. "disabled": createDisabledPseudo( true ),
  10323. "checked": function( elem ) {
  10324. // In CSS3, :checked should return both checked and selected elements
  10325. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10326. var nodeName = elem.nodeName.toLowerCase();
  10327. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10328. },
  10329. "selected": function( elem ) {
  10330. // Accessing this property makes selected-by-default
  10331. // options in Safari work properly
  10332. if ( elem.parentNode ) {
  10333. elem.parentNode.selectedIndex;
  10334. }
  10335. return elem.selected === true;
  10336. },
  10337. // Contents
  10338. "empty": function( elem ) {
  10339. // http://www.w3.org/TR/selectors/#empty-pseudo
  10340. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10341. // but not by others (comment: 8; processing instruction: 7; etc.)
  10342. // nodeType < 6 works because attributes (2) do not appear as children
  10343. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10344. if ( elem.nodeType < 6 ) {
  10345. return false;
  10346. }
  10347. }
  10348. return true;
  10349. },
  10350. "parent": function( elem ) {
  10351. return !Expr.pseudos["empty"]( elem );
  10352. },
  10353. // Element/input types
  10354. "header": function( elem ) {
  10355. return rheader.test( elem.nodeName );
  10356. },
  10357. "input": function( elem ) {
  10358. return rinputs.test( elem.nodeName );
  10359. },
  10360. "button": function( elem ) {
  10361. var name = elem.nodeName.toLowerCase();
  10362. return name === "input" && elem.type === "button" || name === "button";
  10363. },
  10364. "text": function( elem ) {
  10365. var attr;
  10366. return elem.nodeName.toLowerCase() === "input" &&
  10367. elem.type === "text" &&
  10368. // Support: IE<8
  10369. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10370. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10371. },
  10372. // Position-in-collection
  10373. "first": createPositionalPseudo(function() {
  10374. return [ 0 ];
  10375. }),
  10376. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10377. return [ length - 1 ];
  10378. }),
  10379. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10380. return [ argument < 0 ? argument + length : argument ];
  10381. }),
  10382. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10383. var i = 0;
  10384. for ( ; i < length; i += 2 ) {
  10385. matchIndexes.push( i );
  10386. }
  10387. return matchIndexes;
  10388. }),
  10389. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10390. var i = 1;
  10391. for ( ; i < length; i += 2 ) {
  10392. matchIndexes.push( i );
  10393. }
  10394. return matchIndexes;
  10395. }),
  10396. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10397. var i = argument < 0 ?
  10398. argument + length :
  10399. argument > length ?
  10400. length :
  10401. argument;
  10402. for ( ; --i >= 0; ) {
  10403. matchIndexes.push( i );
  10404. }
  10405. return matchIndexes;
  10406. }),
  10407. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10408. var i = argument < 0 ? argument + length : argument;
  10409. for ( ; ++i < length; ) {
  10410. matchIndexes.push( i );
  10411. }
  10412. return matchIndexes;
  10413. })
  10414. }
  10415. };
  10416. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10417. // Add button/input type pseudos
  10418. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10419. Expr.pseudos[ i ] = createInputPseudo( i );
  10420. }
  10421. for ( i in { submit: true, reset: true } ) {
  10422. Expr.pseudos[ i ] = createButtonPseudo( i );
  10423. }
  10424. // Easy API for creating new setFilters
  10425. function setFilters() {}
  10426. setFilters.prototype = Expr.filters = Expr.pseudos;
  10427. Expr.setFilters = new setFilters();
  10428. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10429. var matched, match, tokens, type,
  10430. soFar, groups, preFilters,
  10431. cached = tokenCache[ selector + " " ];
  10432. if ( cached ) {
  10433. return parseOnly ? 0 : cached.slice( 0 );
  10434. }
  10435. soFar = selector;
  10436. groups = [];
  10437. preFilters = Expr.preFilter;
  10438. while ( soFar ) {
  10439. // Comma and first run
  10440. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10441. if ( match ) {
  10442. // Don't consume trailing commas as valid
  10443. soFar = soFar.slice( match[0].length ) || soFar;
  10444. }
  10445. groups.push( (tokens = []) );
  10446. }
  10447. matched = false;
  10448. // Combinators
  10449. if ( (match = rcombinators.exec( soFar )) ) {
  10450. matched = match.shift();
  10451. tokens.push({
  10452. value: matched,
  10453. // Cast descendant combinators to space
  10454. type: match[0].replace( rtrim, " " )
  10455. });
  10456. soFar = soFar.slice( matched.length );
  10457. }
  10458. // Filters
  10459. for ( type in Expr.filter ) {
  10460. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10461. (match = preFilters[ type ]( match ))) ) {
  10462. matched = match.shift();
  10463. tokens.push({
  10464. value: matched,
  10465. type: type,
  10466. matches: match
  10467. });
  10468. soFar = soFar.slice( matched.length );
  10469. }
  10470. }
  10471. if ( !matched ) {
  10472. break;
  10473. }
  10474. }
  10475. // Return the length of the invalid excess
  10476. // if we're just parsing
  10477. // Otherwise, throw an error or return tokens
  10478. return parseOnly ?
  10479. soFar.length :
  10480. soFar ?
  10481. Sizzle.error( selector ) :
  10482. // Cache the tokens
  10483. tokenCache( selector, groups ).slice( 0 );
  10484. };
  10485. function toSelector( tokens ) {
  10486. var i = 0,
  10487. len = tokens.length,
  10488. selector = "";
  10489. for ( ; i < len; i++ ) {
  10490. selector += tokens[i].value;
  10491. }
  10492. return selector;
  10493. }
  10494. function addCombinator( matcher, combinator, base ) {
  10495. var dir = combinator.dir,
  10496. skip = combinator.next,
  10497. key = skip || dir,
  10498. checkNonElements = base && key === "parentNode",
  10499. doneName = done++;
  10500. return combinator.first ?
  10501. // Check against closest ancestor/preceding element
  10502. function( elem, context, xml ) {
  10503. while ( (elem = elem[ dir ]) ) {
  10504. if ( elem.nodeType === 1 || checkNonElements ) {
  10505. return matcher( elem, context, xml );
  10506. }
  10507. }
  10508. return false;
  10509. } :
  10510. // Check against all ancestor/preceding elements
  10511. function( elem, context, xml ) {
  10512. var oldCache, uniqueCache, outerCache,
  10513. newCache = [ dirruns, doneName ];
  10514. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10515. if ( xml ) {
  10516. while ( (elem = elem[ dir ]) ) {
  10517. if ( elem.nodeType === 1 || checkNonElements ) {
  10518. if ( matcher( elem, context, xml ) ) {
  10519. return true;
  10520. }
  10521. }
  10522. }
  10523. } else {
  10524. while ( (elem = elem[ dir ]) ) {
  10525. if ( elem.nodeType === 1 || checkNonElements ) {
  10526. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10527. // Support: IE <9 only
  10528. // Defend against cloned attroperties (jQuery gh-1709)
  10529. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10530. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10531. elem = elem[ dir ] || elem;
  10532. } else if ( (oldCache = uniqueCache[ key ]) &&
  10533. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10534. // Assign to newCache so results back-propagate to previous elements
  10535. return (newCache[ 2 ] = oldCache[ 2 ]);
  10536. } else {
  10537. // Reuse newcache so results back-propagate to previous elements
  10538. uniqueCache[ key ] = newCache;
  10539. // A match means we're done; a fail means we have to keep checking
  10540. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10541. return true;
  10542. }
  10543. }
  10544. }
  10545. }
  10546. }
  10547. return false;
  10548. };
  10549. }
  10550. function elementMatcher( matchers ) {
  10551. return matchers.length > 1 ?
  10552. function( elem, context, xml ) {
  10553. var i = matchers.length;
  10554. while ( i-- ) {
  10555. if ( !matchers[i]( elem, context, xml ) ) {
  10556. return false;
  10557. }
  10558. }
  10559. return true;
  10560. } :
  10561. matchers[0];
  10562. }
  10563. function multipleContexts( selector, contexts, results ) {
  10564. var i = 0,
  10565. len = contexts.length;
  10566. for ( ; i < len; i++ ) {
  10567. Sizzle( selector, contexts[i], results );
  10568. }
  10569. return results;
  10570. }
  10571. function condense( unmatched, map, filter, context, xml ) {
  10572. var elem,
  10573. newUnmatched = [],
  10574. i = 0,
  10575. len = unmatched.length,
  10576. mapped = map != null;
  10577. for ( ; i < len; i++ ) {
  10578. if ( (elem = unmatched[i]) ) {
  10579. if ( !filter || filter( elem, context, xml ) ) {
  10580. newUnmatched.push( elem );
  10581. if ( mapped ) {
  10582. map.push( i );
  10583. }
  10584. }
  10585. }
  10586. }
  10587. return newUnmatched;
  10588. }
  10589. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10590. if ( postFilter && !postFilter[ expando ] ) {
  10591. postFilter = setMatcher( postFilter );
  10592. }
  10593. if ( postFinder && !postFinder[ expando ] ) {
  10594. postFinder = setMatcher( postFinder, postSelector );
  10595. }
  10596. return markFunction(function( seed, results, context, xml ) {
  10597. var temp, i, elem,
  10598. preMap = [],
  10599. postMap = [],
  10600. preexisting = results.length,
  10601. // Get initial elements from seed or context
  10602. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10603. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10604. matcherIn = preFilter && ( seed || !selector ) ?
  10605. condense( elems, preMap, preFilter, context, xml ) :
  10606. elems,
  10607. matcherOut = matcher ?
  10608. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10609. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10610. // ...intermediate processing is necessary
  10611. [] :
  10612. // ...otherwise use results directly
  10613. results :
  10614. matcherIn;
  10615. // Find primary matches
  10616. if ( matcher ) {
  10617. matcher( matcherIn, matcherOut, context, xml );
  10618. }
  10619. // Apply postFilter
  10620. if ( postFilter ) {
  10621. temp = condense( matcherOut, postMap );
  10622. postFilter( temp, [], context, xml );
  10623. // Un-match failing elements by moving them back to matcherIn
  10624. i = temp.length;
  10625. while ( i-- ) {
  10626. if ( (elem = temp[i]) ) {
  10627. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10628. }
  10629. }
  10630. }
  10631. if ( seed ) {
  10632. if ( postFinder || preFilter ) {
  10633. if ( postFinder ) {
  10634. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10635. temp = [];
  10636. i = matcherOut.length;
  10637. while ( i-- ) {
  10638. if ( (elem = matcherOut[i]) ) {
  10639. // Restore matcherIn since elem is not yet a final match
  10640. temp.push( (matcherIn[i] = elem) );
  10641. }
  10642. }
  10643. postFinder( null, (matcherOut = []), temp, xml );
  10644. }
  10645. // Move matched elements from seed to results to keep them synchronized
  10646. i = matcherOut.length;
  10647. while ( i-- ) {
  10648. if ( (elem = matcherOut[i]) &&
  10649. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10650. seed[temp] = !(results[temp] = elem);
  10651. }
  10652. }
  10653. }
  10654. // Add elements to results, through postFinder if defined
  10655. } else {
  10656. matcherOut = condense(
  10657. matcherOut === results ?
  10658. matcherOut.splice( preexisting, matcherOut.length ) :
  10659. matcherOut
  10660. );
  10661. if ( postFinder ) {
  10662. postFinder( null, results, matcherOut, xml );
  10663. } else {
  10664. push.apply( results, matcherOut );
  10665. }
  10666. }
  10667. });
  10668. }
  10669. function matcherFromTokens( tokens ) {
  10670. var checkContext, matcher, j,
  10671. len = tokens.length,
  10672. leadingRelative = Expr.relative[ tokens[0].type ],
  10673. implicitRelative = leadingRelative || Expr.relative[" "],
  10674. i = leadingRelative ? 1 : 0,
  10675. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10676. matchContext = addCombinator( function( elem ) {
  10677. return elem === checkContext;
  10678. }, implicitRelative, true ),
  10679. matchAnyContext = addCombinator( function( elem ) {
  10680. return indexOf( checkContext, elem ) > -1;
  10681. }, implicitRelative, true ),
  10682. matchers = [ function( elem, context, xml ) {
  10683. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10684. (checkContext = context).nodeType ?
  10685. matchContext( elem, context, xml ) :
  10686. matchAnyContext( elem, context, xml ) );
  10687. // Avoid hanging onto element (issue #299)
  10688. checkContext = null;
  10689. return ret;
  10690. } ];
  10691. for ( ; i < len; i++ ) {
  10692. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10693. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10694. } else {
  10695. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10696. // Return special upon seeing a positional matcher
  10697. if ( matcher[ expando ] ) {
  10698. // Find the next relative operator (if any) for proper handling
  10699. j = ++i;
  10700. for ( ; j < len; j++ ) {
  10701. if ( Expr.relative[ tokens[j].type ] ) {
  10702. break;
  10703. }
  10704. }
  10705. return setMatcher(
  10706. i > 1 && elementMatcher( matchers ),
  10707. i > 1 && toSelector(
  10708. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10709. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10710. ).replace( rtrim, "$1" ),
  10711. matcher,
  10712. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10713. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10714. j < len && toSelector( tokens )
  10715. );
  10716. }
  10717. matchers.push( matcher );
  10718. }
  10719. }
  10720. return elementMatcher( matchers );
  10721. }
  10722. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10723. var bySet = setMatchers.length > 0,
  10724. byElement = elementMatchers.length > 0,
  10725. superMatcher = function( seed, context, xml, results, outermost ) {
  10726. var elem, j, matcher,
  10727. matchedCount = 0,
  10728. i = "0",
  10729. unmatched = seed && [],
  10730. setMatched = [],
  10731. contextBackup = outermostContext,
  10732. // We must always have either seed elements or outermost context
  10733. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10734. // Use integer dirruns iff this is the outermost matcher
  10735. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10736. len = elems.length;
  10737. if ( outermost ) {
  10738. outermostContext = context === document || context || outermost;
  10739. }
  10740. // Add elements passing elementMatchers directly to results
  10741. // Support: IE<9, Safari
  10742. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10743. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10744. if ( byElement && elem ) {
  10745. j = 0;
  10746. if ( !context && elem.ownerDocument !== document ) {
  10747. setDocument( elem );
  10748. xml = !documentIsHTML;
  10749. }
  10750. while ( (matcher = elementMatchers[j++]) ) {
  10751. if ( matcher( elem, context || document, xml) ) {
  10752. results.push( elem );
  10753. break;
  10754. }
  10755. }
  10756. if ( outermost ) {
  10757. dirruns = dirrunsUnique;
  10758. }
  10759. }
  10760. // Track unmatched elements for set filters
  10761. if ( bySet ) {
  10762. // They will have gone through all possible matchers
  10763. if ( (elem = !matcher && elem) ) {
  10764. matchedCount--;
  10765. }
  10766. // Lengthen the array for every element, matched or not
  10767. if ( seed ) {
  10768. unmatched.push( elem );
  10769. }
  10770. }
  10771. }
  10772. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10773. // makes the latter nonnegative.
  10774. matchedCount += i;
  10775. // Apply set filters to unmatched elements
  10776. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10777. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10778. // no element matchers and no seed.
  10779. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10780. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10781. // numerically zero.
  10782. if ( bySet && i !== matchedCount ) {
  10783. j = 0;
  10784. while ( (matcher = setMatchers[j++]) ) {
  10785. matcher( unmatched, setMatched, context, xml );
  10786. }
  10787. if ( seed ) {
  10788. // Reintegrate element matches to eliminate the need for sorting
  10789. if ( matchedCount > 0 ) {
  10790. while ( i-- ) {
  10791. if ( !(unmatched[i] || setMatched[i]) ) {
  10792. setMatched[i] = pop.call( results );
  10793. }
  10794. }
  10795. }
  10796. // Discard index placeholder values to get only actual matches
  10797. setMatched = condense( setMatched );
  10798. }
  10799. // Add matches to results
  10800. push.apply( results, setMatched );
  10801. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10802. if ( outermost && !seed && setMatched.length > 0 &&
  10803. ( matchedCount + setMatchers.length ) > 1 ) {
  10804. Sizzle.uniqueSort( results );
  10805. }
  10806. }
  10807. // Override manipulation of globals by nested matchers
  10808. if ( outermost ) {
  10809. dirruns = dirrunsUnique;
  10810. outermostContext = contextBackup;
  10811. }
  10812. return unmatched;
  10813. };
  10814. return bySet ?
  10815. markFunction( superMatcher ) :
  10816. superMatcher;
  10817. }
  10818. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10819. var i,
  10820. setMatchers = [],
  10821. elementMatchers = [],
  10822. cached = compilerCache[ selector + " " ];
  10823. if ( !cached ) {
  10824. // Generate a function of recursive functions that can be used to check each element
  10825. if ( !match ) {
  10826. match = tokenize( selector );
  10827. }
  10828. i = match.length;
  10829. while ( i-- ) {
  10830. cached = matcherFromTokens( match[i] );
  10831. if ( cached[ expando ] ) {
  10832. setMatchers.push( cached );
  10833. } else {
  10834. elementMatchers.push( cached );
  10835. }
  10836. }
  10837. // Cache the compiled function
  10838. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10839. // Save selector and tokenization
  10840. cached.selector = selector;
  10841. }
  10842. return cached;
  10843. };
  10844. /**
  10845. * A low-level selection function that works with Sizzle's compiled
  10846. * selector functions
  10847. * @param {String|Function} selector A selector or a pre-compiled
  10848. * selector function built with Sizzle.compile
  10849. * @param {Element} context
  10850. * @param {Array} [results]
  10851. * @param {Array} [seed] A set of elements to match against
  10852. */
  10853. select = Sizzle.select = function( selector, context, results, seed ) {
  10854. var i, tokens, token, type, find,
  10855. compiled = typeof selector === "function" && selector,
  10856. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10857. results = results || [];
  10858. // Try to minimize operations if there is only one selector in the list and no seed
  10859. // (the latter of which guarantees us context)
  10860. if ( match.length === 1 ) {
  10861. // Reduce context if the leading compound selector is an ID
  10862. tokens = match[0] = match[0].slice( 0 );
  10863. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10864. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10865. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10866. if ( !context ) {
  10867. return results;
  10868. // Precompiled matchers will still verify ancestry, so step up a level
  10869. } else if ( compiled ) {
  10870. context = context.parentNode;
  10871. }
  10872. selector = selector.slice( tokens.shift().value.length );
  10873. }
  10874. // Fetch a seed set for right-to-left matching
  10875. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10876. while ( i-- ) {
  10877. token = tokens[i];
  10878. // Abort if we hit a combinator
  10879. if ( Expr.relative[ (type = token.type) ] ) {
  10880. break;
  10881. }
  10882. if ( (find = Expr.find[ type ]) ) {
  10883. // Search, expanding context for leading sibling combinators
  10884. if ( (seed = find(
  10885. token.matches[0].replace( runescape, funescape ),
  10886. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10887. )) ) {
  10888. // If seed is empty or no tokens remain, we can return early
  10889. tokens.splice( i, 1 );
  10890. selector = seed.length && toSelector( tokens );
  10891. if ( !selector ) {
  10892. push.apply( results, seed );
  10893. return results;
  10894. }
  10895. break;
  10896. }
  10897. }
  10898. }
  10899. }
  10900. // Compile and execute a filtering function if one is not provided
  10901. // Provide `match` to avoid retokenization if we modified the selector above
  10902. ( compiled || compile( selector, match ) )(
  10903. seed,
  10904. context,
  10905. !documentIsHTML,
  10906. results,
  10907. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10908. );
  10909. return results;
  10910. };
  10911. // One-time assignments
  10912. // Sort stability
  10913. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10914. // Support: Chrome 14-35+
  10915. // Always assume duplicates if they aren't passed to the comparison function
  10916. support.detectDuplicates = !!hasDuplicate;
  10917. // Initialize against the default document
  10918. setDocument();
  10919. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10920. // Detached nodes confoundingly follow *each other*
  10921. support.sortDetached = assert(function( el ) {
  10922. // Should return 1, but returns 4 (following)
  10923. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10924. });
  10925. // Support: IE<8
  10926. // Prevent attribute/property "interpolation"
  10927. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10928. if ( !assert(function( el ) {
  10929. el.innerHTML = "<a href='#'></a>";
  10930. return el.firstChild.getAttribute("href") === "#" ;
  10931. }) ) {
  10932. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10933. if ( !isXML ) {
  10934. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10935. }
  10936. });
  10937. }
  10938. // Support: IE<9
  10939. // Use defaultValue in place of getAttribute("value")
  10940. if ( !support.attributes || !assert(function( el ) {
  10941. el.innerHTML = "<input/>";
  10942. el.firstChild.setAttribute( "value", "" );
  10943. return el.firstChild.getAttribute( "value" ) === "";
  10944. }) ) {
  10945. addHandle( "value", function( elem, name, isXML ) {
  10946. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10947. return elem.defaultValue;
  10948. }
  10949. });
  10950. }
  10951. // Support: IE<9
  10952. // Use getAttributeNode to fetch booleans when getAttribute lies
  10953. if ( !assert(function( el ) {
  10954. return el.getAttribute("disabled") == null;
  10955. }) ) {
  10956. addHandle( booleans, function( elem, name, isXML ) {
  10957. var val;
  10958. if ( !isXML ) {
  10959. return elem[ name ] === true ? name.toLowerCase() :
  10960. (val = elem.getAttributeNode( name )) && val.specified ?
  10961. val.value :
  10962. null;
  10963. }
  10964. });
  10965. }
  10966. return Sizzle;
  10967. })( window );
  10968. jQuery.find = Sizzle;
  10969. jQuery.expr = Sizzle.selectors;
  10970. // Deprecated
  10971. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10972. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10973. jQuery.text = Sizzle.getText;
  10974. jQuery.isXMLDoc = Sizzle.isXML;
  10975. jQuery.contains = Sizzle.contains;
  10976. jQuery.escapeSelector = Sizzle.escape;
  10977. var dir = function( elem, dir, until ) {
  10978. var matched = [],
  10979. truncate = until !== undefined;
  10980. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10981. if ( elem.nodeType === 1 ) {
  10982. if ( truncate && jQuery( elem ).is( until ) ) {
  10983. break;
  10984. }
  10985. matched.push( elem );
  10986. }
  10987. }
  10988. return matched;
  10989. };
  10990. var siblings = function( n, elem ) {
  10991. var matched = [];
  10992. for ( ; n; n = n.nextSibling ) {
  10993. if ( n.nodeType === 1 && n !== elem ) {
  10994. matched.push( n );
  10995. }
  10996. }
  10997. return matched;
  10998. };
  10999. var rneedsContext = jQuery.expr.match.needsContext;
  11000. function nodeName( elem, name ) {
  11001. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11002. };
  11003. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11004. // Implement the identical functionality for filter and not
  11005. function winnow( elements, qualifier, not ) {
  11006. if ( isFunction( qualifier ) ) {
  11007. return jQuery.grep( elements, function( elem, i ) {
  11008. return !!qualifier.call( elem, i, elem ) !== not;
  11009. } );
  11010. }
  11011. // Single element
  11012. if ( qualifier.nodeType ) {
  11013. return jQuery.grep( elements, function( elem ) {
  11014. return ( elem === qualifier ) !== not;
  11015. } );
  11016. }
  11017. // Arraylike of elements (jQuery, arguments, Array)
  11018. if ( typeof qualifier !== "string" ) {
  11019. return jQuery.grep( elements, function( elem ) {
  11020. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11021. } );
  11022. }
  11023. // Filtered directly for both simple and complex selectors
  11024. return jQuery.filter( qualifier, elements, not );
  11025. }
  11026. jQuery.filter = function( expr, elems, not ) {
  11027. var elem = elems[ 0 ];
  11028. if ( not ) {
  11029. expr = ":not(" + expr + ")";
  11030. }
  11031. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11032. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11033. }
  11034. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11035. return elem.nodeType === 1;
  11036. } ) );
  11037. };
  11038. jQuery.fn.extend( {
  11039. find: function( selector ) {
  11040. var i, ret,
  11041. len = this.length,
  11042. self = this;
  11043. if ( typeof selector !== "string" ) {
  11044. return this.pushStack( jQuery( selector ).filter( function() {
  11045. for ( i = 0; i < len; i++ ) {
  11046. if ( jQuery.contains( self[ i ], this ) ) {
  11047. return true;
  11048. }
  11049. }
  11050. } ) );
  11051. }
  11052. ret = this.pushStack( [] );
  11053. for ( i = 0; i < len; i++ ) {
  11054. jQuery.find( selector, self[ i ], ret );
  11055. }
  11056. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11057. },
  11058. filter: function( selector ) {
  11059. return this.pushStack( winnow( this, selector || [], false ) );
  11060. },
  11061. not: function( selector ) {
  11062. return this.pushStack( winnow( this, selector || [], true ) );
  11063. },
  11064. is: function( selector ) {
  11065. return !!winnow(
  11066. this,
  11067. // If this is a positional/relative selector, check membership in the returned set
  11068. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11069. typeof selector === "string" && rneedsContext.test( selector ) ?
  11070. jQuery( selector ) :
  11071. selector || [],
  11072. false
  11073. ).length;
  11074. }
  11075. } );
  11076. // Initialize a jQuery object
  11077. // A central reference to the root jQuery(document)
  11078. var rootjQuery,
  11079. // A simple way to check for HTML strings
  11080. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11081. // Strict HTML recognition (#11290: must start with <)
  11082. // Shortcut simple #id case for speed
  11083. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11084. init = jQuery.fn.init = function( selector, context, root ) {
  11085. var match, elem;
  11086. // HANDLE: $(""), $(null), $(undefined), $(false)
  11087. if ( !selector ) {
  11088. return this;
  11089. }
  11090. // Method init() accepts an alternate rootjQuery
  11091. // so migrate can support jQuery.sub (gh-2101)
  11092. root = root || rootjQuery;
  11093. // Handle HTML strings
  11094. if ( typeof selector === "string" ) {
  11095. if ( selector[ 0 ] === "<" &&
  11096. selector[ selector.length - 1 ] === ">" &&
  11097. selector.length >= 3 ) {
  11098. // Assume that strings that start and end with <> are HTML and skip the regex check
  11099. match = [ null, selector, null ];
  11100. } else {
  11101. match = rquickExpr.exec( selector );
  11102. }
  11103. // Match html or make sure no context is specified for #id
  11104. if ( match && ( match[ 1 ] || !context ) ) {
  11105. // HANDLE: $(html) -> $(array)
  11106. if ( match[ 1 ] ) {
  11107. context = context instanceof jQuery ? context[ 0 ] : context;
  11108. // Option to run scripts is true for back-compat
  11109. // Intentionally let the error be thrown if parseHTML is not present
  11110. jQuery.merge( this, jQuery.parseHTML(
  11111. match[ 1 ],
  11112. context && context.nodeType ? context.ownerDocument || context : document,
  11113. true
  11114. ) );
  11115. // HANDLE: $(html, props)
  11116. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11117. for ( match in context ) {
  11118. // Properties of context are called as methods if possible
  11119. if ( isFunction( this[ match ] ) ) {
  11120. this[ match ]( context[ match ] );
  11121. // ...and otherwise set as attributes
  11122. } else {
  11123. this.attr( match, context[ match ] );
  11124. }
  11125. }
  11126. }
  11127. return this;
  11128. // HANDLE: $(#id)
  11129. } else {
  11130. elem = document.getElementById( match[ 2 ] );
  11131. if ( elem ) {
  11132. // Inject the element directly into the jQuery object
  11133. this[ 0 ] = elem;
  11134. this.length = 1;
  11135. }
  11136. return this;
  11137. }
  11138. // HANDLE: $(expr, $(...))
  11139. } else if ( !context || context.jquery ) {
  11140. return ( context || root ).find( selector );
  11141. // HANDLE: $(expr, context)
  11142. // (which is just equivalent to: $(context).find(expr)
  11143. } else {
  11144. return this.constructor( context ).find( selector );
  11145. }
  11146. // HANDLE: $(DOMElement)
  11147. } else if ( selector.nodeType ) {
  11148. this[ 0 ] = selector;
  11149. this.length = 1;
  11150. return this;
  11151. // HANDLE: $(function)
  11152. // Shortcut for document ready
  11153. } else if ( isFunction( selector ) ) {
  11154. return root.ready !== undefined ?
  11155. root.ready( selector ) :
  11156. // Execute immediately if ready is not present
  11157. selector( jQuery );
  11158. }
  11159. return jQuery.makeArray( selector, this );
  11160. };
  11161. // Give the init function the jQuery prototype for later instantiation
  11162. init.prototype = jQuery.fn;
  11163. // Initialize central reference
  11164. rootjQuery = jQuery( document );
  11165. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11166. // Methods guaranteed to produce a unique set when starting from a unique set
  11167. guaranteedUnique = {
  11168. children: true,
  11169. contents: true,
  11170. next: true,
  11171. prev: true
  11172. };
  11173. jQuery.fn.extend( {
  11174. has: function( target ) {
  11175. var targets = jQuery( target, this ),
  11176. l = targets.length;
  11177. return this.filter( function() {
  11178. var i = 0;
  11179. for ( ; i < l; i++ ) {
  11180. if ( jQuery.contains( this, targets[ i ] ) ) {
  11181. return true;
  11182. }
  11183. }
  11184. } );
  11185. },
  11186. closest: function( selectors, context ) {
  11187. var cur,
  11188. i = 0,
  11189. l = this.length,
  11190. matched = [],
  11191. targets = typeof selectors !== "string" && jQuery( selectors );
  11192. // Positional selectors never match, since there's no _selection_ context
  11193. if ( !rneedsContext.test( selectors ) ) {
  11194. for ( ; i < l; i++ ) {
  11195. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11196. // Always skip document fragments
  11197. if ( cur.nodeType < 11 && ( targets ?
  11198. targets.index( cur ) > -1 :
  11199. // Don't pass non-elements to Sizzle
  11200. cur.nodeType === 1 &&
  11201. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11202. matched.push( cur );
  11203. break;
  11204. }
  11205. }
  11206. }
  11207. }
  11208. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11209. },
  11210. // Determine the position of an element within the set
  11211. index: function( elem ) {
  11212. // No argument, return index in parent
  11213. if ( !elem ) {
  11214. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11215. }
  11216. // Index in selector
  11217. if ( typeof elem === "string" ) {
  11218. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11219. }
  11220. // Locate the position of the desired element
  11221. return indexOf.call( this,
  11222. // If it receives a jQuery object, the first element is used
  11223. elem.jquery ? elem[ 0 ] : elem
  11224. );
  11225. },
  11226. add: function( selector, context ) {
  11227. return this.pushStack(
  11228. jQuery.uniqueSort(
  11229. jQuery.merge( this.get(), jQuery( selector, context ) )
  11230. )
  11231. );
  11232. },
  11233. addBack: function( selector ) {
  11234. return this.add( selector == null ?
  11235. this.prevObject : this.prevObject.filter( selector )
  11236. );
  11237. }
  11238. } );
  11239. function sibling( cur, dir ) {
  11240. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11241. return cur;
  11242. }
  11243. jQuery.each( {
  11244. parent: function( elem ) {
  11245. var parent = elem.parentNode;
  11246. return parent && parent.nodeType !== 11 ? parent : null;
  11247. },
  11248. parents: function( elem ) {
  11249. return dir( elem, "parentNode" );
  11250. },
  11251. parentsUntil: function( elem, i, until ) {
  11252. return dir( elem, "parentNode", until );
  11253. },
  11254. next: function( elem ) {
  11255. return sibling( elem, "nextSibling" );
  11256. },
  11257. prev: function( elem ) {
  11258. return sibling( elem, "previousSibling" );
  11259. },
  11260. nextAll: function( elem ) {
  11261. return dir( elem, "nextSibling" );
  11262. },
  11263. prevAll: function( elem ) {
  11264. return dir( elem, "previousSibling" );
  11265. },
  11266. nextUntil: function( elem, i, until ) {
  11267. return dir( elem, "nextSibling", until );
  11268. },
  11269. prevUntil: function( elem, i, until ) {
  11270. return dir( elem, "previousSibling", until );
  11271. },
  11272. siblings: function( elem ) {
  11273. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11274. },
  11275. children: function( elem ) {
  11276. return siblings( elem.firstChild );
  11277. },
  11278. contents: function( elem ) {
  11279. if ( typeof elem.contentDocument !== "undefined" ) {
  11280. return elem.contentDocument;
  11281. }
  11282. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11283. // Treat the template element as a regular one in browsers that
  11284. // don't support it.
  11285. if ( nodeName( elem, "template" ) ) {
  11286. elem = elem.content || elem;
  11287. }
  11288. return jQuery.merge( [], elem.childNodes );
  11289. }
  11290. }, function( name, fn ) {
  11291. jQuery.fn[ name ] = function( until, selector ) {
  11292. var matched = jQuery.map( this, fn, until );
  11293. if ( name.slice( -5 ) !== "Until" ) {
  11294. selector = until;
  11295. }
  11296. if ( selector && typeof selector === "string" ) {
  11297. matched = jQuery.filter( selector, matched );
  11298. }
  11299. if ( this.length > 1 ) {
  11300. // Remove duplicates
  11301. if ( !guaranteedUnique[ name ] ) {
  11302. jQuery.uniqueSort( matched );
  11303. }
  11304. // Reverse order for parents* and prev-derivatives
  11305. if ( rparentsprev.test( name ) ) {
  11306. matched.reverse();
  11307. }
  11308. }
  11309. return this.pushStack( matched );
  11310. };
  11311. } );
  11312. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11313. // Convert String-formatted options into Object-formatted ones
  11314. function createOptions( options ) {
  11315. var object = {};
  11316. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11317. object[ flag ] = true;
  11318. } );
  11319. return object;
  11320. }
  11321. /*
  11322. * Create a callback list using the following parameters:
  11323. *
  11324. * options: an optional list of space-separated options that will change how
  11325. * the callback list behaves or a more traditional option object
  11326. *
  11327. * By default a callback list will act like an event callback list and can be
  11328. * "fired" multiple times.
  11329. *
  11330. * Possible options:
  11331. *
  11332. * once: will ensure the callback list can only be fired once (like a Deferred)
  11333. *
  11334. * memory: will keep track of previous values and will call any callback added
  11335. * after the list has been fired right away with the latest "memorized"
  11336. * values (like a Deferred)
  11337. *
  11338. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11339. *
  11340. * stopOnFalse: interrupt callings when a callback returns false
  11341. *
  11342. */
  11343. jQuery.Callbacks = function( options ) {
  11344. // Convert options from String-formatted to Object-formatted if needed
  11345. // (we check in cache first)
  11346. options = typeof options === "string" ?
  11347. createOptions( options ) :
  11348. jQuery.extend( {}, options );
  11349. var // Flag to know if list is currently firing
  11350. firing,
  11351. // Last fire value for non-forgettable lists
  11352. memory,
  11353. // Flag to know if list was already fired
  11354. fired,
  11355. // Flag to prevent firing
  11356. locked,
  11357. // Actual callback list
  11358. list = [],
  11359. // Queue of execution data for repeatable lists
  11360. queue = [],
  11361. // Index of currently firing callback (modified by add/remove as needed)
  11362. firingIndex = -1,
  11363. // Fire callbacks
  11364. fire = function() {
  11365. // Enforce single-firing
  11366. locked = locked || options.once;
  11367. // Execute callbacks for all pending executions,
  11368. // respecting firingIndex overrides and runtime changes
  11369. fired = firing = true;
  11370. for ( ; queue.length; firingIndex = -1 ) {
  11371. memory = queue.shift();
  11372. while ( ++firingIndex < list.length ) {
  11373. // Run callback and check for early termination
  11374. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11375. options.stopOnFalse ) {
  11376. // Jump to end and forget the data so .add doesn't re-fire
  11377. firingIndex = list.length;
  11378. memory = false;
  11379. }
  11380. }
  11381. }
  11382. // Forget the data if we're done with it
  11383. if ( !options.memory ) {
  11384. memory = false;
  11385. }
  11386. firing = false;
  11387. // Clean up if we're done firing for good
  11388. if ( locked ) {
  11389. // Keep an empty list if we have data for future add calls
  11390. if ( memory ) {
  11391. list = [];
  11392. // Otherwise, this object is spent
  11393. } else {
  11394. list = "";
  11395. }
  11396. }
  11397. },
  11398. // Actual Callbacks object
  11399. self = {
  11400. // Add a callback or a collection of callbacks to the list
  11401. add: function() {
  11402. if ( list ) {
  11403. // If we have memory from a past run, we should fire after adding
  11404. if ( memory && !firing ) {
  11405. firingIndex = list.length - 1;
  11406. queue.push( memory );
  11407. }
  11408. ( function add( args ) {
  11409. jQuery.each( args, function( _, arg ) {
  11410. if ( isFunction( arg ) ) {
  11411. if ( !options.unique || !self.has( arg ) ) {
  11412. list.push( arg );
  11413. }
  11414. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11415. // Inspect recursively
  11416. add( arg );
  11417. }
  11418. } );
  11419. } )( arguments );
  11420. if ( memory && !firing ) {
  11421. fire();
  11422. }
  11423. }
  11424. return this;
  11425. },
  11426. // Remove a callback from the list
  11427. remove: function() {
  11428. jQuery.each( arguments, function( _, arg ) {
  11429. var index;
  11430. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11431. list.splice( index, 1 );
  11432. // Handle firing indexes
  11433. if ( index <= firingIndex ) {
  11434. firingIndex--;
  11435. }
  11436. }
  11437. } );
  11438. return this;
  11439. },
  11440. // Check if a given callback is in the list.
  11441. // If no argument is given, return whether or not list has callbacks attached.
  11442. has: function( fn ) {
  11443. return fn ?
  11444. jQuery.inArray( fn, list ) > -1 :
  11445. list.length > 0;
  11446. },
  11447. // Remove all callbacks from the list
  11448. empty: function() {
  11449. if ( list ) {
  11450. list = [];
  11451. }
  11452. return this;
  11453. },
  11454. // Disable .fire and .add
  11455. // Abort any current/pending executions
  11456. // Clear all callbacks and values
  11457. disable: function() {
  11458. locked = queue = [];
  11459. list = memory = "";
  11460. return this;
  11461. },
  11462. disabled: function() {
  11463. return !list;
  11464. },
  11465. // Disable .fire
  11466. // Also disable .add unless we have memory (since it would have no effect)
  11467. // Abort any pending executions
  11468. lock: function() {
  11469. locked = queue = [];
  11470. if ( !memory && !firing ) {
  11471. list = memory = "";
  11472. }
  11473. return this;
  11474. },
  11475. locked: function() {
  11476. return !!locked;
  11477. },
  11478. // Call all callbacks with the given context and arguments
  11479. fireWith: function( context, args ) {
  11480. if ( !locked ) {
  11481. args = args || [];
  11482. args = [ context, args.slice ? args.slice() : args ];
  11483. queue.push( args );
  11484. if ( !firing ) {
  11485. fire();
  11486. }
  11487. }
  11488. return this;
  11489. },
  11490. // Call all the callbacks with the given arguments
  11491. fire: function() {
  11492. self.fireWith( this, arguments );
  11493. return this;
  11494. },
  11495. // To know if the callbacks have already been called at least once
  11496. fired: function() {
  11497. return !!fired;
  11498. }
  11499. };
  11500. return self;
  11501. };
  11502. function Identity( v ) {
  11503. return v;
  11504. }
  11505. function Thrower( ex ) {
  11506. throw ex;
  11507. }
  11508. function adoptValue( value, resolve, reject, noValue ) {
  11509. var method;
  11510. try {
  11511. // Check for promise aspect first to privilege synchronous behavior
  11512. if ( value && isFunction( ( method = value.promise ) ) ) {
  11513. method.call( value ).done( resolve ).fail( reject );
  11514. // Other thenables
  11515. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11516. method.call( value, resolve, reject );
  11517. // Other non-thenables
  11518. } else {
  11519. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11520. // * false: [ value ].slice( 0 ) => resolve( value )
  11521. // * true: [ value ].slice( 1 ) => resolve()
  11522. resolve.apply( undefined, [ value ].slice( noValue ) );
  11523. }
  11524. // For Promises/A+, convert exceptions into rejections
  11525. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11526. // Deferred#then to conditionally suppress rejection.
  11527. } catch ( value ) {
  11528. // Support: Android 4.0 only
  11529. // Strict mode functions invoked without .call/.apply get global-object context
  11530. reject.apply( undefined, [ value ] );
  11531. }
  11532. }
  11533. jQuery.extend( {
  11534. Deferred: function( func ) {
  11535. var tuples = [
  11536. // action, add listener, callbacks,
  11537. // ... .then handlers, argument index, [final state]
  11538. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11539. jQuery.Callbacks( "memory" ), 2 ],
  11540. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11541. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11542. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11543. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11544. ],
  11545. state = "pending",
  11546. promise = {
  11547. state: function() {
  11548. return state;
  11549. },
  11550. always: function() {
  11551. deferred.done( arguments ).fail( arguments );
  11552. return this;
  11553. },
  11554. "catch": function( fn ) {
  11555. return promise.then( null, fn );
  11556. },
  11557. // Keep pipe for back-compat
  11558. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11559. var fns = arguments;
  11560. return jQuery.Deferred( function( newDefer ) {
  11561. jQuery.each( tuples, function( i, tuple ) {
  11562. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11563. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11564. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11565. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11566. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11567. deferred[ tuple[ 1 ] ]( function() {
  11568. var returned = fn && fn.apply( this, arguments );
  11569. if ( returned && isFunction( returned.promise ) ) {
  11570. returned.promise()
  11571. .progress( newDefer.notify )
  11572. .done( newDefer.resolve )
  11573. .fail( newDefer.reject );
  11574. } else {
  11575. newDefer[ tuple[ 0 ] + "With" ](
  11576. this,
  11577. fn ? [ returned ] : arguments
  11578. );
  11579. }
  11580. } );
  11581. } );
  11582. fns = null;
  11583. } ).promise();
  11584. },
  11585. then: function( onFulfilled, onRejected, onProgress ) {
  11586. var maxDepth = 0;
  11587. function resolve( depth, deferred, handler, special ) {
  11588. return function() {
  11589. var that = this,
  11590. args = arguments,
  11591. mightThrow = function() {
  11592. var returned, then;
  11593. // Support: Promises/A+ section 2.3.3.3.3
  11594. // https://promisesaplus.com/#point-59
  11595. // Ignore double-resolution attempts
  11596. if ( depth < maxDepth ) {
  11597. return;
  11598. }
  11599. returned = handler.apply( that, args );
  11600. // Support: Promises/A+ section 2.3.1
  11601. // https://promisesaplus.com/#point-48
  11602. if ( returned === deferred.promise() ) {
  11603. throw new TypeError( "Thenable self-resolution" );
  11604. }
  11605. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11606. // https://promisesaplus.com/#point-54
  11607. // https://promisesaplus.com/#point-75
  11608. // Retrieve `then` only once
  11609. then = returned &&
  11610. // Support: Promises/A+ section 2.3.4
  11611. // https://promisesaplus.com/#point-64
  11612. // Only check objects and functions for thenability
  11613. ( typeof returned === "object" ||
  11614. typeof returned === "function" ) &&
  11615. returned.then;
  11616. // Handle a returned thenable
  11617. if ( isFunction( then ) ) {
  11618. // Special processors (notify) just wait for resolution
  11619. if ( special ) {
  11620. then.call(
  11621. returned,
  11622. resolve( maxDepth, deferred, Identity, special ),
  11623. resolve( maxDepth, deferred, Thrower, special )
  11624. );
  11625. // Normal processors (resolve) also hook into progress
  11626. } else {
  11627. // ...and disregard older resolution values
  11628. maxDepth++;
  11629. then.call(
  11630. returned,
  11631. resolve( maxDepth, deferred, Identity, special ),
  11632. resolve( maxDepth, deferred, Thrower, special ),
  11633. resolve( maxDepth, deferred, Identity,
  11634. deferred.notifyWith )
  11635. );
  11636. }
  11637. // Handle all other returned values
  11638. } else {
  11639. // Only substitute handlers pass on context
  11640. // and multiple values (non-spec behavior)
  11641. if ( handler !== Identity ) {
  11642. that = undefined;
  11643. args = [ returned ];
  11644. }
  11645. // Process the value(s)
  11646. // Default process is resolve
  11647. ( special || deferred.resolveWith )( that, args );
  11648. }
  11649. },
  11650. // Only normal processors (resolve) catch and reject exceptions
  11651. process = special ?
  11652. mightThrow :
  11653. function() {
  11654. try {
  11655. mightThrow();
  11656. } catch ( e ) {
  11657. if ( jQuery.Deferred.exceptionHook ) {
  11658. jQuery.Deferred.exceptionHook( e,
  11659. process.stackTrace );
  11660. }
  11661. // Support: Promises/A+ section 2.3.3.3.4.1
  11662. // https://promisesaplus.com/#point-61
  11663. // Ignore post-resolution exceptions
  11664. if ( depth + 1 >= maxDepth ) {
  11665. // Only substitute handlers pass on context
  11666. // and multiple values (non-spec behavior)
  11667. if ( handler !== Thrower ) {
  11668. that = undefined;
  11669. args = [ e ];
  11670. }
  11671. deferred.rejectWith( that, args );
  11672. }
  11673. }
  11674. };
  11675. // Support: Promises/A+ section 2.3.3.3.1
  11676. // https://promisesaplus.com/#point-57
  11677. // Re-resolve promises immediately to dodge false rejection from
  11678. // subsequent errors
  11679. if ( depth ) {
  11680. process();
  11681. } else {
  11682. // Call an optional hook to record the stack, in case of exception
  11683. // since it's otherwise lost when execution goes async
  11684. if ( jQuery.Deferred.getStackHook ) {
  11685. process.stackTrace = jQuery.Deferred.getStackHook();
  11686. }
  11687. window.setTimeout( process );
  11688. }
  11689. };
  11690. }
  11691. return jQuery.Deferred( function( newDefer ) {
  11692. // progress_handlers.add( ... )
  11693. tuples[ 0 ][ 3 ].add(
  11694. resolve(
  11695. 0,
  11696. newDefer,
  11697. isFunction( onProgress ) ?
  11698. onProgress :
  11699. Identity,
  11700. newDefer.notifyWith
  11701. )
  11702. );
  11703. // fulfilled_handlers.add( ... )
  11704. tuples[ 1 ][ 3 ].add(
  11705. resolve(
  11706. 0,
  11707. newDefer,
  11708. isFunction( onFulfilled ) ?
  11709. onFulfilled :
  11710. Identity
  11711. )
  11712. );
  11713. // rejected_handlers.add( ... )
  11714. tuples[ 2 ][ 3 ].add(
  11715. resolve(
  11716. 0,
  11717. newDefer,
  11718. isFunction( onRejected ) ?
  11719. onRejected :
  11720. Thrower
  11721. )
  11722. );
  11723. } ).promise();
  11724. },
  11725. // Get a promise for this deferred
  11726. // If obj is provided, the promise aspect is added to the object
  11727. promise: function( obj ) {
  11728. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11729. }
  11730. },
  11731. deferred = {};
  11732. // Add list-specific methods
  11733. jQuery.each( tuples, function( i, tuple ) {
  11734. var list = tuple[ 2 ],
  11735. stateString = tuple[ 5 ];
  11736. // promise.progress = list.add
  11737. // promise.done = list.add
  11738. // promise.fail = list.add
  11739. promise[ tuple[ 1 ] ] = list.add;
  11740. // Handle state
  11741. if ( stateString ) {
  11742. list.add(
  11743. function() {
  11744. // state = "resolved" (i.e., fulfilled)
  11745. // state = "rejected"
  11746. state = stateString;
  11747. },
  11748. // rejected_callbacks.disable
  11749. // fulfilled_callbacks.disable
  11750. tuples[ 3 - i ][ 2 ].disable,
  11751. // rejected_handlers.disable
  11752. // fulfilled_handlers.disable
  11753. tuples[ 3 - i ][ 3 ].disable,
  11754. // progress_callbacks.lock
  11755. tuples[ 0 ][ 2 ].lock,
  11756. // progress_handlers.lock
  11757. tuples[ 0 ][ 3 ].lock
  11758. );
  11759. }
  11760. // progress_handlers.fire
  11761. // fulfilled_handlers.fire
  11762. // rejected_handlers.fire
  11763. list.add( tuple[ 3 ].fire );
  11764. // deferred.notify = function() { deferred.notifyWith(...) }
  11765. // deferred.resolve = function() { deferred.resolveWith(...) }
  11766. // deferred.reject = function() { deferred.rejectWith(...) }
  11767. deferred[ tuple[ 0 ] ] = function() {
  11768. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11769. return this;
  11770. };
  11771. // deferred.notifyWith = list.fireWith
  11772. // deferred.resolveWith = list.fireWith
  11773. // deferred.rejectWith = list.fireWith
  11774. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11775. } );
  11776. // Make the deferred a promise
  11777. promise.promise( deferred );
  11778. // Call given func if any
  11779. if ( func ) {
  11780. func.call( deferred, deferred );
  11781. }
  11782. // All done!
  11783. return deferred;
  11784. },
  11785. // Deferred helper
  11786. when: function( singleValue ) {
  11787. var
  11788. // count of uncompleted subordinates
  11789. remaining = arguments.length,
  11790. // count of unprocessed arguments
  11791. i = remaining,
  11792. // subordinate fulfillment data
  11793. resolveContexts = Array( i ),
  11794. resolveValues = slice.call( arguments ),
  11795. // the master Deferred
  11796. master = jQuery.Deferred(),
  11797. // subordinate callback factory
  11798. updateFunc = function( i ) {
  11799. return function( value ) {
  11800. resolveContexts[ i ] = this;
  11801. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11802. if ( !( --remaining ) ) {
  11803. master.resolveWith( resolveContexts, resolveValues );
  11804. }
  11805. };
  11806. };
  11807. // Single- and empty arguments are adopted like Promise.resolve
  11808. if ( remaining <= 1 ) {
  11809. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11810. !remaining );
  11811. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11812. if ( master.state() === "pending" ||
  11813. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11814. return master.then();
  11815. }
  11816. }
  11817. // Multiple arguments are aggregated like Promise.all array elements
  11818. while ( i-- ) {
  11819. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11820. }
  11821. return master.promise();
  11822. }
  11823. } );
  11824. // These usually indicate a programmer mistake during development,
  11825. // warn about them ASAP rather than swallowing them by default.
  11826. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11827. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11828. // Support: IE 8 - 9 only
  11829. // Console exists when dev tools are open, which can happen at any time
  11830. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11831. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11832. }
  11833. };
  11834. jQuery.readyException = function( error ) {
  11835. window.setTimeout( function() {
  11836. throw error;
  11837. } );
  11838. };
  11839. // The deferred used on DOM ready
  11840. var readyList = jQuery.Deferred();
  11841. jQuery.fn.ready = function( fn ) {
  11842. readyList
  11843. .then( fn )
  11844. // Wrap jQuery.readyException in a function so that the lookup
  11845. // happens at the time of error handling instead of callback
  11846. // registration.
  11847. .catch( function( error ) {
  11848. jQuery.readyException( error );
  11849. } );
  11850. return this;
  11851. };
  11852. jQuery.extend( {
  11853. // Is the DOM ready to be used? Set to true once it occurs.
  11854. isReady: false,
  11855. // A counter to track how many items to wait for before
  11856. // the ready event fires. See #6781
  11857. readyWait: 1,
  11858. // Handle when the DOM is ready
  11859. ready: function( wait ) {
  11860. // Abort if there are pending holds or we're already ready
  11861. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11862. return;
  11863. }
  11864. // Remember that the DOM is ready
  11865. jQuery.isReady = true;
  11866. // If a normal DOM Ready event fired, decrement, and wait if need be
  11867. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11868. return;
  11869. }
  11870. // If there are functions bound, to execute
  11871. readyList.resolveWith( document, [ jQuery ] );
  11872. }
  11873. } );
  11874. jQuery.ready.then = readyList.then;
  11875. // The ready event handler and self cleanup method
  11876. function completed() {
  11877. document.removeEventListener( "DOMContentLoaded", completed );
  11878. window.removeEventListener( "load", completed );
  11879. jQuery.ready();
  11880. }
  11881. // Catch cases where $(document).ready() is called
  11882. // after the browser event has already occurred.
  11883. // Support: IE <=9 - 10 only
  11884. // Older IE sometimes signals "interactive" too soon
  11885. if ( document.readyState === "complete" ||
  11886. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11887. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11888. window.setTimeout( jQuery.ready );
  11889. } else {
  11890. // Use the handy event callback
  11891. document.addEventListener( "DOMContentLoaded", completed );
  11892. // A fallback to window.onload, that will always work
  11893. window.addEventListener( "load", completed );
  11894. }
  11895. // Multifunctional method to get and set values of a collection
  11896. // The value/s can optionally be executed if it's a function
  11897. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11898. var i = 0,
  11899. len = elems.length,
  11900. bulk = key == null;
  11901. // Sets many values
  11902. if ( toType( key ) === "object" ) {
  11903. chainable = true;
  11904. for ( i in key ) {
  11905. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11906. }
  11907. // Sets one value
  11908. } else if ( value !== undefined ) {
  11909. chainable = true;
  11910. if ( !isFunction( value ) ) {
  11911. raw = true;
  11912. }
  11913. if ( bulk ) {
  11914. // Bulk operations run against the entire set
  11915. if ( raw ) {
  11916. fn.call( elems, value );
  11917. fn = null;
  11918. // ...except when executing function values
  11919. } else {
  11920. bulk = fn;
  11921. fn = function( elem, key, value ) {
  11922. return bulk.call( jQuery( elem ), value );
  11923. };
  11924. }
  11925. }
  11926. if ( fn ) {
  11927. for ( ; i < len; i++ ) {
  11928. fn(
  11929. elems[ i ], key, raw ?
  11930. value :
  11931. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11932. );
  11933. }
  11934. }
  11935. }
  11936. if ( chainable ) {
  11937. return elems;
  11938. }
  11939. // Gets
  11940. if ( bulk ) {
  11941. return fn.call( elems );
  11942. }
  11943. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11944. };
  11945. // Matches dashed string for camelizing
  11946. var rmsPrefix = /^-ms-/,
  11947. rdashAlpha = /-([a-z])/g;
  11948. // Used by camelCase as callback to replace()
  11949. function fcamelCase( all, letter ) {
  11950. return letter.toUpperCase();
  11951. }
  11952. // Convert dashed to camelCase; used by the css and data modules
  11953. // Support: IE <=9 - 11, Edge 12 - 15
  11954. // Microsoft forgot to hump their vendor prefix (#9572)
  11955. function camelCase( string ) {
  11956. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11957. }
  11958. var acceptData = function( owner ) {
  11959. // Accepts only:
  11960. // - Node
  11961. // - Node.ELEMENT_NODE
  11962. // - Node.DOCUMENT_NODE
  11963. // - Object
  11964. // - Any
  11965. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11966. };
  11967. function Data() {
  11968. this.expando = jQuery.expando + Data.uid++;
  11969. }
  11970. Data.uid = 1;
  11971. Data.prototype = {
  11972. cache: function( owner ) {
  11973. // Check if the owner object already has a cache
  11974. var value = owner[ this.expando ];
  11975. // If not, create one
  11976. if ( !value ) {
  11977. value = {};
  11978. // We can accept data for non-element nodes in modern browsers,
  11979. // but we should not, see #8335.
  11980. // Always return an empty object.
  11981. if ( acceptData( owner ) ) {
  11982. // If it is a node unlikely to be stringify-ed or looped over
  11983. // use plain assignment
  11984. if ( owner.nodeType ) {
  11985. owner[ this.expando ] = value;
  11986. // Otherwise secure it in a non-enumerable property
  11987. // configurable must be true to allow the property to be
  11988. // deleted when data is removed
  11989. } else {
  11990. Object.defineProperty( owner, this.expando, {
  11991. value: value,
  11992. configurable: true
  11993. } );
  11994. }
  11995. }
  11996. }
  11997. return value;
  11998. },
  11999. set: function( owner, data, value ) {
  12000. var prop,
  12001. cache = this.cache( owner );
  12002. // Handle: [ owner, key, value ] args
  12003. // Always use camelCase key (gh-2257)
  12004. if ( typeof data === "string" ) {
  12005. cache[ camelCase( data ) ] = value;
  12006. // Handle: [ owner, { properties } ] args
  12007. } else {
  12008. // Copy the properties one-by-one to the cache object
  12009. for ( prop in data ) {
  12010. cache[ camelCase( prop ) ] = data[ prop ];
  12011. }
  12012. }
  12013. return cache;
  12014. },
  12015. get: function( owner, key ) {
  12016. return key === undefined ?
  12017. this.cache( owner ) :
  12018. // Always use camelCase key (gh-2257)
  12019. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12020. },
  12021. access: function( owner, key, value ) {
  12022. // In cases where either:
  12023. //
  12024. // 1. No key was specified
  12025. // 2. A string key was specified, but no value provided
  12026. //
  12027. // Take the "read" path and allow the get method to determine
  12028. // which value to return, respectively either:
  12029. //
  12030. // 1. The entire cache object
  12031. // 2. The data stored at the key
  12032. //
  12033. if ( key === undefined ||
  12034. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12035. return this.get( owner, key );
  12036. }
  12037. // When the key is not a string, or both a key and value
  12038. // are specified, set or extend (existing objects) with either:
  12039. //
  12040. // 1. An object of properties
  12041. // 2. A key and value
  12042. //
  12043. this.set( owner, key, value );
  12044. // Since the "set" path can have two possible entry points
  12045. // return the expected data based on which path was taken[*]
  12046. return value !== undefined ? value : key;
  12047. },
  12048. remove: function( owner, key ) {
  12049. var i,
  12050. cache = owner[ this.expando ];
  12051. if ( cache === undefined ) {
  12052. return;
  12053. }
  12054. if ( key !== undefined ) {
  12055. // Support array or space separated string of keys
  12056. if ( Array.isArray( key ) ) {
  12057. // If key is an array of keys...
  12058. // We always set camelCase keys, so remove that.
  12059. key = key.map( camelCase );
  12060. } else {
  12061. key = camelCase( key );
  12062. // If a key with the spaces exists, use it.
  12063. // Otherwise, create an array by matching non-whitespace
  12064. key = key in cache ?
  12065. [ key ] :
  12066. ( key.match( rnothtmlwhite ) || [] );
  12067. }
  12068. i = key.length;
  12069. while ( i-- ) {
  12070. delete cache[ key[ i ] ];
  12071. }
  12072. }
  12073. // Remove the expando if there's no more data
  12074. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12075. // Support: Chrome <=35 - 45
  12076. // Webkit & Blink performance suffers when deleting properties
  12077. // from DOM nodes, so set to undefined instead
  12078. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12079. if ( owner.nodeType ) {
  12080. owner[ this.expando ] = undefined;
  12081. } else {
  12082. delete owner[ this.expando ];
  12083. }
  12084. }
  12085. },
  12086. hasData: function( owner ) {
  12087. var cache = owner[ this.expando ];
  12088. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12089. }
  12090. };
  12091. var dataPriv = new Data();
  12092. var dataUser = new Data();
  12093. // Implementation Summary
  12094. //
  12095. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12096. // 2. Improve the module's maintainability by reducing the storage
  12097. // paths to a single mechanism.
  12098. // 3. Use the same single mechanism to support "private" and "user" data.
  12099. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12100. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12101. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12102. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12103. rmultiDash = /[A-Z]/g;
  12104. function getData( data ) {
  12105. if ( data === "true" ) {
  12106. return true;
  12107. }
  12108. if ( data === "false" ) {
  12109. return false;
  12110. }
  12111. if ( data === "null" ) {
  12112. return null;
  12113. }
  12114. // Only convert to a number if it doesn't change the string
  12115. if ( data === +data + "" ) {
  12116. return +data;
  12117. }
  12118. if ( rbrace.test( data ) ) {
  12119. return JSON.parse( data );
  12120. }
  12121. return data;
  12122. }
  12123. function dataAttr( elem, key, data ) {
  12124. var name;
  12125. // If nothing was found internally, try to fetch any
  12126. // data from the HTML5 data-* attribute
  12127. if ( data === undefined && elem.nodeType === 1 ) {
  12128. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12129. data = elem.getAttribute( name );
  12130. if ( typeof data === "string" ) {
  12131. try {
  12132. data = getData( data );
  12133. } catch ( e ) {}
  12134. // Make sure we set the data so it isn't changed later
  12135. dataUser.set( elem, key, data );
  12136. } else {
  12137. data = undefined;
  12138. }
  12139. }
  12140. return data;
  12141. }
  12142. jQuery.extend( {
  12143. hasData: function( elem ) {
  12144. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12145. },
  12146. data: function( elem, name, data ) {
  12147. return dataUser.access( elem, name, data );
  12148. },
  12149. removeData: function( elem, name ) {
  12150. dataUser.remove( elem, name );
  12151. },
  12152. // TODO: Now that all calls to _data and _removeData have been replaced
  12153. // with direct calls to dataPriv methods, these can be deprecated.
  12154. _data: function( elem, name, data ) {
  12155. return dataPriv.access( elem, name, data );
  12156. },
  12157. _removeData: function( elem, name ) {
  12158. dataPriv.remove( elem, name );
  12159. }
  12160. } );
  12161. jQuery.fn.extend( {
  12162. data: function( key, value ) {
  12163. var i, name, data,
  12164. elem = this[ 0 ],
  12165. attrs = elem && elem.attributes;
  12166. // Gets all values
  12167. if ( key === undefined ) {
  12168. if ( this.length ) {
  12169. data = dataUser.get( elem );
  12170. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12171. i = attrs.length;
  12172. while ( i-- ) {
  12173. // Support: IE 11 only
  12174. // The attrs elements can be null (#14894)
  12175. if ( attrs[ i ] ) {
  12176. name = attrs[ i ].name;
  12177. if ( name.indexOf( "data-" ) === 0 ) {
  12178. name = camelCase( name.slice( 5 ) );
  12179. dataAttr( elem, name, data[ name ] );
  12180. }
  12181. }
  12182. }
  12183. dataPriv.set( elem, "hasDataAttrs", true );
  12184. }
  12185. }
  12186. return data;
  12187. }
  12188. // Sets multiple values
  12189. if ( typeof key === "object" ) {
  12190. return this.each( function() {
  12191. dataUser.set( this, key );
  12192. } );
  12193. }
  12194. return access( this, function( value ) {
  12195. var data;
  12196. // The calling jQuery object (element matches) is not empty
  12197. // (and therefore has an element appears at this[ 0 ]) and the
  12198. // `value` parameter was not undefined. An empty jQuery object
  12199. // will result in `undefined` for elem = this[ 0 ] which will
  12200. // throw an exception if an attempt to read a data cache is made.
  12201. if ( elem && value === undefined ) {
  12202. // Attempt to get data from the cache
  12203. // The key will always be camelCased in Data
  12204. data = dataUser.get( elem, key );
  12205. if ( data !== undefined ) {
  12206. return data;
  12207. }
  12208. // Attempt to "discover" the data in
  12209. // HTML5 custom data-* attrs
  12210. data = dataAttr( elem, key );
  12211. if ( data !== undefined ) {
  12212. return data;
  12213. }
  12214. // We tried really hard, but the data doesn't exist.
  12215. return;
  12216. }
  12217. // Set the data...
  12218. this.each( function() {
  12219. // We always store the camelCased key
  12220. dataUser.set( this, key, value );
  12221. } );
  12222. }, null, value, arguments.length > 1, null, true );
  12223. },
  12224. removeData: function( key ) {
  12225. return this.each( function() {
  12226. dataUser.remove( this, key );
  12227. } );
  12228. }
  12229. } );
  12230. jQuery.extend( {
  12231. queue: function( elem, type, data ) {
  12232. var queue;
  12233. if ( elem ) {
  12234. type = ( type || "fx" ) + "queue";
  12235. queue = dataPriv.get( elem, type );
  12236. // Speed up dequeue by getting out quickly if this is just a lookup
  12237. if ( data ) {
  12238. if ( !queue || Array.isArray( data ) ) {
  12239. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12240. } else {
  12241. queue.push( data );
  12242. }
  12243. }
  12244. return queue || [];
  12245. }
  12246. },
  12247. dequeue: function( elem, type ) {
  12248. type = type || "fx";
  12249. var queue = jQuery.queue( elem, type ),
  12250. startLength = queue.length,
  12251. fn = queue.shift(),
  12252. hooks = jQuery._queueHooks( elem, type ),
  12253. next = function() {
  12254. jQuery.dequeue( elem, type );
  12255. };
  12256. // If the fx queue is dequeued, always remove the progress sentinel
  12257. if ( fn === "inprogress" ) {
  12258. fn = queue.shift();
  12259. startLength--;
  12260. }
  12261. if ( fn ) {
  12262. // Add a progress sentinel to prevent the fx queue from being
  12263. // automatically dequeued
  12264. if ( type === "fx" ) {
  12265. queue.unshift( "inprogress" );
  12266. }
  12267. // Clear up the last queue stop function
  12268. delete hooks.stop;
  12269. fn.call( elem, next, hooks );
  12270. }
  12271. if ( !startLength && hooks ) {
  12272. hooks.empty.fire();
  12273. }
  12274. },
  12275. // Not public - generate a queueHooks object, or return the current one
  12276. _queueHooks: function( elem, type ) {
  12277. var key = type + "queueHooks";
  12278. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12279. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12280. dataPriv.remove( elem, [ type + "queue", key ] );
  12281. } )
  12282. } );
  12283. }
  12284. } );
  12285. jQuery.fn.extend( {
  12286. queue: function( type, data ) {
  12287. var setter = 2;
  12288. if ( typeof type !== "string" ) {
  12289. data = type;
  12290. type = "fx";
  12291. setter--;
  12292. }
  12293. if ( arguments.length < setter ) {
  12294. return jQuery.queue( this[ 0 ], type );
  12295. }
  12296. return data === undefined ?
  12297. this :
  12298. this.each( function() {
  12299. var queue = jQuery.queue( this, type, data );
  12300. // Ensure a hooks for this queue
  12301. jQuery._queueHooks( this, type );
  12302. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12303. jQuery.dequeue( this, type );
  12304. }
  12305. } );
  12306. },
  12307. dequeue: function( type ) {
  12308. return this.each( function() {
  12309. jQuery.dequeue( this, type );
  12310. } );
  12311. },
  12312. clearQueue: function( type ) {
  12313. return this.queue( type || "fx", [] );
  12314. },
  12315. // Get a promise resolved when queues of a certain type
  12316. // are emptied (fx is the type by default)
  12317. promise: function( type, obj ) {
  12318. var tmp,
  12319. count = 1,
  12320. defer = jQuery.Deferred(),
  12321. elements = this,
  12322. i = this.length,
  12323. resolve = function() {
  12324. if ( !( --count ) ) {
  12325. defer.resolveWith( elements, [ elements ] );
  12326. }
  12327. };
  12328. if ( typeof type !== "string" ) {
  12329. obj = type;
  12330. type = undefined;
  12331. }
  12332. type = type || "fx";
  12333. while ( i-- ) {
  12334. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12335. if ( tmp && tmp.empty ) {
  12336. count++;
  12337. tmp.empty.add( resolve );
  12338. }
  12339. }
  12340. resolve();
  12341. return defer.promise( obj );
  12342. }
  12343. } );
  12344. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12345. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12346. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12347. var documentElement = document.documentElement;
  12348. var isAttached = function( elem ) {
  12349. return jQuery.contains( elem.ownerDocument, elem );
  12350. },
  12351. composed = { composed: true };
  12352. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12353. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12354. // Support: iOS 10.0-10.2 only
  12355. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12356. // leading to errors. We need to check for `getRootNode`.
  12357. if ( documentElement.getRootNode ) {
  12358. isAttached = function( elem ) {
  12359. return jQuery.contains( elem.ownerDocument, elem ) ||
  12360. elem.getRootNode( composed ) === elem.ownerDocument;
  12361. };
  12362. }
  12363. var isHiddenWithinTree = function( elem, el ) {
  12364. // isHiddenWithinTree might be called from jQuery#filter function;
  12365. // in that case, element will be second argument
  12366. elem = el || elem;
  12367. // Inline style trumps all
  12368. return elem.style.display === "none" ||
  12369. elem.style.display === "" &&
  12370. // Otherwise, check computed style
  12371. // Support: Firefox <=43 - 45
  12372. // Disconnected elements can have computed display: none, so first confirm that elem is
  12373. // in the document.
  12374. isAttached( elem ) &&
  12375. jQuery.css( elem, "display" ) === "none";
  12376. };
  12377. var swap = function( elem, options, callback, args ) {
  12378. var ret, name,
  12379. old = {};
  12380. // Remember the old values, and insert the new ones
  12381. for ( name in options ) {
  12382. old[ name ] = elem.style[ name ];
  12383. elem.style[ name ] = options[ name ];
  12384. }
  12385. ret = callback.apply( elem, args || [] );
  12386. // Revert the old values
  12387. for ( name in options ) {
  12388. elem.style[ name ] = old[ name ];
  12389. }
  12390. return ret;
  12391. };
  12392. function adjustCSS( elem, prop, valueParts, tween ) {
  12393. var adjusted, scale,
  12394. maxIterations = 20,
  12395. currentValue = tween ?
  12396. function() {
  12397. return tween.cur();
  12398. } :
  12399. function() {
  12400. return jQuery.css( elem, prop, "" );
  12401. },
  12402. initial = currentValue(),
  12403. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12404. // Starting value computation is required for potential unit mismatches
  12405. initialInUnit = elem.nodeType &&
  12406. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12407. rcssNum.exec( jQuery.css( elem, prop ) );
  12408. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12409. // Support: Firefox <=54
  12410. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12411. initial = initial / 2;
  12412. // Trust units reported by jQuery.css
  12413. unit = unit || initialInUnit[ 3 ];
  12414. // Iteratively approximate from a nonzero starting point
  12415. initialInUnit = +initial || 1;
  12416. while ( maxIterations-- ) {
  12417. // Evaluate and update our best guess (doubling guesses that zero out).
  12418. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12419. jQuery.style( elem, prop, initialInUnit + unit );
  12420. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12421. maxIterations = 0;
  12422. }
  12423. initialInUnit = initialInUnit / scale;
  12424. }
  12425. initialInUnit = initialInUnit * 2;
  12426. jQuery.style( elem, prop, initialInUnit + unit );
  12427. // Make sure we update the tween properties later on
  12428. valueParts = valueParts || [];
  12429. }
  12430. if ( valueParts ) {
  12431. initialInUnit = +initialInUnit || +initial || 0;
  12432. // Apply relative offset (+=/-=) if specified
  12433. adjusted = valueParts[ 1 ] ?
  12434. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12435. +valueParts[ 2 ];
  12436. if ( tween ) {
  12437. tween.unit = unit;
  12438. tween.start = initialInUnit;
  12439. tween.end = adjusted;
  12440. }
  12441. }
  12442. return adjusted;
  12443. }
  12444. var defaultDisplayMap = {};
  12445. function getDefaultDisplay( elem ) {
  12446. var temp,
  12447. doc = elem.ownerDocument,
  12448. nodeName = elem.nodeName,
  12449. display = defaultDisplayMap[ nodeName ];
  12450. if ( display ) {
  12451. return display;
  12452. }
  12453. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12454. display = jQuery.css( temp, "display" );
  12455. temp.parentNode.removeChild( temp );
  12456. if ( display === "none" ) {
  12457. display = "block";
  12458. }
  12459. defaultDisplayMap[ nodeName ] = display;
  12460. return display;
  12461. }
  12462. function showHide( elements, show ) {
  12463. var display, elem,
  12464. values = [],
  12465. index = 0,
  12466. length = elements.length;
  12467. // Determine new display value for elements that need to change
  12468. for ( ; index < length; index++ ) {
  12469. elem = elements[ index ];
  12470. if ( !elem.style ) {
  12471. continue;
  12472. }
  12473. display = elem.style.display;
  12474. if ( show ) {
  12475. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12476. // check is required in this first loop unless we have a nonempty display value (either
  12477. // inline or about-to-be-restored)
  12478. if ( display === "none" ) {
  12479. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12480. if ( !values[ index ] ) {
  12481. elem.style.display = "";
  12482. }
  12483. }
  12484. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12485. values[ index ] = getDefaultDisplay( elem );
  12486. }
  12487. } else {
  12488. if ( display !== "none" ) {
  12489. values[ index ] = "none";
  12490. // Remember what we're overwriting
  12491. dataPriv.set( elem, "display", display );
  12492. }
  12493. }
  12494. }
  12495. // Set the display of the elements in a second loop to avoid constant reflow
  12496. for ( index = 0; index < length; index++ ) {
  12497. if ( values[ index ] != null ) {
  12498. elements[ index ].style.display = values[ index ];
  12499. }
  12500. }
  12501. return elements;
  12502. }
  12503. jQuery.fn.extend( {
  12504. show: function() {
  12505. return showHide( this, true );
  12506. },
  12507. hide: function() {
  12508. return showHide( this );
  12509. },
  12510. toggle: function( state ) {
  12511. if ( typeof state === "boolean" ) {
  12512. return state ? this.show() : this.hide();
  12513. }
  12514. return this.each( function() {
  12515. if ( isHiddenWithinTree( this ) ) {
  12516. jQuery( this ).show();
  12517. } else {
  12518. jQuery( this ).hide();
  12519. }
  12520. } );
  12521. }
  12522. } );
  12523. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12524. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12525. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12526. // We have to close these tags to support XHTML (#13200)
  12527. var wrapMap = {
  12528. // Support: IE <=9 only
  12529. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12530. // XHTML parsers do not magically insert elements in the
  12531. // same way that tag soup parsers do. So we cannot shorten
  12532. // this by omitting <tbody> or other required elements.
  12533. thead: [ 1, "<table>", "</table>" ],
  12534. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12535. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12536. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12537. _default: [ 0, "", "" ]
  12538. };
  12539. // Support: IE <=9 only
  12540. wrapMap.optgroup = wrapMap.option;
  12541. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12542. wrapMap.th = wrapMap.td;
  12543. function getAll( context, tag ) {
  12544. // Support: IE <=9 - 11 only
  12545. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12546. var ret;
  12547. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12548. ret = context.getElementsByTagName( tag || "*" );
  12549. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12550. ret = context.querySelectorAll( tag || "*" );
  12551. } else {
  12552. ret = [];
  12553. }
  12554. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12555. return jQuery.merge( [ context ], ret );
  12556. }
  12557. return ret;
  12558. }
  12559. // Mark scripts as having already been evaluated
  12560. function setGlobalEval( elems, refElements ) {
  12561. var i = 0,
  12562. l = elems.length;
  12563. for ( ; i < l; i++ ) {
  12564. dataPriv.set(
  12565. elems[ i ],
  12566. "globalEval",
  12567. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12568. );
  12569. }
  12570. }
  12571. var rhtml = /<|&#?\w+;/;
  12572. function buildFragment( elems, context, scripts, selection, ignored ) {
  12573. var elem, tmp, tag, wrap, attached, j,
  12574. fragment = context.createDocumentFragment(),
  12575. nodes = [],
  12576. i = 0,
  12577. l = elems.length;
  12578. for ( ; i < l; i++ ) {
  12579. elem = elems[ i ];
  12580. if ( elem || elem === 0 ) {
  12581. // Add nodes directly
  12582. if ( toType( elem ) === "object" ) {
  12583. // Support: Android <=4.0 only, PhantomJS 1 only
  12584. // push.apply(_, arraylike) throws on ancient WebKit
  12585. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12586. // Convert non-html into a text node
  12587. } else if ( !rhtml.test( elem ) ) {
  12588. nodes.push( context.createTextNode( elem ) );
  12589. // Convert html into DOM nodes
  12590. } else {
  12591. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12592. // Deserialize a standard representation
  12593. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12594. wrap = wrapMap[ tag ] || wrapMap._default;
  12595. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12596. // Descend through wrappers to the right content
  12597. j = wrap[ 0 ];
  12598. while ( j-- ) {
  12599. tmp = tmp.lastChild;
  12600. }
  12601. // Support: Android <=4.0 only, PhantomJS 1 only
  12602. // push.apply(_, arraylike) throws on ancient WebKit
  12603. jQuery.merge( nodes, tmp.childNodes );
  12604. // Remember the top-level container
  12605. tmp = fragment.firstChild;
  12606. // Ensure the created nodes are orphaned (#12392)
  12607. tmp.textContent = "";
  12608. }
  12609. }
  12610. }
  12611. // Remove wrapper from fragment
  12612. fragment.textContent = "";
  12613. i = 0;
  12614. while ( ( elem = nodes[ i++ ] ) ) {
  12615. // Skip elements already in the context collection (trac-4087)
  12616. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12617. if ( ignored ) {
  12618. ignored.push( elem );
  12619. }
  12620. continue;
  12621. }
  12622. attached = isAttached( elem );
  12623. // Append to fragment
  12624. tmp = getAll( fragment.appendChild( elem ), "script" );
  12625. // Preserve script evaluation history
  12626. if ( attached ) {
  12627. setGlobalEval( tmp );
  12628. }
  12629. // Capture executables
  12630. if ( scripts ) {
  12631. j = 0;
  12632. while ( ( elem = tmp[ j++ ] ) ) {
  12633. if ( rscriptType.test( elem.type || "" ) ) {
  12634. scripts.push( elem );
  12635. }
  12636. }
  12637. }
  12638. }
  12639. return fragment;
  12640. }
  12641. ( function() {
  12642. var fragment = document.createDocumentFragment(),
  12643. div = fragment.appendChild( document.createElement( "div" ) ),
  12644. input = document.createElement( "input" );
  12645. // Support: Android 4.0 - 4.3 only
  12646. // Check state lost if the name is set (#11217)
  12647. // Support: Windows Web Apps (WWA)
  12648. // `name` and `type` must use .setAttribute for WWA (#14901)
  12649. input.setAttribute( "type", "radio" );
  12650. input.setAttribute( "checked", "checked" );
  12651. input.setAttribute( "name", "t" );
  12652. div.appendChild( input );
  12653. // Support: Android <=4.1 only
  12654. // Older WebKit doesn't clone checked state correctly in fragments
  12655. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12656. // Support: IE <=11 only
  12657. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12658. div.innerHTML = "<textarea>x</textarea>";
  12659. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12660. } )();
  12661. var
  12662. rkeyEvent = /^key/,
  12663. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12664. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12665. function returnTrue() {
  12666. return true;
  12667. }
  12668. function returnFalse() {
  12669. return false;
  12670. }
  12671. // Support: IE <=9 - 11+
  12672. // focus() and blur() are asynchronous, except when they are no-op.
  12673. // So expect focus to be synchronous when the element is already active,
  12674. // and blur to be synchronous when the element is not already active.
  12675. // (focus and blur are always synchronous in other supported browsers,
  12676. // this just defines when we can count on it).
  12677. function expectSync( elem, type ) {
  12678. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12679. }
  12680. // Support: IE <=9 only
  12681. // Accessing document.activeElement can throw unexpectedly
  12682. // https://bugs.jquery.com/ticket/13393
  12683. function safeActiveElement() {
  12684. try {
  12685. return document.activeElement;
  12686. } catch ( err ) { }
  12687. }
  12688. function on( elem, types, selector, data, fn, one ) {
  12689. var origFn, type;
  12690. // Types can be a map of types/handlers
  12691. if ( typeof types === "object" ) {
  12692. // ( types-Object, selector, data )
  12693. if ( typeof selector !== "string" ) {
  12694. // ( types-Object, data )
  12695. data = data || selector;
  12696. selector = undefined;
  12697. }
  12698. for ( type in types ) {
  12699. on( elem, type, selector, data, types[ type ], one );
  12700. }
  12701. return elem;
  12702. }
  12703. if ( data == null && fn == null ) {
  12704. // ( types, fn )
  12705. fn = selector;
  12706. data = selector = undefined;
  12707. } else if ( fn == null ) {
  12708. if ( typeof selector === "string" ) {
  12709. // ( types, selector, fn )
  12710. fn = data;
  12711. data = undefined;
  12712. } else {
  12713. // ( types, data, fn )
  12714. fn = data;
  12715. data = selector;
  12716. selector = undefined;
  12717. }
  12718. }
  12719. if ( fn === false ) {
  12720. fn = returnFalse;
  12721. } else if ( !fn ) {
  12722. return elem;
  12723. }
  12724. if ( one === 1 ) {
  12725. origFn = fn;
  12726. fn = function( event ) {
  12727. // Can use an empty set, since event contains the info
  12728. jQuery().off( event );
  12729. return origFn.apply( this, arguments );
  12730. };
  12731. // Use same guid so caller can remove using origFn
  12732. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12733. }
  12734. return elem.each( function() {
  12735. jQuery.event.add( this, types, fn, data, selector );
  12736. } );
  12737. }
  12738. /*
  12739. * Helper functions for managing events -- not part of the public interface.
  12740. * Props to Dean Edwards' addEvent library for many of the ideas.
  12741. */
  12742. jQuery.event = {
  12743. global: {},
  12744. add: function( elem, types, handler, data, selector ) {
  12745. var handleObjIn, eventHandle, tmp,
  12746. events, t, handleObj,
  12747. special, handlers, type, namespaces, origType,
  12748. elemData = dataPriv.get( elem );
  12749. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12750. if ( !elemData ) {
  12751. return;
  12752. }
  12753. // Caller can pass in an object of custom data in lieu of the handler
  12754. if ( handler.handler ) {
  12755. handleObjIn = handler;
  12756. handler = handleObjIn.handler;
  12757. selector = handleObjIn.selector;
  12758. }
  12759. // Ensure that invalid selectors throw exceptions at attach time
  12760. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12761. if ( selector ) {
  12762. jQuery.find.matchesSelector( documentElement, selector );
  12763. }
  12764. // Make sure that the handler has a unique ID, used to find/remove it later
  12765. if ( !handler.guid ) {
  12766. handler.guid = jQuery.guid++;
  12767. }
  12768. // Init the element's event structure and main handler, if this is the first
  12769. if ( !( events = elemData.events ) ) {
  12770. events = elemData.events = {};
  12771. }
  12772. if ( !( eventHandle = elemData.handle ) ) {
  12773. eventHandle = elemData.handle = function( e ) {
  12774. // Discard the second event of a jQuery.event.trigger() and
  12775. // when an event is called after a page has unloaded
  12776. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12777. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12778. };
  12779. }
  12780. // Handle multiple events separated by a space
  12781. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12782. t = types.length;
  12783. while ( t-- ) {
  12784. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12785. type = origType = tmp[ 1 ];
  12786. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12787. // There *must* be a type, no attaching namespace-only handlers
  12788. if ( !type ) {
  12789. continue;
  12790. }
  12791. // If event changes its type, use the special event handlers for the changed type
  12792. special = jQuery.event.special[ type ] || {};
  12793. // If selector defined, determine special event api type, otherwise given type
  12794. type = ( selector ? special.delegateType : special.bindType ) || type;
  12795. // Update special based on newly reset type
  12796. special = jQuery.event.special[ type ] || {};
  12797. // handleObj is passed to all event handlers
  12798. handleObj = jQuery.extend( {
  12799. type: type,
  12800. origType: origType,
  12801. data: data,
  12802. handler: handler,
  12803. guid: handler.guid,
  12804. selector: selector,
  12805. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12806. namespace: namespaces.join( "." )
  12807. }, handleObjIn );
  12808. // Init the event handler queue if we're the first
  12809. if ( !( handlers = events[ type ] ) ) {
  12810. handlers = events[ type ] = [];
  12811. handlers.delegateCount = 0;
  12812. // Only use addEventListener if the special events handler returns false
  12813. if ( !special.setup ||
  12814. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12815. if ( elem.addEventListener ) {
  12816. elem.addEventListener( type, eventHandle );
  12817. }
  12818. }
  12819. }
  12820. if ( special.add ) {
  12821. special.add.call( elem, handleObj );
  12822. if ( !handleObj.handler.guid ) {
  12823. handleObj.handler.guid = handler.guid;
  12824. }
  12825. }
  12826. // Add to the element's handler list, delegates in front
  12827. if ( selector ) {
  12828. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12829. } else {
  12830. handlers.push( handleObj );
  12831. }
  12832. // Keep track of which events have ever been used, for event optimization
  12833. jQuery.event.global[ type ] = true;
  12834. }
  12835. },
  12836. // Detach an event or set of events from an element
  12837. remove: function( elem, types, handler, selector, mappedTypes ) {
  12838. var j, origCount, tmp,
  12839. events, t, handleObj,
  12840. special, handlers, type, namespaces, origType,
  12841. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12842. if ( !elemData || !( events = elemData.events ) ) {
  12843. return;
  12844. }
  12845. // Once for each type.namespace in types; type may be omitted
  12846. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12847. t = types.length;
  12848. while ( t-- ) {
  12849. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12850. type = origType = tmp[ 1 ];
  12851. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12852. // Unbind all events (on this namespace, if provided) for the element
  12853. if ( !type ) {
  12854. for ( type in events ) {
  12855. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12856. }
  12857. continue;
  12858. }
  12859. special = jQuery.event.special[ type ] || {};
  12860. type = ( selector ? special.delegateType : special.bindType ) || type;
  12861. handlers = events[ type ] || [];
  12862. tmp = tmp[ 2 ] &&
  12863. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12864. // Remove matching events
  12865. origCount = j = handlers.length;
  12866. while ( j-- ) {
  12867. handleObj = handlers[ j ];
  12868. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12869. ( !handler || handler.guid === handleObj.guid ) &&
  12870. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12871. ( !selector || selector === handleObj.selector ||
  12872. selector === "**" && handleObj.selector ) ) {
  12873. handlers.splice( j, 1 );
  12874. if ( handleObj.selector ) {
  12875. handlers.delegateCount--;
  12876. }
  12877. if ( special.remove ) {
  12878. special.remove.call( elem, handleObj );
  12879. }
  12880. }
  12881. }
  12882. // Remove generic event handler if we removed something and no more handlers exist
  12883. // (avoids potential for endless recursion during removal of special event handlers)
  12884. if ( origCount && !handlers.length ) {
  12885. if ( !special.teardown ||
  12886. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12887. jQuery.removeEvent( elem, type, elemData.handle );
  12888. }
  12889. delete events[ type ];
  12890. }
  12891. }
  12892. // Remove data and the expando if it's no longer used
  12893. if ( jQuery.isEmptyObject( events ) ) {
  12894. dataPriv.remove( elem, "handle events" );
  12895. }
  12896. },
  12897. dispatch: function( nativeEvent ) {
  12898. // Make a writable jQuery.Event from the native event object
  12899. var event = jQuery.event.fix( nativeEvent );
  12900. var i, j, ret, matched, handleObj, handlerQueue,
  12901. args = new Array( arguments.length ),
  12902. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12903. special = jQuery.event.special[ event.type ] || {};
  12904. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12905. args[ 0 ] = event;
  12906. for ( i = 1; i < arguments.length; i++ ) {
  12907. args[ i ] = arguments[ i ];
  12908. }
  12909. event.delegateTarget = this;
  12910. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12911. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12912. return;
  12913. }
  12914. // Determine handlers
  12915. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12916. // Run delegates first; they may want to stop propagation beneath us
  12917. i = 0;
  12918. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12919. event.currentTarget = matched.elem;
  12920. j = 0;
  12921. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12922. !event.isImmediatePropagationStopped() ) {
  12923. // If the event is namespaced, then each handler is only invoked if it is
  12924. // specially universal or its namespaces are a superset of the event's.
  12925. if ( !event.rnamespace || handleObj.namespace === false ||
  12926. event.rnamespace.test( handleObj.namespace ) ) {
  12927. event.handleObj = handleObj;
  12928. event.data = handleObj.data;
  12929. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12930. handleObj.handler ).apply( matched.elem, args );
  12931. if ( ret !== undefined ) {
  12932. if ( ( event.result = ret ) === false ) {
  12933. event.preventDefault();
  12934. event.stopPropagation();
  12935. }
  12936. }
  12937. }
  12938. }
  12939. }
  12940. // Call the postDispatch hook for the mapped type
  12941. if ( special.postDispatch ) {
  12942. special.postDispatch.call( this, event );
  12943. }
  12944. return event.result;
  12945. },
  12946. handlers: function( event, handlers ) {
  12947. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12948. handlerQueue = [],
  12949. delegateCount = handlers.delegateCount,
  12950. cur = event.target;
  12951. // Find delegate handlers
  12952. if ( delegateCount &&
  12953. // Support: IE <=9
  12954. // Black-hole SVG <use> instance trees (trac-13180)
  12955. cur.nodeType &&
  12956. // Support: Firefox <=42
  12957. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12958. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12959. // Support: IE 11 only
  12960. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12961. !( event.type === "click" && event.button >= 1 ) ) {
  12962. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12963. // Don't check non-elements (#13208)
  12964. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12965. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12966. matchedHandlers = [];
  12967. matchedSelectors = {};
  12968. for ( i = 0; i < delegateCount; i++ ) {
  12969. handleObj = handlers[ i ];
  12970. // Don't conflict with Object.prototype properties (#13203)
  12971. sel = handleObj.selector + " ";
  12972. if ( matchedSelectors[ sel ] === undefined ) {
  12973. matchedSelectors[ sel ] = handleObj.needsContext ?
  12974. jQuery( sel, this ).index( cur ) > -1 :
  12975. jQuery.find( sel, this, null, [ cur ] ).length;
  12976. }
  12977. if ( matchedSelectors[ sel ] ) {
  12978. matchedHandlers.push( handleObj );
  12979. }
  12980. }
  12981. if ( matchedHandlers.length ) {
  12982. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12983. }
  12984. }
  12985. }
  12986. }
  12987. // Add the remaining (directly-bound) handlers
  12988. cur = this;
  12989. if ( delegateCount < handlers.length ) {
  12990. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12991. }
  12992. return handlerQueue;
  12993. },
  12994. addProp: function( name, hook ) {
  12995. Object.defineProperty( jQuery.Event.prototype, name, {
  12996. enumerable: true,
  12997. configurable: true,
  12998. get: isFunction( hook ) ?
  12999. function() {
  13000. if ( this.originalEvent ) {
  13001. return hook( this.originalEvent );
  13002. }
  13003. } :
  13004. function() {
  13005. if ( this.originalEvent ) {
  13006. return this.originalEvent[ name ];
  13007. }
  13008. },
  13009. set: function( value ) {
  13010. Object.defineProperty( this, name, {
  13011. enumerable: true,
  13012. configurable: true,
  13013. writable: true,
  13014. value: value
  13015. } );
  13016. }
  13017. } );
  13018. },
  13019. fix: function( originalEvent ) {
  13020. return originalEvent[ jQuery.expando ] ?
  13021. originalEvent :
  13022. new jQuery.Event( originalEvent );
  13023. },
  13024. special: {
  13025. load: {
  13026. // Prevent triggered image.load events from bubbling to window.load
  13027. noBubble: true
  13028. },
  13029. click: {
  13030. // Utilize native event to ensure correct state for checkable inputs
  13031. setup: function( data ) {
  13032. // For mutual compressibility with _default, replace `this` access with a local var.
  13033. // `|| data` is dead code meant only to preserve the variable through minification.
  13034. var el = this || data;
  13035. // Claim the first handler
  13036. if ( rcheckableType.test( el.type ) &&
  13037. el.click && nodeName( el, "input" ) ) {
  13038. // dataPriv.set( el, "click", ... )
  13039. leverageNative( el, "click", returnTrue );
  13040. }
  13041. // Return false to allow normal processing in the caller
  13042. return false;
  13043. },
  13044. trigger: function( data ) {
  13045. // For mutual compressibility with _default, replace `this` access with a local var.
  13046. // `|| data` is dead code meant only to preserve the variable through minification.
  13047. var el = this || data;
  13048. // Force setup before triggering a click
  13049. if ( rcheckableType.test( el.type ) &&
  13050. el.click && nodeName( el, "input" ) ) {
  13051. leverageNative( el, "click" );
  13052. }
  13053. // Return non-false to allow normal event-path propagation
  13054. return true;
  13055. },
  13056. // For cross-browser consistency, suppress native .click() on links
  13057. // Also prevent it if we're currently inside a leveraged native-event stack
  13058. _default: function( event ) {
  13059. var target = event.target;
  13060. return rcheckableType.test( target.type ) &&
  13061. target.click && nodeName( target, "input" ) &&
  13062. dataPriv.get( target, "click" ) ||
  13063. nodeName( target, "a" );
  13064. }
  13065. },
  13066. beforeunload: {
  13067. postDispatch: function( event ) {
  13068. // Support: Firefox 20+
  13069. // Firefox doesn't alert if the returnValue field is not set.
  13070. if ( event.result !== undefined && event.originalEvent ) {
  13071. event.originalEvent.returnValue = event.result;
  13072. }
  13073. }
  13074. }
  13075. }
  13076. };
  13077. // Ensure the presence of an event listener that handles manually-triggered
  13078. // synthetic events by interrupting progress until reinvoked in response to
  13079. // *native* events that it fires directly, ensuring that state changes have
  13080. // already occurred before other listeners are invoked.
  13081. function leverageNative( el, type, expectSync ) {
  13082. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13083. if ( !expectSync ) {
  13084. if ( dataPriv.get( el, type ) === undefined ) {
  13085. jQuery.event.add( el, type, returnTrue );
  13086. }
  13087. return;
  13088. }
  13089. // Register the controller as a special universal handler for all event namespaces
  13090. dataPriv.set( el, type, false );
  13091. jQuery.event.add( el, type, {
  13092. namespace: false,
  13093. handler: function( event ) {
  13094. var notAsync, result,
  13095. saved = dataPriv.get( this, type );
  13096. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13097. // Interrupt processing of the outer synthetic .trigger()ed event
  13098. // Saved data should be false in such cases, but might be a leftover capture object
  13099. // from an async native handler (gh-4350)
  13100. if ( !saved.length ) {
  13101. // Store arguments for use when handling the inner native event
  13102. // There will always be at least one argument (an event object), so this array
  13103. // will not be confused with a leftover capture object.
  13104. saved = slice.call( arguments );
  13105. dataPriv.set( this, type, saved );
  13106. // Trigger the native event and capture its result
  13107. // Support: IE <=9 - 11+
  13108. // focus() and blur() are asynchronous
  13109. notAsync = expectSync( this, type );
  13110. this[ type ]();
  13111. result = dataPriv.get( this, type );
  13112. if ( saved !== result || notAsync ) {
  13113. dataPriv.set( this, type, false );
  13114. } else {
  13115. result = {};
  13116. }
  13117. if ( saved !== result ) {
  13118. // Cancel the outer synthetic event
  13119. event.stopImmediatePropagation();
  13120. event.preventDefault();
  13121. return result.value;
  13122. }
  13123. // If this is an inner synthetic event for an event with a bubbling surrogate
  13124. // (focus or blur), assume that the surrogate already propagated from triggering the
  13125. // native event and prevent that from happening again here.
  13126. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13127. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13128. // less bad than duplication.
  13129. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13130. event.stopPropagation();
  13131. }
  13132. // If this is a native event triggered above, everything is now in order
  13133. // Fire an inner synthetic event with the original arguments
  13134. } else if ( saved.length ) {
  13135. // ...and capture the result
  13136. dataPriv.set( this, type, {
  13137. value: jQuery.event.trigger(
  13138. // Support: IE <=9 - 11+
  13139. // Extend with the prototype to reset the above stopImmediatePropagation()
  13140. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13141. saved.slice( 1 ),
  13142. this
  13143. )
  13144. } );
  13145. // Abort handling of the native event
  13146. event.stopImmediatePropagation();
  13147. }
  13148. }
  13149. } );
  13150. }
  13151. jQuery.removeEvent = function( elem, type, handle ) {
  13152. // This "if" is needed for plain objects
  13153. if ( elem.removeEventListener ) {
  13154. elem.removeEventListener( type, handle );
  13155. }
  13156. };
  13157. jQuery.Event = function( src, props ) {
  13158. // Allow instantiation without the 'new' keyword
  13159. if ( !( this instanceof jQuery.Event ) ) {
  13160. return new jQuery.Event( src, props );
  13161. }
  13162. // Event object
  13163. if ( src && src.type ) {
  13164. this.originalEvent = src;
  13165. this.type = src.type;
  13166. // Events bubbling up the document may have been marked as prevented
  13167. // by a handler lower down the tree; reflect the correct value.
  13168. this.isDefaultPrevented = src.defaultPrevented ||
  13169. src.defaultPrevented === undefined &&
  13170. // Support: Android <=2.3 only
  13171. src.returnValue === false ?
  13172. returnTrue :
  13173. returnFalse;
  13174. // Create target properties
  13175. // Support: Safari <=6 - 7 only
  13176. // Target should not be a text node (#504, #13143)
  13177. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13178. src.target.parentNode :
  13179. src.target;
  13180. this.currentTarget = src.currentTarget;
  13181. this.relatedTarget = src.relatedTarget;
  13182. // Event type
  13183. } else {
  13184. this.type = src;
  13185. }
  13186. // Put explicitly provided properties onto the event object
  13187. if ( props ) {
  13188. jQuery.extend( this, props );
  13189. }
  13190. // Create a timestamp if incoming event doesn't have one
  13191. this.timeStamp = src && src.timeStamp || Date.now();
  13192. // Mark it as fixed
  13193. this[ jQuery.expando ] = true;
  13194. };
  13195. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13196. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13197. jQuery.Event.prototype = {
  13198. constructor: jQuery.Event,
  13199. isDefaultPrevented: returnFalse,
  13200. isPropagationStopped: returnFalse,
  13201. isImmediatePropagationStopped: returnFalse,
  13202. isSimulated: false,
  13203. preventDefault: function() {
  13204. var e = this.originalEvent;
  13205. this.isDefaultPrevented = returnTrue;
  13206. if ( e && !this.isSimulated ) {
  13207. e.preventDefault();
  13208. }
  13209. },
  13210. stopPropagation: function() {
  13211. var e = this.originalEvent;
  13212. this.isPropagationStopped = returnTrue;
  13213. if ( e && !this.isSimulated ) {
  13214. e.stopPropagation();
  13215. }
  13216. },
  13217. stopImmediatePropagation: function() {
  13218. var e = this.originalEvent;
  13219. this.isImmediatePropagationStopped = returnTrue;
  13220. if ( e && !this.isSimulated ) {
  13221. e.stopImmediatePropagation();
  13222. }
  13223. this.stopPropagation();
  13224. }
  13225. };
  13226. // Includes all common event props including KeyEvent and MouseEvent specific props
  13227. jQuery.each( {
  13228. altKey: true,
  13229. bubbles: true,
  13230. cancelable: true,
  13231. changedTouches: true,
  13232. ctrlKey: true,
  13233. detail: true,
  13234. eventPhase: true,
  13235. metaKey: true,
  13236. pageX: true,
  13237. pageY: true,
  13238. shiftKey: true,
  13239. view: true,
  13240. "char": true,
  13241. code: true,
  13242. charCode: true,
  13243. key: true,
  13244. keyCode: true,
  13245. button: true,
  13246. buttons: true,
  13247. clientX: true,
  13248. clientY: true,
  13249. offsetX: true,
  13250. offsetY: true,
  13251. pointerId: true,
  13252. pointerType: true,
  13253. screenX: true,
  13254. screenY: true,
  13255. targetTouches: true,
  13256. toElement: true,
  13257. touches: true,
  13258. which: function( event ) {
  13259. var button = event.button;
  13260. // Add which for key events
  13261. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13262. return event.charCode != null ? event.charCode : event.keyCode;
  13263. }
  13264. // Add which for click: 1 === left; 2 === middle; 3 === right
  13265. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13266. if ( button & 1 ) {
  13267. return 1;
  13268. }
  13269. if ( button & 2 ) {
  13270. return 3;
  13271. }
  13272. if ( button & 4 ) {
  13273. return 2;
  13274. }
  13275. return 0;
  13276. }
  13277. return event.which;
  13278. }
  13279. }, jQuery.event.addProp );
  13280. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13281. jQuery.event.special[ type ] = {
  13282. // Utilize native event if possible so blur/focus sequence is correct
  13283. setup: function() {
  13284. // Claim the first handler
  13285. // dataPriv.set( this, "focus", ... )
  13286. // dataPriv.set( this, "blur", ... )
  13287. leverageNative( this, type, expectSync );
  13288. // Return false to allow normal processing in the caller
  13289. return false;
  13290. },
  13291. trigger: function() {
  13292. // Force setup before trigger
  13293. leverageNative( this, type );
  13294. // Return non-false to allow normal event-path propagation
  13295. return true;
  13296. },
  13297. delegateType: delegateType
  13298. };
  13299. } );
  13300. // Create mouseenter/leave events using mouseover/out and event-time checks
  13301. // so that event delegation works in jQuery.
  13302. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13303. //
  13304. // Support: Safari 7 only
  13305. // Safari sends mouseenter too often; see:
  13306. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13307. // for the description of the bug (it existed in older Chrome versions as well).
  13308. jQuery.each( {
  13309. mouseenter: "mouseover",
  13310. mouseleave: "mouseout",
  13311. pointerenter: "pointerover",
  13312. pointerleave: "pointerout"
  13313. }, function( orig, fix ) {
  13314. jQuery.event.special[ orig ] = {
  13315. delegateType: fix,
  13316. bindType: fix,
  13317. handle: function( event ) {
  13318. var ret,
  13319. target = this,
  13320. related = event.relatedTarget,
  13321. handleObj = event.handleObj;
  13322. // For mouseenter/leave call the handler if related is outside the target.
  13323. // NB: No relatedTarget if the mouse left/entered the browser window
  13324. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13325. event.type = handleObj.origType;
  13326. ret = handleObj.handler.apply( this, arguments );
  13327. event.type = fix;
  13328. }
  13329. return ret;
  13330. }
  13331. };
  13332. } );
  13333. jQuery.fn.extend( {
  13334. on: function( types, selector, data, fn ) {
  13335. return on( this, types, selector, data, fn );
  13336. },
  13337. one: function( types, selector, data, fn ) {
  13338. return on( this, types, selector, data, fn, 1 );
  13339. },
  13340. off: function( types, selector, fn ) {
  13341. var handleObj, type;
  13342. if ( types && types.preventDefault && types.handleObj ) {
  13343. // ( event ) dispatched jQuery.Event
  13344. handleObj = types.handleObj;
  13345. jQuery( types.delegateTarget ).off(
  13346. handleObj.namespace ?
  13347. handleObj.origType + "." + handleObj.namespace :
  13348. handleObj.origType,
  13349. handleObj.selector,
  13350. handleObj.handler
  13351. );
  13352. return this;
  13353. }
  13354. if ( typeof types === "object" ) {
  13355. // ( types-object [, selector] )
  13356. for ( type in types ) {
  13357. this.off( type, selector, types[ type ] );
  13358. }
  13359. return this;
  13360. }
  13361. if ( selector === false || typeof selector === "function" ) {
  13362. // ( types [, fn] )
  13363. fn = selector;
  13364. selector = undefined;
  13365. }
  13366. if ( fn === false ) {
  13367. fn = returnFalse;
  13368. }
  13369. return this.each( function() {
  13370. jQuery.event.remove( this, types, fn, selector );
  13371. } );
  13372. }
  13373. } );
  13374. var
  13375. /* eslint-disable max-len */
  13376. // See https://github.com/eslint/eslint/issues/3229
  13377. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13378. /* eslint-enable */
  13379. // Support: IE <=10 - 11, Edge 12 - 13 only
  13380. // In IE/Edge using regex groups here causes severe slowdowns.
  13381. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13382. rnoInnerhtml = /<script|<style|<link/i,
  13383. // checked="checked" or checked
  13384. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13385. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13386. // Prefer a tbody over its parent table for containing new rows
  13387. function manipulationTarget( elem, content ) {
  13388. if ( nodeName( elem, "table" ) &&
  13389. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13390. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13391. }
  13392. return elem;
  13393. }
  13394. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13395. function disableScript( elem ) {
  13396. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13397. return elem;
  13398. }
  13399. function restoreScript( elem ) {
  13400. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13401. elem.type = elem.type.slice( 5 );
  13402. } else {
  13403. elem.removeAttribute( "type" );
  13404. }
  13405. return elem;
  13406. }
  13407. function cloneCopyEvent( src, dest ) {
  13408. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13409. if ( dest.nodeType !== 1 ) {
  13410. return;
  13411. }
  13412. // 1. Copy private data: events, handlers, etc.
  13413. if ( dataPriv.hasData( src ) ) {
  13414. pdataOld = dataPriv.access( src );
  13415. pdataCur = dataPriv.set( dest, pdataOld );
  13416. events = pdataOld.events;
  13417. if ( events ) {
  13418. delete pdataCur.handle;
  13419. pdataCur.events = {};
  13420. for ( type in events ) {
  13421. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13422. jQuery.event.add( dest, type, events[ type ][ i ] );
  13423. }
  13424. }
  13425. }
  13426. }
  13427. // 2. Copy user data
  13428. if ( dataUser.hasData( src ) ) {
  13429. udataOld = dataUser.access( src );
  13430. udataCur = jQuery.extend( {}, udataOld );
  13431. dataUser.set( dest, udataCur );
  13432. }
  13433. }
  13434. // Fix IE bugs, see support tests
  13435. function fixInput( src, dest ) {
  13436. var nodeName = dest.nodeName.toLowerCase();
  13437. // Fails to persist the checked state of a cloned checkbox or radio button.
  13438. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13439. dest.checked = src.checked;
  13440. // Fails to return the selected option to the default selected state when cloning options
  13441. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13442. dest.defaultValue = src.defaultValue;
  13443. }
  13444. }
  13445. function domManip( collection, args, callback, ignored ) {
  13446. // Flatten any nested arrays
  13447. args = concat.apply( [], args );
  13448. var fragment, first, scripts, hasScripts, node, doc,
  13449. i = 0,
  13450. l = collection.length,
  13451. iNoClone = l - 1,
  13452. value = args[ 0 ],
  13453. valueIsFunction = isFunction( value );
  13454. // We can't cloneNode fragments that contain checked, in WebKit
  13455. if ( valueIsFunction ||
  13456. ( l > 1 && typeof value === "string" &&
  13457. !support.checkClone && rchecked.test( value ) ) ) {
  13458. return collection.each( function( index ) {
  13459. var self = collection.eq( index );
  13460. if ( valueIsFunction ) {
  13461. args[ 0 ] = value.call( this, index, self.html() );
  13462. }
  13463. domManip( self, args, callback, ignored );
  13464. } );
  13465. }
  13466. if ( l ) {
  13467. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13468. first = fragment.firstChild;
  13469. if ( fragment.childNodes.length === 1 ) {
  13470. fragment = first;
  13471. }
  13472. // Require either new content or an interest in ignored elements to invoke the callback
  13473. if ( first || ignored ) {
  13474. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13475. hasScripts = scripts.length;
  13476. // Use the original fragment for the last item
  13477. // instead of the first because it can end up
  13478. // being emptied incorrectly in certain situations (#8070).
  13479. for ( ; i < l; i++ ) {
  13480. node = fragment;
  13481. if ( i !== iNoClone ) {
  13482. node = jQuery.clone( node, true, true );
  13483. // Keep references to cloned scripts for later restoration
  13484. if ( hasScripts ) {
  13485. // Support: Android <=4.0 only, PhantomJS 1 only
  13486. // push.apply(_, arraylike) throws on ancient WebKit
  13487. jQuery.merge( scripts, getAll( node, "script" ) );
  13488. }
  13489. }
  13490. callback.call( collection[ i ], node, i );
  13491. }
  13492. if ( hasScripts ) {
  13493. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13494. // Reenable scripts
  13495. jQuery.map( scripts, restoreScript );
  13496. // Evaluate executable scripts on first document insertion
  13497. for ( i = 0; i < hasScripts; i++ ) {
  13498. node = scripts[ i ];
  13499. if ( rscriptType.test( node.type || "" ) &&
  13500. !dataPriv.access( node, "globalEval" ) &&
  13501. jQuery.contains( doc, node ) ) {
  13502. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13503. // Optional AJAX dependency, but won't run scripts if not present
  13504. if ( jQuery._evalUrl && !node.noModule ) {
  13505. jQuery._evalUrl( node.src, {
  13506. nonce: node.nonce || node.getAttribute( "nonce" )
  13507. } );
  13508. }
  13509. } else {
  13510. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13511. }
  13512. }
  13513. }
  13514. }
  13515. }
  13516. }
  13517. return collection;
  13518. }
  13519. function remove( elem, selector, keepData ) {
  13520. var node,
  13521. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13522. i = 0;
  13523. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13524. if ( !keepData && node.nodeType === 1 ) {
  13525. jQuery.cleanData( getAll( node ) );
  13526. }
  13527. if ( node.parentNode ) {
  13528. if ( keepData && isAttached( node ) ) {
  13529. setGlobalEval( getAll( node, "script" ) );
  13530. }
  13531. node.parentNode.removeChild( node );
  13532. }
  13533. }
  13534. return elem;
  13535. }
  13536. jQuery.extend( {
  13537. htmlPrefilter: function( html ) {
  13538. return html.replace( rxhtmlTag, "<$1></$2>" );
  13539. },
  13540. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13541. var i, l, srcElements, destElements,
  13542. clone = elem.cloneNode( true ),
  13543. inPage = isAttached( elem );
  13544. // Fix IE cloning issues
  13545. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13546. !jQuery.isXMLDoc( elem ) ) {
  13547. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13548. destElements = getAll( clone );
  13549. srcElements = getAll( elem );
  13550. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13551. fixInput( srcElements[ i ], destElements[ i ] );
  13552. }
  13553. }
  13554. // Copy the events from the original to the clone
  13555. if ( dataAndEvents ) {
  13556. if ( deepDataAndEvents ) {
  13557. srcElements = srcElements || getAll( elem );
  13558. destElements = destElements || getAll( clone );
  13559. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13560. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13561. }
  13562. } else {
  13563. cloneCopyEvent( elem, clone );
  13564. }
  13565. }
  13566. // Preserve script evaluation history
  13567. destElements = getAll( clone, "script" );
  13568. if ( destElements.length > 0 ) {
  13569. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13570. }
  13571. // Return the cloned set
  13572. return clone;
  13573. },
  13574. cleanData: function( elems ) {
  13575. var data, elem, type,
  13576. special = jQuery.event.special,
  13577. i = 0;
  13578. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13579. if ( acceptData( elem ) ) {
  13580. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13581. if ( data.events ) {
  13582. for ( type in data.events ) {
  13583. if ( special[ type ] ) {
  13584. jQuery.event.remove( elem, type );
  13585. // This is a shortcut to avoid jQuery.event.remove's overhead
  13586. } else {
  13587. jQuery.removeEvent( elem, type, data.handle );
  13588. }
  13589. }
  13590. }
  13591. // Support: Chrome <=35 - 45+
  13592. // Assign undefined instead of using delete, see Data#remove
  13593. elem[ dataPriv.expando ] = undefined;
  13594. }
  13595. if ( elem[ dataUser.expando ] ) {
  13596. // Support: Chrome <=35 - 45+
  13597. // Assign undefined instead of using delete, see Data#remove
  13598. elem[ dataUser.expando ] = undefined;
  13599. }
  13600. }
  13601. }
  13602. }
  13603. } );
  13604. jQuery.fn.extend( {
  13605. detach: function( selector ) {
  13606. return remove( this, selector, true );
  13607. },
  13608. remove: function( selector ) {
  13609. return remove( this, selector );
  13610. },
  13611. text: function( value ) {
  13612. return access( this, function( value ) {
  13613. return value === undefined ?
  13614. jQuery.text( this ) :
  13615. this.empty().each( function() {
  13616. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13617. this.textContent = value;
  13618. }
  13619. } );
  13620. }, null, value, arguments.length );
  13621. },
  13622. append: function() {
  13623. return domManip( this, arguments, function( elem ) {
  13624. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13625. var target = manipulationTarget( this, elem );
  13626. target.appendChild( elem );
  13627. }
  13628. } );
  13629. },
  13630. prepend: function() {
  13631. return domManip( this, arguments, function( elem ) {
  13632. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13633. var target = manipulationTarget( this, elem );
  13634. target.insertBefore( elem, target.firstChild );
  13635. }
  13636. } );
  13637. },
  13638. before: function() {
  13639. return domManip( this, arguments, function( elem ) {
  13640. if ( this.parentNode ) {
  13641. this.parentNode.insertBefore( elem, this );
  13642. }
  13643. } );
  13644. },
  13645. after: function() {
  13646. return domManip( this, arguments, function( elem ) {
  13647. if ( this.parentNode ) {
  13648. this.parentNode.insertBefore( elem, this.nextSibling );
  13649. }
  13650. } );
  13651. },
  13652. empty: function() {
  13653. var elem,
  13654. i = 0;
  13655. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13656. if ( elem.nodeType === 1 ) {
  13657. // Prevent memory leaks
  13658. jQuery.cleanData( getAll( elem, false ) );
  13659. // Remove any remaining nodes
  13660. elem.textContent = "";
  13661. }
  13662. }
  13663. return this;
  13664. },
  13665. clone: function( dataAndEvents, deepDataAndEvents ) {
  13666. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13667. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13668. return this.map( function() {
  13669. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13670. } );
  13671. },
  13672. html: function( value ) {
  13673. return access( this, function( value ) {
  13674. var elem = this[ 0 ] || {},
  13675. i = 0,
  13676. l = this.length;
  13677. if ( value === undefined && elem.nodeType === 1 ) {
  13678. return elem.innerHTML;
  13679. }
  13680. // See if we can take a shortcut and just use innerHTML
  13681. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13682. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13683. value = jQuery.htmlPrefilter( value );
  13684. try {
  13685. for ( ; i < l; i++ ) {
  13686. elem = this[ i ] || {};
  13687. // Remove element nodes and prevent memory leaks
  13688. if ( elem.nodeType === 1 ) {
  13689. jQuery.cleanData( getAll( elem, false ) );
  13690. elem.innerHTML = value;
  13691. }
  13692. }
  13693. elem = 0;
  13694. // If using innerHTML throws an exception, use the fallback method
  13695. } catch ( e ) {}
  13696. }
  13697. if ( elem ) {
  13698. this.empty().append( value );
  13699. }
  13700. }, null, value, arguments.length );
  13701. },
  13702. replaceWith: function() {
  13703. var ignored = [];
  13704. // Make the changes, replacing each non-ignored context element with the new content
  13705. return domManip( this, arguments, function( elem ) {
  13706. var parent = this.parentNode;
  13707. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13708. jQuery.cleanData( getAll( this ) );
  13709. if ( parent ) {
  13710. parent.replaceChild( elem, this );
  13711. }
  13712. }
  13713. // Force callback invocation
  13714. }, ignored );
  13715. }
  13716. } );
  13717. jQuery.each( {
  13718. appendTo: "append",
  13719. prependTo: "prepend",
  13720. insertBefore: "before",
  13721. insertAfter: "after",
  13722. replaceAll: "replaceWith"
  13723. }, function( name, original ) {
  13724. jQuery.fn[ name ] = function( selector ) {
  13725. var elems,
  13726. ret = [],
  13727. insert = jQuery( selector ),
  13728. last = insert.length - 1,
  13729. i = 0;
  13730. for ( ; i <= last; i++ ) {
  13731. elems = i === last ? this : this.clone( true );
  13732. jQuery( insert[ i ] )[ original ]( elems );
  13733. // Support: Android <=4.0 only, PhantomJS 1 only
  13734. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13735. push.apply( ret, elems.get() );
  13736. }
  13737. return this.pushStack( ret );
  13738. };
  13739. } );
  13740. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13741. var getStyles = function( elem ) {
  13742. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13743. // IE throws on elements created in popups
  13744. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13745. var view = elem.ownerDocument.defaultView;
  13746. if ( !view || !view.opener ) {
  13747. view = window;
  13748. }
  13749. return view.getComputedStyle( elem );
  13750. };
  13751. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13752. ( function() {
  13753. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13754. // so they're executed at the same time to save the second computation.
  13755. function computeStyleTests() {
  13756. // This is a singleton, we need to execute it only once
  13757. if ( !div ) {
  13758. return;
  13759. }
  13760. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13761. "margin-top:1px;padding:0;border:0";
  13762. div.style.cssText =
  13763. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13764. "margin:auto;border:1px;padding:1px;" +
  13765. "width:60%;top:1%";
  13766. documentElement.appendChild( container ).appendChild( div );
  13767. var divStyle = window.getComputedStyle( div );
  13768. pixelPositionVal = divStyle.top !== "1%";
  13769. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13770. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13771. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13772. // Some styles come back with percentage values, even though they shouldn't
  13773. div.style.right = "60%";
  13774. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13775. // Support: IE 9 - 11 only
  13776. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13777. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13778. // Support: IE 9 only
  13779. // Detect overflow:scroll screwiness (gh-3699)
  13780. // Support: Chrome <=64
  13781. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13782. div.style.position = "absolute";
  13783. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13784. documentElement.removeChild( container );
  13785. // Nullify the div so it wouldn't be stored in the memory and
  13786. // it will also be a sign that checks already performed
  13787. div = null;
  13788. }
  13789. function roundPixelMeasures( measure ) {
  13790. return Math.round( parseFloat( measure ) );
  13791. }
  13792. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13793. reliableMarginLeftVal,
  13794. container = document.createElement( "div" ),
  13795. div = document.createElement( "div" );
  13796. // Finish early in limited (non-browser) environments
  13797. if ( !div.style ) {
  13798. return;
  13799. }
  13800. // Support: IE <=9 - 11 only
  13801. // Style of cloned element affects source element cloned (#8908)
  13802. div.style.backgroundClip = "content-box";
  13803. div.cloneNode( true ).style.backgroundClip = "";
  13804. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13805. jQuery.extend( support, {
  13806. boxSizingReliable: function() {
  13807. computeStyleTests();
  13808. return boxSizingReliableVal;
  13809. },
  13810. pixelBoxStyles: function() {
  13811. computeStyleTests();
  13812. return pixelBoxStylesVal;
  13813. },
  13814. pixelPosition: function() {
  13815. computeStyleTests();
  13816. return pixelPositionVal;
  13817. },
  13818. reliableMarginLeft: function() {
  13819. computeStyleTests();
  13820. return reliableMarginLeftVal;
  13821. },
  13822. scrollboxSize: function() {
  13823. computeStyleTests();
  13824. return scrollboxSizeVal;
  13825. }
  13826. } );
  13827. } )();
  13828. function curCSS( elem, name, computed ) {
  13829. var width, minWidth, maxWidth, ret,
  13830. // Support: Firefox 51+
  13831. // Retrieving style before computed somehow
  13832. // fixes an issue with getting wrong values
  13833. // on detached elements
  13834. style = elem.style;
  13835. computed = computed || getStyles( elem );
  13836. // getPropertyValue is needed for:
  13837. // .css('filter') (IE 9 only, #12537)
  13838. // .css('--customProperty) (#3144)
  13839. if ( computed ) {
  13840. ret = computed.getPropertyValue( name ) || computed[ name ];
  13841. if ( ret === "" && !isAttached( elem ) ) {
  13842. ret = jQuery.style( elem, name );
  13843. }
  13844. // A tribute to the "awesome hack by Dean Edwards"
  13845. // Android Browser returns percentage for some values,
  13846. // but width seems to be reliably pixels.
  13847. // This is against the CSSOM draft spec:
  13848. // https://drafts.csswg.org/cssom/#resolved-values
  13849. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13850. // Remember the original values
  13851. width = style.width;
  13852. minWidth = style.minWidth;
  13853. maxWidth = style.maxWidth;
  13854. // Put in the new values to get a computed value out
  13855. style.minWidth = style.maxWidth = style.width = ret;
  13856. ret = computed.width;
  13857. // Revert the changed values
  13858. style.width = width;
  13859. style.minWidth = minWidth;
  13860. style.maxWidth = maxWidth;
  13861. }
  13862. }
  13863. return ret !== undefined ?
  13864. // Support: IE <=9 - 11 only
  13865. // IE returns zIndex value as an integer.
  13866. ret + "" :
  13867. ret;
  13868. }
  13869. function addGetHookIf( conditionFn, hookFn ) {
  13870. // Define the hook, we'll check on the first run if it's really needed.
  13871. return {
  13872. get: function() {
  13873. if ( conditionFn() ) {
  13874. // Hook not needed (or it's not possible to use it due
  13875. // to missing dependency), remove it.
  13876. delete this.get;
  13877. return;
  13878. }
  13879. // Hook needed; redefine it so that the support test is not executed again.
  13880. return ( this.get = hookFn ).apply( this, arguments );
  13881. }
  13882. };
  13883. }
  13884. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13885. emptyStyle = document.createElement( "div" ).style,
  13886. vendorProps = {};
  13887. // Return a vendor-prefixed property or undefined
  13888. function vendorPropName( name ) {
  13889. // Check for vendor prefixed names
  13890. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13891. i = cssPrefixes.length;
  13892. while ( i-- ) {
  13893. name = cssPrefixes[ i ] + capName;
  13894. if ( name in emptyStyle ) {
  13895. return name;
  13896. }
  13897. }
  13898. }
  13899. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13900. function finalPropName( name ) {
  13901. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13902. if ( final ) {
  13903. return final;
  13904. }
  13905. if ( name in emptyStyle ) {
  13906. return name;
  13907. }
  13908. return vendorProps[ name ] = vendorPropName( name ) || name;
  13909. }
  13910. var
  13911. // Swappable if display is none or starts with table
  13912. // except "table", "table-cell", or "table-caption"
  13913. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13914. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13915. rcustomProp = /^--/,
  13916. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13917. cssNormalTransform = {
  13918. letterSpacing: "0",
  13919. fontWeight: "400"
  13920. };
  13921. function setPositiveNumber( elem, value, subtract ) {
  13922. // Any relative (+/-) values have already been
  13923. // normalized at this point
  13924. var matches = rcssNum.exec( value );
  13925. return matches ?
  13926. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13927. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13928. value;
  13929. }
  13930. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13931. var i = dimension === "width" ? 1 : 0,
  13932. extra = 0,
  13933. delta = 0;
  13934. // Adjustment may not be necessary
  13935. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13936. return 0;
  13937. }
  13938. for ( ; i < 4; i += 2 ) {
  13939. // Both box models exclude margin
  13940. if ( box === "margin" ) {
  13941. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13942. }
  13943. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13944. if ( !isBorderBox ) {
  13945. // Add padding
  13946. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13947. // For "border" or "margin", add border
  13948. if ( box !== "padding" ) {
  13949. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13950. // But still keep track of it otherwise
  13951. } else {
  13952. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13953. }
  13954. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13955. // "padding" or "margin"
  13956. } else {
  13957. // For "content", subtract padding
  13958. if ( box === "content" ) {
  13959. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13960. }
  13961. // For "content" or "padding", subtract border
  13962. if ( box !== "margin" ) {
  13963. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13964. }
  13965. }
  13966. }
  13967. // Account for positive content-box scroll gutter when requested by providing computedVal
  13968. if ( !isBorderBox && computedVal >= 0 ) {
  13969. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13970. // Assuming integer scroll gutter, subtract the rest and round down
  13971. delta += Math.max( 0, Math.ceil(
  13972. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13973. computedVal -
  13974. delta -
  13975. extra -
  13976. 0.5
  13977. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13978. // Use an explicit zero to avoid NaN (gh-3964)
  13979. ) ) || 0;
  13980. }
  13981. return delta;
  13982. }
  13983. function getWidthOrHeight( elem, dimension, extra ) {
  13984. // Start with computed style
  13985. var styles = getStyles( elem ),
  13986. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13987. // Fake content-box until we know it's needed to know the true value.
  13988. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13989. isBorderBox = boxSizingNeeded &&
  13990. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13991. valueIsBorderBox = isBorderBox,
  13992. val = curCSS( elem, dimension, styles ),
  13993. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13994. // Support: Firefox <=54
  13995. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13996. if ( rnumnonpx.test( val ) ) {
  13997. if ( !extra ) {
  13998. return val;
  13999. }
  14000. val = "auto";
  14001. }
  14002. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14003. // This happens for inline elements with no explicit setting (gh-3571)
  14004. // Support: Android <=4.1 - 4.3 only
  14005. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14006. // Support: IE 9-11 only
  14007. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14008. // We use getClientRects() to check for hidden/disconnected.
  14009. // In those cases, the computed value can be trusted to be border-box
  14010. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14011. val === "auto" ||
  14012. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14013. elem.getClientRects().length ) {
  14014. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14015. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14016. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14017. // retrieved value as a content box dimension.
  14018. valueIsBorderBox = offsetProp in elem;
  14019. if ( valueIsBorderBox ) {
  14020. val = elem[ offsetProp ];
  14021. }
  14022. }
  14023. // Normalize "" and auto
  14024. val = parseFloat( val ) || 0;
  14025. // Adjust for the element's box model
  14026. return ( val +
  14027. boxModelAdjustment(
  14028. elem,
  14029. dimension,
  14030. extra || ( isBorderBox ? "border" : "content" ),
  14031. valueIsBorderBox,
  14032. styles,
  14033. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14034. val
  14035. )
  14036. ) + "px";
  14037. }
  14038. jQuery.extend( {
  14039. // Add in style property hooks for overriding the default
  14040. // behavior of getting and setting a style property
  14041. cssHooks: {
  14042. opacity: {
  14043. get: function( elem, computed ) {
  14044. if ( computed ) {
  14045. // We should always get a number back from opacity
  14046. var ret = curCSS( elem, "opacity" );
  14047. return ret === "" ? "1" : ret;
  14048. }
  14049. }
  14050. }
  14051. },
  14052. // Don't automatically add "px" to these possibly-unitless properties
  14053. cssNumber: {
  14054. "animationIterationCount": true,
  14055. "columnCount": true,
  14056. "fillOpacity": true,
  14057. "flexGrow": true,
  14058. "flexShrink": true,
  14059. "fontWeight": true,
  14060. "gridArea": true,
  14061. "gridColumn": true,
  14062. "gridColumnEnd": true,
  14063. "gridColumnStart": true,
  14064. "gridRow": true,
  14065. "gridRowEnd": true,
  14066. "gridRowStart": true,
  14067. "lineHeight": true,
  14068. "opacity": true,
  14069. "order": true,
  14070. "orphans": true,
  14071. "widows": true,
  14072. "zIndex": true,
  14073. "zoom": true
  14074. },
  14075. // Add in properties whose names you wish to fix before
  14076. // setting or getting the value
  14077. cssProps: {},
  14078. // Get and set the style property on a DOM Node
  14079. style: function( elem, name, value, extra ) {
  14080. // Don't set styles on text and comment nodes
  14081. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14082. return;
  14083. }
  14084. // Make sure that we're working with the right name
  14085. var ret, type, hooks,
  14086. origName = camelCase( name ),
  14087. isCustomProp = rcustomProp.test( name ),
  14088. style = elem.style;
  14089. // Make sure that we're working with the right name. We don't
  14090. // want to query the value if it is a CSS custom property
  14091. // since they are user-defined.
  14092. if ( !isCustomProp ) {
  14093. name = finalPropName( origName );
  14094. }
  14095. // Gets hook for the prefixed version, then unprefixed version
  14096. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14097. // Check if we're setting a value
  14098. if ( value !== undefined ) {
  14099. type = typeof value;
  14100. // Convert "+=" or "-=" to relative numbers (#7345)
  14101. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14102. value = adjustCSS( elem, name, ret );
  14103. // Fixes bug #9237
  14104. type = "number";
  14105. }
  14106. // Make sure that null and NaN values aren't set (#7116)
  14107. if ( value == null || value !== value ) {
  14108. return;
  14109. }
  14110. // If a number was passed in, add the unit (except for certain CSS properties)
  14111. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14112. // "px" to a few hardcoded values.
  14113. if ( type === "number" && !isCustomProp ) {
  14114. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14115. }
  14116. // background-* props affect original clone's values
  14117. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14118. style[ name ] = "inherit";
  14119. }
  14120. // If a hook was provided, use that value, otherwise just set the specified value
  14121. if ( !hooks || !( "set" in hooks ) ||
  14122. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14123. if ( isCustomProp ) {
  14124. style.setProperty( name, value );
  14125. } else {
  14126. style[ name ] = value;
  14127. }
  14128. }
  14129. } else {
  14130. // If a hook was provided get the non-computed value from there
  14131. if ( hooks && "get" in hooks &&
  14132. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14133. return ret;
  14134. }
  14135. // Otherwise just get the value from the style object
  14136. return style[ name ];
  14137. }
  14138. },
  14139. css: function( elem, name, extra, styles ) {
  14140. var val, num, hooks,
  14141. origName = camelCase( name ),
  14142. isCustomProp = rcustomProp.test( name );
  14143. // Make sure that we're working with the right name. We don't
  14144. // want to modify the value if it is a CSS custom property
  14145. // since they are user-defined.
  14146. if ( !isCustomProp ) {
  14147. name = finalPropName( origName );
  14148. }
  14149. // Try prefixed name followed by the unprefixed name
  14150. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14151. // If a hook was provided get the computed value from there
  14152. if ( hooks && "get" in hooks ) {
  14153. val = hooks.get( elem, true, extra );
  14154. }
  14155. // Otherwise, if a way to get the computed value exists, use that
  14156. if ( val === undefined ) {
  14157. val = curCSS( elem, name, styles );
  14158. }
  14159. // Convert "normal" to computed value
  14160. if ( val === "normal" && name in cssNormalTransform ) {
  14161. val = cssNormalTransform[ name ];
  14162. }
  14163. // Make numeric if forced or a qualifier was provided and val looks numeric
  14164. if ( extra === "" || extra ) {
  14165. num = parseFloat( val );
  14166. return extra === true || isFinite( num ) ? num || 0 : val;
  14167. }
  14168. return val;
  14169. }
  14170. } );
  14171. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14172. jQuery.cssHooks[ dimension ] = {
  14173. get: function( elem, computed, extra ) {
  14174. if ( computed ) {
  14175. // Certain elements can have dimension info if we invisibly show them
  14176. // but it must have a current display style that would benefit
  14177. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14178. // Support: Safari 8+
  14179. // Table columns in Safari have non-zero offsetWidth & zero
  14180. // getBoundingClientRect().width unless display is changed.
  14181. // Support: IE <=11 only
  14182. // Running getBoundingClientRect on a disconnected node
  14183. // in IE throws an error.
  14184. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14185. swap( elem, cssShow, function() {
  14186. return getWidthOrHeight( elem, dimension, extra );
  14187. } ) :
  14188. getWidthOrHeight( elem, dimension, extra );
  14189. }
  14190. },
  14191. set: function( elem, value, extra ) {
  14192. var matches,
  14193. styles = getStyles( elem ),
  14194. // Only read styles.position if the test has a chance to fail
  14195. // to avoid forcing a reflow.
  14196. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14197. styles.position === "absolute",
  14198. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14199. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14200. isBorderBox = boxSizingNeeded &&
  14201. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14202. subtract = extra ?
  14203. boxModelAdjustment(
  14204. elem,
  14205. dimension,
  14206. extra,
  14207. isBorderBox,
  14208. styles
  14209. ) :
  14210. 0;
  14211. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14212. // faking a content-box to get border and padding (gh-3699)
  14213. if ( isBorderBox && scrollboxSizeBuggy ) {
  14214. subtract -= Math.ceil(
  14215. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14216. parseFloat( styles[ dimension ] ) -
  14217. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14218. 0.5
  14219. );
  14220. }
  14221. // Convert to pixels if value adjustment is needed
  14222. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14223. ( matches[ 3 ] || "px" ) !== "px" ) {
  14224. elem.style[ dimension ] = value;
  14225. value = jQuery.css( elem, dimension );
  14226. }
  14227. return setPositiveNumber( elem, value, subtract );
  14228. }
  14229. };
  14230. } );
  14231. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14232. function( elem, computed ) {
  14233. if ( computed ) {
  14234. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14235. elem.getBoundingClientRect().left -
  14236. swap( elem, { marginLeft: 0 }, function() {
  14237. return elem.getBoundingClientRect().left;
  14238. } )
  14239. ) + "px";
  14240. }
  14241. }
  14242. );
  14243. // These hooks are used by animate to expand properties
  14244. jQuery.each( {
  14245. margin: "",
  14246. padding: "",
  14247. border: "Width"
  14248. }, function( prefix, suffix ) {
  14249. jQuery.cssHooks[ prefix + suffix ] = {
  14250. expand: function( value ) {
  14251. var i = 0,
  14252. expanded = {},
  14253. // Assumes a single number if not a string
  14254. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14255. for ( ; i < 4; i++ ) {
  14256. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14257. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14258. }
  14259. return expanded;
  14260. }
  14261. };
  14262. if ( prefix !== "margin" ) {
  14263. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14264. }
  14265. } );
  14266. jQuery.fn.extend( {
  14267. css: function( name, value ) {
  14268. return access( this, function( elem, name, value ) {
  14269. var styles, len,
  14270. map = {},
  14271. i = 0;
  14272. if ( Array.isArray( name ) ) {
  14273. styles = getStyles( elem );
  14274. len = name.length;
  14275. for ( ; i < len; i++ ) {
  14276. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14277. }
  14278. return map;
  14279. }
  14280. return value !== undefined ?
  14281. jQuery.style( elem, name, value ) :
  14282. jQuery.css( elem, name );
  14283. }, name, value, arguments.length > 1 );
  14284. }
  14285. } );
  14286. function Tween( elem, options, prop, end, easing ) {
  14287. return new Tween.prototype.init( elem, options, prop, end, easing );
  14288. }
  14289. jQuery.Tween = Tween;
  14290. Tween.prototype = {
  14291. constructor: Tween,
  14292. init: function( elem, options, prop, end, easing, unit ) {
  14293. this.elem = elem;
  14294. this.prop = prop;
  14295. this.easing = easing || jQuery.easing._default;
  14296. this.options = options;
  14297. this.start = this.now = this.cur();
  14298. this.end = end;
  14299. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14300. },
  14301. cur: function() {
  14302. var hooks = Tween.propHooks[ this.prop ];
  14303. return hooks && hooks.get ?
  14304. hooks.get( this ) :
  14305. Tween.propHooks._default.get( this );
  14306. },
  14307. run: function( percent ) {
  14308. var eased,
  14309. hooks = Tween.propHooks[ this.prop ];
  14310. if ( this.options.duration ) {
  14311. this.pos = eased = jQuery.easing[ this.easing ](
  14312. percent, this.options.duration * percent, 0, 1, this.options.duration
  14313. );
  14314. } else {
  14315. this.pos = eased = percent;
  14316. }
  14317. this.now = ( this.end - this.start ) * eased + this.start;
  14318. if ( this.options.step ) {
  14319. this.options.step.call( this.elem, this.now, this );
  14320. }
  14321. if ( hooks && hooks.set ) {
  14322. hooks.set( this );
  14323. } else {
  14324. Tween.propHooks._default.set( this );
  14325. }
  14326. return this;
  14327. }
  14328. };
  14329. Tween.prototype.init.prototype = Tween.prototype;
  14330. Tween.propHooks = {
  14331. _default: {
  14332. get: function( tween ) {
  14333. var result;
  14334. // Use a property on the element directly when it is not a DOM element,
  14335. // or when there is no matching style property that exists.
  14336. if ( tween.elem.nodeType !== 1 ||
  14337. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14338. return tween.elem[ tween.prop ];
  14339. }
  14340. // Passing an empty string as a 3rd parameter to .css will automatically
  14341. // attempt a parseFloat and fallback to a string if the parse fails.
  14342. // Simple values such as "10px" are parsed to Float;
  14343. // complex values such as "rotate(1rad)" are returned as-is.
  14344. result = jQuery.css( tween.elem, tween.prop, "" );
  14345. // Empty strings, null, undefined and "auto" are converted to 0.
  14346. return !result || result === "auto" ? 0 : result;
  14347. },
  14348. set: function( tween ) {
  14349. // Use step hook for back compat.
  14350. // Use cssHook if its there.
  14351. // Use .style if available and use plain properties where available.
  14352. if ( jQuery.fx.step[ tween.prop ] ) {
  14353. jQuery.fx.step[ tween.prop ]( tween );
  14354. } else if ( tween.elem.nodeType === 1 && (
  14355. jQuery.cssHooks[ tween.prop ] ||
  14356. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14357. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14358. } else {
  14359. tween.elem[ tween.prop ] = tween.now;
  14360. }
  14361. }
  14362. }
  14363. };
  14364. // Support: IE <=9 only
  14365. // Panic based approach to setting things on disconnected nodes
  14366. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14367. set: function( tween ) {
  14368. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14369. tween.elem[ tween.prop ] = tween.now;
  14370. }
  14371. }
  14372. };
  14373. jQuery.easing = {
  14374. linear: function( p ) {
  14375. return p;
  14376. },
  14377. swing: function( p ) {
  14378. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14379. },
  14380. _default: "swing"
  14381. };
  14382. jQuery.fx = Tween.prototype.init;
  14383. // Back compat <1.8 extension point
  14384. jQuery.fx.step = {};
  14385. var
  14386. fxNow, inProgress,
  14387. rfxtypes = /^(?:toggle|show|hide)$/,
  14388. rrun = /queueHooks$/;
  14389. function schedule() {
  14390. if ( inProgress ) {
  14391. if ( document.hidden === false && window.requestAnimationFrame ) {
  14392. window.requestAnimationFrame( schedule );
  14393. } else {
  14394. window.setTimeout( schedule, jQuery.fx.interval );
  14395. }
  14396. jQuery.fx.tick();
  14397. }
  14398. }
  14399. // Animations created synchronously will run synchronously
  14400. function createFxNow() {
  14401. window.setTimeout( function() {
  14402. fxNow = undefined;
  14403. } );
  14404. return ( fxNow = Date.now() );
  14405. }
  14406. // Generate parameters to create a standard animation
  14407. function genFx( type, includeWidth ) {
  14408. var which,
  14409. i = 0,
  14410. attrs = { height: type };
  14411. // If we include width, step value is 1 to do all cssExpand values,
  14412. // otherwise step value is 2 to skip over Left and Right
  14413. includeWidth = includeWidth ? 1 : 0;
  14414. for ( ; i < 4; i += 2 - includeWidth ) {
  14415. which = cssExpand[ i ];
  14416. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14417. }
  14418. if ( includeWidth ) {
  14419. attrs.opacity = attrs.width = type;
  14420. }
  14421. return attrs;
  14422. }
  14423. function createTween( value, prop, animation ) {
  14424. var tween,
  14425. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14426. index = 0,
  14427. length = collection.length;
  14428. for ( ; index < length; index++ ) {
  14429. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14430. // We're done with this property
  14431. return tween;
  14432. }
  14433. }
  14434. }
  14435. function defaultPrefilter( elem, props, opts ) {
  14436. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14437. isBox = "width" in props || "height" in props,
  14438. anim = this,
  14439. orig = {},
  14440. style = elem.style,
  14441. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14442. dataShow = dataPriv.get( elem, "fxshow" );
  14443. // Queue-skipping animations hijack the fx hooks
  14444. if ( !opts.queue ) {
  14445. hooks = jQuery._queueHooks( elem, "fx" );
  14446. if ( hooks.unqueued == null ) {
  14447. hooks.unqueued = 0;
  14448. oldfire = hooks.empty.fire;
  14449. hooks.empty.fire = function() {
  14450. if ( !hooks.unqueued ) {
  14451. oldfire();
  14452. }
  14453. };
  14454. }
  14455. hooks.unqueued++;
  14456. anim.always( function() {
  14457. // Ensure the complete handler is called before this completes
  14458. anim.always( function() {
  14459. hooks.unqueued--;
  14460. if ( !jQuery.queue( elem, "fx" ).length ) {
  14461. hooks.empty.fire();
  14462. }
  14463. } );
  14464. } );
  14465. }
  14466. // Detect show/hide animations
  14467. for ( prop in props ) {
  14468. value = props[ prop ];
  14469. if ( rfxtypes.test( value ) ) {
  14470. delete props[ prop ];
  14471. toggle = toggle || value === "toggle";
  14472. if ( value === ( hidden ? "hide" : "show" ) ) {
  14473. // Pretend to be hidden if this is a "show" and
  14474. // there is still data from a stopped show/hide
  14475. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14476. hidden = true;
  14477. // Ignore all other no-op show/hide data
  14478. } else {
  14479. continue;
  14480. }
  14481. }
  14482. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14483. }
  14484. }
  14485. // Bail out if this is a no-op like .hide().hide()
  14486. propTween = !jQuery.isEmptyObject( props );
  14487. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14488. return;
  14489. }
  14490. // Restrict "overflow" and "display" styles during box animations
  14491. if ( isBox && elem.nodeType === 1 ) {
  14492. // Support: IE <=9 - 11, Edge 12 - 15
  14493. // Record all 3 overflow attributes because IE does not infer the shorthand
  14494. // from identically-valued overflowX and overflowY and Edge just mirrors
  14495. // the overflowX value there.
  14496. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14497. // Identify a display type, preferring old show/hide data over the CSS cascade
  14498. restoreDisplay = dataShow && dataShow.display;
  14499. if ( restoreDisplay == null ) {
  14500. restoreDisplay = dataPriv.get( elem, "display" );
  14501. }
  14502. display = jQuery.css( elem, "display" );
  14503. if ( display === "none" ) {
  14504. if ( restoreDisplay ) {
  14505. display = restoreDisplay;
  14506. } else {
  14507. // Get nonempty value(s) by temporarily forcing visibility
  14508. showHide( [ elem ], true );
  14509. restoreDisplay = elem.style.display || restoreDisplay;
  14510. display = jQuery.css( elem, "display" );
  14511. showHide( [ elem ] );
  14512. }
  14513. }
  14514. // Animate inline elements as inline-block
  14515. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14516. if ( jQuery.css( elem, "float" ) === "none" ) {
  14517. // Restore the original display value at the end of pure show/hide animations
  14518. if ( !propTween ) {
  14519. anim.done( function() {
  14520. style.display = restoreDisplay;
  14521. } );
  14522. if ( restoreDisplay == null ) {
  14523. display = style.display;
  14524. restoreDisplay = display === "none" ? "" : display;
  14525. }
  14526. }
  14527. style.display = "inline-block";
  14528. }
  14529. }
  14530. }
  14531. if ( opts.overflow ) {
  14532. style.overflow = "hidden";
  14533. anim.always( function() {
  14534. style.overflow = opts.overflow[ 0 ];
  14535. style.overflowX = opts.overflow[ 1 ];
  14536. style.overflowY = opts.overflow[ 2 ];
  14537. } );
  14538. }
  14539. // Implement show/hide animations
  14540. propTween = false;
  14541. for ( prop in orig ) {
  14542. // General show/hide setup for this element animation
  14543. if ( !propTween ) {
  14544. if ( dataShow ) {
  14545. if ( "hidden" in dataShow ) {
  14546. hidden = dataShow.hidden;
  14547. }
  14548. } else {
  14549. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14550. }
  14551. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14552. if ( toggle ) {
  14553. dataShow.hidden = !hidden;
  14554. }
  14555. // Show elements before animating them
  14556. if ( hidden ) {
  14557. showHide( [ elem ], true );
  14558. }
  14559. /* eslint-disable no-loop-func */
  14560. anim.done( function() {
  14561. /* eslint-enable no-loop-func */
  14562. // The final step of a "hide" animation is actually hiding the element
  14563. if ( !hidden ) {
  14564. showHide( [ elem ] );
  14565. }
  14566. dataPriv.remove( elem, "fxshow" );
  14567. for ( prop in orig ) {
  14568. jQuery.style( elem, prop, orig[ prop ] );
  14569. }
  14570. } );
  14571. }
  14572. // Per-property setup
  14573. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14574. if ( !( prop in dataShow ) ) {
  14575. dataShow[ prop ] = propTween.start;
  14576. if ( hidden ) {
  14577. propTween.end = propTween.start;
  14578. propTween.start = 0;
  14579. }
  14580. }
  14581. }
  14582. }
  14583. function propFilter( props, specialEasing ) {
  14584. var index, name, easing, value, hooks;
  14585. // camelCase, specialEasing and expand cssHook pass
  14586. for ( index in props ) {
  14587. name = camelCase( index );
  14588. easing = specialEasing[ name ];
  14589. value = props[ index ];
  14590. if ( Array.isArray( value ) ) {
  14591. easing = value[ 1 ];
  14592. value = props[ index ] = value[ 0 ];
  14593. }
  14594. if ( index !== name ) {
  14595. props[ name ] = value;
  14596. delete props[ index ];
  14597. }
  14598. hooks = jQuery.cssHooks[ name ];
  14599. if ( hooks && "expand" in hooks ) {
  14600. value = hooks.expand( value );
  14601. delete props[ name ];
  14602. // Not quite $.extend, this won't overwrite existing keys.
  14603. // Reusing 'index' because we have the correct "name"
  14604. for ( index in value ) {
  14605. if ( !( index in props ) ) {
  14606. props[ index ] = value[ index ];
  14607. specialEasing[ index ] = easing;
  14608. }
  14609. }
  14610. } else {
  14611. specialEasing[ name ] = easing;
  14612. }
  14613. }
  14614. }
  14615. function Animation( elem, properties, options ) {
  14616. var result,
  14617. stopped,
  14618. index = 0,
  14619. length = Animation.prefilters.length,
  14620. deferred = jQuery.Deferred().always( function() {
  14621. // Don't match elem in the :animated selector
  14622. delete tick.elem;
  14623. } ),
  14624. tick = function() {
  14625. if ( stopped ) {
  14626. return false;
  14627. }
  14628. var currentTime = fxNow || createFxNow(),
  14629. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14630. // Support: Android 2.3 only
  14631. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14632. temp = remaining / animation.duration || 0,
  14633. percent = 1 - temp,
  14634. index = 0,
  14635. length = animation.tweens.length;
  14636. for ( ; index < length; index++ ) {
  14637. animation.tweens[ index ].run( percent );
  14638. }
  14639. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14640. // If there's more to do, yield
  14641. if ( percent < 1 && length ) {
  14642. return remaining;
  14643. }
  14644. // If this was an empty animation, synthesize a final progress notification
  14645. if ( !length ) {
  14646. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14647. }
  14648. // Resolve the animation and report its conclusion
  14649. deferred.resolveWith( elem, [ animation ] );
  14650. return false;
  14651. },
  14652. animation = deferred.promise( {
  14653. elem: elem,
  14654. props: jQuery.extend( {}, properties ),
  14655. opts: jQuery.extend( true, {
  14656. specialEasing: {},
  14657. easing: jQuery.easing._default
  14658. }, options ),
  14659. originalProperties: properties,
  14660. originalOptions: options,
  14661. startTime: fxNow || createFxNow(),
  14662. duration: options.duration,
  14663. tweens: [],
  14664. createTween: function( prop, end ) {
  14665. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14666. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14667. animation.tweens.push( tween );
  14668. return tween;
  14669. },
  14670. stop: function( gotoEnd ) {
  14671. var index = 0,
  14672. // If we are going to the end, we want to run all the tweens
  14673. // otherwise we skip this part
  14674. length = gotoEnd ? animation.tweens.length : 0;
  14675. if ( stopped ) {
  14676. return this;
  14677. }
  14678. stopped = true;
  14679. for ( ; index < length; index++ ) {
  14680. animation.tweens[ index ].run( 1 );
  14681. }
  14682. // Resolve when we played the last frame; otherwise, reject
  14683. if ( gotoEnd ) {
  14684. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14685. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14686. } else {
  14687. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14688. }
  14689. return this;
  14690. }
  14691. } ),
  14692. props = animation.props;
  14693. propFilter( props, animation.opts.specialEasing );
  14694. for ( ; index < length; index++ ) {
  14695. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14696. if ( result ) {
  14697. if ( isFunction( result.stop ) ) {
  14698. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14699. result.stop.bind( result );
  14700. }
  14701. return result;
  14702. }
  14703. }
  14704. jQuery.map( props, createTween, animation );
  14705. if ( isFunction( animation.opts.start ) ) {
  14706. animation.opts.start.call( elem, animation );
  14707. }
  14708. // Attach callbacks from options
  14709. animation
  14710. .progress( animation.opts.progress )
  14711. .done( animation.opts.done, animation.opts.complete )
  14712. .fail( animation.opts.fail )
  14713. .always( animation.opts.always );
  14714. jQuery.fx.timer(
  14715. jQuery.extend( tick, {
  14716. elem: elem,
  14717. anim: animation,
  14718. queue: animation.opts.queue
  14719. } )
  14720. );
  14721. return animation;
  14722. }
  14723. jQuery.Animation = jQuery.extend( Animation, {
  14724. tweeners: {
  14725. "*": [ function( prop, value ) {
  14726. var tween = this.createTween( prop, value );
  14727. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14728. return tween;
  14729. } ]
  14730. },
  14731. tweener: function( props, callback ) {
  14732. if ( isFunction( props ) ) {
  14733. callback = props;
  14734. props = [ "*" ];
  14735. } else {
  14736. props = props.match( rnothtmlwhite );
  14737. }
  14738. var prop,
  14739. index = 0,
  14740. length = props.length;
  14741. for ( ; index < length; index++ ) {
  14742. prop = props[ index ];
  14743. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14744. Animation.tweeners[ prop ].unshift( callback );
  14745. }
  14746. },
  14747. prefilters: [ defaultPrefilter ],
  14748. prefilter: function( callback, prepend ) {
  14749. if ( prepend ) {
  14750. Animation.prefilters.unshift( callback );
  14751. } else {
  14752. Animation.prefilters.push( callback );
  14753. }
  14754. }
  14755. } );
  14756. jQuery.speed = function( speed, easing, fn ) {
  14757. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14758. complete: fn || !fn && easing ||
  14759. isFunction( speed ) && speed,
  14760. duration: speed,
  14761. easing: fn && easing || easing && !isFunction( easing ) && easing
  14762. };
  14763. // Go to the end state if fx are off
  14764. if ( jQuery.fx.off ) {
  14765. opt.duration = 0;
  14766. } else {
  14767. if ( typeof opt.duration !== "number" ) {
  14768. if ( opt.duration in jQuery.fx.speeds ) {
  14769. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14770. } else {
  14771. opt.duration = jQuery.fx.speeds._default;
  14772. }
  14773. }
  14774. }
  14775. // Normalize opt.queue - true/undefined/null -> "fx"
  14776. if ( opt.queue == null || opt.queue === true ) {
  14777. opt.queue = "fx";
  14778. }
  14779. // Queueing
  14780. opt.old = opt.complete;
  14781. opt.complete = function() {
  14782. if ( isFunction( opt.old ) ) {
  14783. opt.old.call( this );
  14784. }
  14785. if ( opt.queue ) {
  14786. jQuery.dequeue( this, opt.queue );
  14787. }
  14788. };
  14789. return opt;
  14790. };
  14791. jQuery.fn.extend( {
  14792. fadeTo: function( speed, to, easing, callback ) {
  14793. // Show any hidden elements after setting opacity to 0
  14794. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14795. // Animate to the value specified
  14796. .end().animate( { opacity: to }, speed, easing, callback );
  14797. },
  14798. animate: function( prop, speed, easing, callback ) {
  14799. var empty = jQuery.isEmptyObject( prop ),
  14800. optall = jQuery.speed( speed, easing, callback ),
  14801. doAnimation = function() {
  14802. // Operate on a copy of prop so per-property easing won't be lost
  14803. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14804. // Empty animations, or finishing resolves immediately
  14805. if ( empty || dataPriv.get( this, "finish" ) ) {
  14806. anim.stop( true );
  14807. }
  14808. };
  14809. doAnimation.finish = doAnimation;
  14810. return empty || optall.queue === false ?
  14811. this.each( doAnimation ) :
  14812. this.queue( optall.queue, doAnimation );
  14813. },
  14814. stop: function( type, clearQueue, gotoEnd ) {
  14815. var stopQueue = function( hooks ) {
  14816. var stop = hooks.stop;
  14817. delete hooks.stop;
  14818. stop( gotoEnd );
  14819. };
  14820. if ( typeof type !== "string" ) {
  14821. gotoEnd = clearQueue;
  14822. clearQueue = type;
  14823. type = undefined;
  14824. }
  14825. if ( clearQueue && type !== false ) {
  14826. this.queue( type || "fx", [] );
  14827. }
  14828. return this.each( function() {
  14829. var dequeue = true,
  14830. index = type != null && type + "queueHooks",
  14831. timers = jQuery.timers,
  14832. data = dataPriv.get( this );
  14833. if ( index ) {
  14834. if ( data[ index ] && data[ index ].stop ) {
  14835. stopQueue( data[ index ] );
  14836. }
  14837. } else {
  14838. for ( index in data ) {
  14839. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14840. stopQueue( data[ index ] );
  14841. }
  14842. }
  14843. }
  14844. for ( index = timers.length; index--; ) {
  14845. if ( timers[ index ].elem === this &&
  14846. ( type == null || timers[ index ].queue === type ) ) {
  14847. timers[ index ].anim.stop( gotoEnd );
  14848. dequeue = false;
  14849. timers.splice( index, 1 );
  14850. }
  14851. }
  14852. // Start the next in the queue if the last step wasn't forced.
  14853. // Timers currently will call their complete callbacks, which
  14854. // will dequeue but only if they were gotoEnd.
  14855. if ( dequeue || !gotoEnd ) {
  14856. jQuery.dequeue( this, type );
  14857. }
  14858. } );
  14859. },
  14860. finish: function( type ) {
  14861. if ( type !== false ) {
  14862. type = type || "fx";
  14863. }
  14864. return this.each( function() {
  14865. var index,
  14866. data = dataPriv.get( this ),
  14867. queue = data[ type + "queue" ],
  14868. hooks = data[ type + "queueHooks" ],
  14869. timers = jQuery.timers,
  14870. length = queue ? queue.length : 0;
  14871. // Enable finishing flag on private data
  14872. data.finish = true;
  14873. // Empty the queue first
  14874. jQuery.queue( this, type, [] );
  14875. if ( hooks && hooks.stop ) {
  14876. hooks.stop.call( this, true );
  14877. }
  14878. // Look for any active animations, and finish them
  14879. for ( index = timers.length; index--; ) {
  14880. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14881. timers[ index ].anim.stop( true );
  14882. timers.splice( index, 1 );
  14883. }
  14884. }
  14885. // Look for any animations in the old queue and finish them
  14886. for ( index = 0; index < length; index++ ) {
  14887. if ( queue[ index ] && queue[ index ].finish ) {
  14888. queue[ index ].finish.call( this );
  14889. }
  14890. }
  14891. // Turn off finishing flag
  14892. delete data.finish;
  14893. } );
  14894. }
  14895. } );
  14896. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14897. var cssFn = jQuery.fn[ name ];
  14898. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14899. return speed == null || typeof speed === "boolean" ?
  14900. cssFn.apply( this, arguments ) :
  14901. this.animate( genFx( name, true ), speed, easing, callback );
  14902. };
  14903. } );
  14904. // Generate shortcuts for custom animations
  14905. jQuery.each( {
  14906. slideDown: genFx( "show" ),
  14907. slideUp: genFx( "hide" ),
  14908. slideToggle: genFx( "toggle" ),
  14909. fadeIn: { opacity: "show" },
  14910. fadeOut: { opacity: "hide" },
  14911. fadeToggle: { opacity: "toggle" }
  14912. }, function( name, props ) {
  14913. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14914. return this.animate( props, speed, easing, callback );
  14915. };
  14916. } );
  14917. jQuery.timers = [];
  14918. jQuery.fx.tick = function() {
  14919. var timer,
  14920. i = 0,
  14921. timers = jQuery.timers;
  14922. fxNow = Date.now();
  14923. for ( ; i < timers.length; i++ ) {
  14924. timer = timers[ i ];
  14925. // Run the timer and safely remove it when done (allowing for external removal)
  14926. if ( !timer() && timers[ i ] === timer ) {
  14927. timers.splice( i--, 1 );
  14928. }
  14929. }
  14930. if ( !timers.length ) {
  14931. jQuery.fx.stop();
  14932. }
  14933. fxNow = undefined;
  14934. };
  14935. jQuery.fx.timer = function( timer ) {
  14936. jQuery.timers.push( timer );
  14937. jQuery.fx.start();
  14938. };
  14939. jQuery.fx.interval = 13;
  14940. jQuery.fx.start = function() {
  14941. if ( inProgress ) {
  14942. return;
  14943. }
  14944. inProgress = true;
  14945. schedule();
  14946. };
  14947. jQuery.fx.stop = function() {
  14948. inProgress = null;
  14949. };
  14950. jQuery.fx.speeds = {
  14951. slow: 600,
  14952. fast: 200,
  14953. // Default speed
  14954. _default: 400
  14955. };
  14956. // Based off of the plugin by Clint Helfers, with permission.
  14957. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14958. jQuery.fn.delay = function( time, type ) {
  14959. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14960. type = type || "fx";
  14961. return this.queue( type, function( next, hooks ) {
  14962. var timeout = window.setTimeout( next, time );
  14963. hooks.stop = function() {
  14964. window.clearTimeout( timeout );
  14965. };
  14966. } );
  14967. };
  14968. ( function() {
  14969. var input = document.createElement( "input" ),
  14970. select = document.createElement( "select" ),
  14971. opt = select.appendChild( document.createElement( "option" ) );
  14972. input.type = "checkbox";
  14973. // Support: Android <=4.3 only
  14974. // Default value for a checkbox should be "on"
  14975. support.checkOn = input.value !== "";
  14976. // Support: IE <=11 only
  14977. // Must access selectedIndex to make default options select
  14978. support.optSelected = opt.selected;
  14979. // Support: IE <=11 only
  14980. // An input loses its value after becoming a radio
  14981. input = document.createElement( "input" );
  14982. input.value = "t";
  14983. input.type = "radio";
  14984. support.radioValue = input.value === "t";
  14985. } )();
  14986. var boolHook,
  14987. attrHandle = jQuery.expr.attrHandle;
  14988. jQuery.fn.extend( {
  14989. attr: function( name, value ) {
  14990. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14991. },
  14992. removeAttr: function( name ) {
  14993. return this.each( function() {
  14994. jQuery.removeAttr( this, name );
  14995. } );
  14996. }
  14997. } );
  14998. jQuery.extend( {
  14999. attr: function( elem, name, value ) {
  15000. var ret, hooks,
  15001. nType = elem.nodeType;
  15002. // Don't get/set attributes on text, comment and attribute nodes
  15003. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15004. return;
  15005. }
  15006. // Fallback to prop when attributes are not supported
  15007. if ( typeof elem.getAttribute === "undefined" ) {
  15008. return jQuery.prop( elem, name, value );
  15009. }
  15010. // Attribute hooks are determined by the lowercase version
  15011. // Grab necessary hook if one is defined
  15012. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15013. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15014. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15015. }
  15016. if ( value !== undefined ) {
  15017. if ( value === null ) {
  15018. jQuery.removeAttr( elem, name );
  15019. return;
  15020. }
  15021. if ( hooks && "set" in hooks &&
  15022. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15023. return ret;
  15024. }
  15025. elem.setAttribute( name, value + "" );
  15026. return value;
  15027. }
  15028. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15029. return ret;
  15030. }
  15031. ret = jQuery.find.attr( elem, name );
  15032. // Non-existent attributes return null, we normalize to undefined
  15033. return ret == null ? undefined : ret;
  15034. },
  15035. attrHooks: {
  15036. type: {
  15037. set: function( elem, value ) {
  15038. if ( !support.radioValue && value === "radio" &&
  15039. nodeName( elem, "input" ) ) {
  15040. var val = elem.value;
  15041. elem.setAttribute( "type", value );
  15042. if ( val ) {
  15043. elem.value = val;
  15044. }
  15045. return value;
  15046. }
  15047. }
  15048. }
  15049. },
  15050. removeAttr: function( elem, value ) {
  15051. var name,
  15052. i = 0,
  15053. // Attribute names can contain non-HTML whitespace characters
  15054. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15055. attrNames = value && value.match( rnothtmlwhite );
  15056. if ( attrNames && elem.nodeType === 1 ) {
  15057. while ( ( name = attrNames[ i++ ] ) ) {
  15058. elem.removeAttribute( name );
  15059. }
  15060. }
  15061. }
  15062. } );
  15063. // Hooks for boolean attributes
  15064. boolHook = {
  15065. set: function( elem, value, name ) {
  15066. if ( value === false ) {
  15067. // Remove boolean attributes when set to false
  15068. jQuery.removeAttr( elem, name );
  15069. } else {
  15070. elem.setAttribute( name, name );
  15071. }
  15072. return name;
  15073. }
  15074. };
  15075. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15076. var getter = attrHandle[ name ] || jQuery.find.attr;
  15077. attrHandle[ name ] = function( elem, name, isXML ) {
  15078. var ret, handle,
  15079. lowercaseName = name.toLowerCase();
  15080. if ( !isXML ) {
  15081. // Avoid an infinite loop by temporarily removing this function from the getter
  15082. handle = attrHandle[ lowercaseName ];
  15083. attrHandle[ lowercaseName ] = ret;
  15084. ret = getter( elem, name, isXML ) != null ?
  15085. lowercaseName :
  15086. null;
  15087. attrHandle[ lowercaseName ] = handle;
  15088. }
  15089. return ret;
  15090. };
  15091. } );
  15092. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15093. rclickable = /^(?:a|area)$/i;
  15094. jQuery.fn.extend( {
  15095. prop: function( name, value ) {
  15096. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15097. },
  15098. removeProp: function( name ) {
  15099. return this.each( function() {
  15100. delete this[ jQuery.propFix[ name ] || name ];
  15101. } );
  15102. }
  15103. } );
  15104. jQuery.extend( {
  15105. prop: function( elem, name, value ) {
  15106. var ret, hooks,
  15107. nType = elem.nodeType;
  15108. // Don't get/set properties on text, comment and attribute nodes
  15109. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15110. return;
  15111. }
  15112. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15113. // Fix name and attach hooks
  15114. name = jQuery.propFix[ name ] || name;
  15115. hooks = jQuery.propHooks[ name ];
  15116. }
  15117. if ( value !== undefined ) {
  15118. if ( hooks && "set" in hooks &&
  15119. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15120. return ret;
  15121. }
  15122. return ( elem[ name ] = value );
  15123. }
  15124. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15125. return ret;
  15126. }
  15127. return elem[ name ];
  15128. },
  15129. propHooks: {
  15130. tabIndex: {
  15131. get: function( elem ) {
  15132. // Support: IE <=9 - 11 only
  15133. // elem.tabIndex doesn't always return the
  15134. // correct value when it hasn't been explicitly set
  15135. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15136. // Use proper attribute retrieval(#12072)
  15137. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15138. if ( tabindex ) {
  15139. return parseInt( tabindex, 10 );
  15140. }
  15141. if (
  15142. rfocusable.test( elem.nodeName ) ||
  15143. rclickable.test( elem.nodeName ) &&
  15144. elem.href
  15145. ) {
  15146. return 0;
  15147. }
  15148. return -1;
  15149. }
  15150. }
  15151. },
  15152. propFix: {
  15153. "for": "htmlFor",
  15154. "class": "className"
  15155. }
  15156. } );
  15157. // Support: IE <=11 only
  15158. // Accessing the selectedIndex property
  15159. // forces the browser to respect setting selected
  15160. // on the option
  15161. // The getter ensures a default option is selected
  15162. // when in an optgroup
  15163. // eslint rule "no-unused-expressions" is disabled for this code
  15164. // since it considers such accessions noop
  15165. if ( !support.optSelected ) {
  15166. jQuery.propHooks.selected = {
  15167. get: function( elem ) {
  15168. /* eslint no-unused-expressions: "off" */
  15169. var parent = elem.parentNode;
  15170. if ( parent && parent.parentNode ) {
  15171. parent.parentNode.selectedIndex;
  15172. }
  15173. return null;
  15174. },
  15175. set: function( elem ) {
  15176. /* eslint no-unused-expressions: "off" */
  15177. var parent = elem.parentNode;
  15178. if ( parent ) {
  15179. parent.selectedIndex;
  15180. if ( parent.parentNode ) {
  15181. parent.parentNode.selectedIndex;
  15182. }
  15183. }
  15184. }
  15185. };
  15186. }
  15187. jQuery.each( [
  15188. "tabIndex",
  15189. "readOnly",
  15190. "maxLength",
  15191. "cellSpacing",
  15192. "cellPadding",
  15193. "rowSpan",
  15194. "colSpan",
  15195. "useMap",
  15196. "frameBorder",
  15197. "contentEditable"
  15198. ], function() {
  15199. jQuery.propFix[ this.toLowerCase() ] = this;
  15200. } );
  15201. // Strip and collapse whitespace according to HTML spec
  15202. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15203. function stripAndCollapse( value ) {
  15204. var tokens = value.match( rnothtmlwhite ) || [];
  15205. return tokens.join( " " );
  15206. }
  15207. function getClass( elem ) {
  15208. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15209. }
  15210. function classesToArray( value ) {
  15211. if ( Array.isArray( value ) ) {
  15212. return value;
  15213. }
  15214. if ( typeof value === "string" ) {
  15215. return value.match( rnothtmlwhite ) || [];
  15216. }
  15217. return [];
  15218. }
  15219. jQuery.fn.extend( {
  15220. addClass: function( value ) {
  15221. var classes, elem, cur, curValue, clazz, j, finalValue,
  15222. i = 0;
  15223. if ( isFunction( value ) ) {
  15224. return this.each( function( j ) {
  15225. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15226. } );
  15227. }
  15228. classes = classesToArray( value );
  15229. if ( classes.length ) {
  15230. while ( ( elem = this[ i++ ] ) ) {
  15231. curValue = getClass( elem );
  15232. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15233. if ( cur ) {
  15234. j = 0;
  15235. while ( ( clazz = classes[ j++ ] ) ) {
  15236. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15237. cur += clazz + " ";
  15238. }
  15239. }
  15240. // Only assign if different to avoid unneeded rendering.
  15241. finalValue = stripAndCollapse( cur );
  15242. if ( curValue !== finalValue ) {
  15243. elem.setAttribute( "class", finalValue );
  15244. }
  15245. }
  15246. }
  15247. }
  15248. return this;
  15249. },
  15250. removeClass: function( value ) {
  15251. var classes, elem, cur, curValue, clazz, j, finalValue,
  15252. i = 0;
  15253. if ( isFunction( value ) ) {
  15254. return this.each( function( j ) {
  15255. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15256. } );
  15257. }
  15258. if ( !arguments.length ) {
  15259. return this.attr( "class", "" );
  15260. }
  15261. classes = classesToArray( value );
  15262. if ( classes.length ) {
  15263. while ( ( elem = this[ i++ ] ) ) {
  15264. curValue = getClass( elem );
  15265. // This expression is here for better compressibility (see addClass)
  15266. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15267. if ( cur ) {
  15268. j = 0;
  15269. while ( ( clazz = classes[ j++ ] ) ) {
  15270. // Remove *all* instances
  15271. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15272. cur = cur.replace( " " + clazz + " ", " " );
  15273. }
  15274. }
  15275. // Only assign if different to avoid unneeded rendering.
  15276. finalValue = stripAndCollapse( cur );
  15277. if ( curValue !== finalValue ) {
  15278. elem.setAttribute( "class", finalValue );
  15279. }
  15280. }
  15281. }
  15282. }
  15283. return this;
  15284. },
  15285. toggleClass: function( value, stateVal ) {
  15286. var type = typeof value,
  15287. isValidValue = type === "string" || Array.isArray( value );
  15288. if ( typeof stateVal === "boolean" && isValidValue ) {
  15289. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15290. }
  15291. if ( isFunction( value ) ) {
  15292. return this.each( function( i ) {
  15293. jQuery( this ).toggleClass(
  15294. value.call( this, i, getClass( this ), stateVal ),
  15295. stateVal
  15296. );
  15297. } );
  15298. }
  15299. return this.each( function() {
  15300. var className, i, self, classNames;
  15301. if ( isValidValue ) {
  15302. // Toggle individual class names
  15303. i = 0;
  15304. self = jQuery( this );
  15305. classNames = classesToArray( value );
  15306. while ( ( className = classNames[ i++ ] ) ) {
  15307. // Check each className given, space separated list
  15308. if ( self.hasClass( className ) ) {
  15309. self.removeClass( className );
  15310. } else {
  15311. self.addClass( className );
  15312. }
  15313. }
  15314. // Toggle whole class name
  15315. } else if ( value === undefined || type === "boolean" ) {
  15316. className = getClass( this );
  15317. if ( className ) {
  15318. // Store className if set
  15319. dataPriv.set( this, "__className__", className );
  15320. }
  15321. // If the element has a class name or if we're passed `false`,
  15322. // then remove the whole classname (if there was one, the above saved it).
  15323. // Otherwise bring back whatever was previously saved (if anything),
  15324. // falling back to the empty string if nothing was stored.
  15325. if ( this.setAttribute ) {
  15326. this.setAttribute( "class",
  15327. className || value === false ?
  15328. "" :
  15329. dataPriv.get( this, "__className__" ) || ""
  15330. );
  15331. }
  15332. }
  15333. } );
  15334. },
  15335. hasClass: function( selector ) {
  15336. var className, elem,
  15337. i = 0;
  15338. className = " " + selector + " ";
  15339. while ( ( elem = this[ i++ ] ) ) {
  15340. if ( elem.nodeType === 1 &&
  15341. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15342. return true;
  15343. }
  15344. }
  15345. return false;
  15346. }
  15347. } );
  15348. var rreturn = /\r/g;
  15349. jQuery.fn.extend( {
  15350. val: function( value ) {
  15351. var hooks, ret, valueIsFunction,
  15352. elem = this[ 0 ];
  15353. if ( !arguments.length ) {
  15354. if ( elem ) {
  15355. hooks = jQuery.valHooks[ elem.type ] ||
  15356. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15357. if ( hooks &&
  15358. "get" in hooks &&
  15359. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15360. ) {
  15361. return ret;
  15362. }
  15363. ret = elem.value;
  15364. // Handle most common string cases
  15365. if ( typeof ret === "string" ) {
  15366. return ret.replace( rreturn, "" );
  15367. }
  15368. // Handle cases where value is null/undef or number
  15369. return ret == null ? "" : ret;
  15370. }
  15371. return;
  15372. }
  15373. valueIsFunction = isFunction( value );
  15374. return this.each( function( i ) {
  15375. var val;
  15376. if ( this.nodeType !== 1 ) {
  15377. return;
  15378. }
  15379. if ( valueIsFunction ) {
  15380. val = value.call( this, i, jQuery( this ).val() );
  15381. } else {
  15382. val = value;
  15383. }
  15384. // Treat null/undefined as ""; convert numbers to string
  15385. if ( val == null ) {
  15386. val = "";
  15387. } else if ( typeof val === "number" ) {
  15388. val += "";
  15389. } else if ( Array.isArray( val ) ) {
  15390. val = jQuery.map( val, function( value ) {
  15391. return value == null ? "" : value + "";
  15392. } );
  15393. }
  15394. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15395. // If set returns undefined, fall back to normal setting
  15396. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15397. this.value = val;
  15398. }
  15399. } );
  15400. }
  15401. } );
  15402. jQuery.extend( {
  15403. valHooks: {
  15404. option: {
  15405. get: function( elem ) {
  15406. var val = jQuery.find.attr( elem, "value" );
  15407. return val != null ?
  15408. val :
  15409. // Support: IE <=10 - 11 only
  15410. // option.text throws exceptions (#14686, #14858)
  15411. // Strip and collapse whitespace
  15412. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15413. stripAndCollapse( jQuery.text( elem ) );
  15414. }
  15415. },
  15416. select: {
  15417. get: function( elem ) {
  15418. var value, option, i,
  15419. options = elem.options,
  15420. index = elem.selectedIndex,
  15421. one = elem.type === "select-one",
  15422. values = one ? null : [],
  15423. max = one ? index + 1 : options.length;
  15424. if ( index < 0 ) {
  15425. i = max;
  15426. } else {
  15427. i = one ? index : 0;
  15428. }
  15429. // Loop through all the selected options
  15430. for ( ; i < max; i++ ) {
  15431. option = options[ i ];
  15432. // Support: IE <=9 only
  15433. // IE8-9 doesn't update selected after form reset (#2551)
  15434. if ( ( option.selected || i === index ) &&
  15435. // Don't return options that are disabled or in a disabled optgroup
  15436. !option.disabled &&
  15437. ( !option.parentNode.disabled ||
  15438. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15439. // Get the specific value for the option
  15440. value = jQuery( option ).val();
  15441. // We don't need an array for one selects
  15442. if ( one ) {
  15443. return value;
  15444. }
  15445. // Multi-Selects return an array
  15446. values.push( value );
  15447. }
  15448. }
  15449. return values;
  15450. },
  15451. set: function( elem, value ) {
  15452. var optionSet, option,
  15453. options = elem.options,
  15454. values = jQuery.makeArray( value ),
  15455. i = options.length;
  15456. while ( i-- ) {
  15457. option = options[ i ];
  15458. /* eslint-disable no-cond-assign */
  15459. if ( option.selected =
  15460. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15461. ) {
  15462. optionSet = true;
  15463. }
  15464. /* eslint-enable no-cond-assign */
  15465. }
  15466. // Force browsers to behave consistently when non-matching value is set
  15467. if ( !optionSet ) {
  15468. elem.selectedIndex = -1;
  15469. }
  15470. return values;
  15471. }
  15472. }
  15473. }
  15474. } );
  15475. // Radios and checkboxes getter/setter
  15476. jQuery.each( [ "radio", "checkbox" ], function() {
  15477. jQuery.valHooks[ this ] = {
  15478. set: function( elem, value ) {
  15479. if ( Array.isArray( value ) ) {
  15480. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15481. }
  15482. }
  15483. };
  15484. if ( !support.checkOn ) {
  15485. jQuery.valHooks[ this ].get = function( elem ) {
  15486. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15487. };
  15488. }
  15489. } );
  15490. // Return jQuery for attributes-only inclusion
  15491. support.focusin = "onfocusin" in window;
  15492. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15493. stopPropagationCallback = function( e ) {
  15494. e.stopPropagation();
  15495. };
  15496. jQuery.extend( jQuery.event, {
  15497. trigger: function( event, data, elem, onlyHandlers ) {
  15498. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15499. eventPath = [ elem || document ],
  15500. type = hasOwn.call( event, "type" ) ? event.type : event,
  15501. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15502. cur = lastElement = tmp = elem = elem || document;
  15503. // Don't do events on text and comment nodes
  15504. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15505. return;
  15506. }
  15507. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15508. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15509. return;
  15510. }
  15511. if ( type.indexOf( "." ) > -1 ) {
  15512. // Namespaced trigger; create a regexp to match event type in handle()
  15513. namespaces = type.split( "." );
  15514. type = namespaces.shift();
  15515. namespaces.sort();
  15516. }
  15517. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15518. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15519. event = event[ jQuery.expando ] ?
  15520. event :
  15521. new jQuery.Event( type, typeof event === "object" && event );
  15522. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15523. event.isTrigger = onlyHandlers ? 2 : 3;
  15524. event.namespace = namespaces.join( "." );
  15525. event.rnamespace = event.namespace ?
  15526. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15527. null;
  15528. // Clean up the event in case it is being reused
  15529. event.result = undefined;
  15530. if ( !event.target ) {
  15531. event.target = elem;
  15532. }
  15533. // Clone any incoming data and prepend the event, creating the handler arg list
  15534. data = data == null ?
  15535. [ event ] :
  15536. jQuery.makeArray( data, [ event ] );
  15537. // Allow special events to draw outside the lines
  15538. special = jQuery.event.special[ type ] || {};
  15539. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15540. return;
  15541. }
  15542. // Determine event propagation path in advance, per W3C events spec (#9951)
  15543. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15544. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15545. bubbleType = special.delegateType || type;
  15546. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15547. cur = cur.parentNode;
  15548. }
  15549. for ( ; cur; cur = cur.parentNode ) {
  15550. eventPath.push( cur );
  15551. tmp = cur;
  15552. }
  15553. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15554. if ( tmp === ( elem.ownerDocument || document ) ) {
  15555. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15556. }
  15557. }
  15558. // Fire handlers on the event path
  15559. i = 0;
  15560. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15561. lastElement = cur;
  15562. event.type = i > 1 ?
  15563. bubbleType :
  15564. special.bindType || type;
  15565. // jQuery handler
  15566. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15567. dataPriv.get( cur, "handle" );
  15568. if ( handle ) {
  15569. handle.apply( cur, data );
  15570. }
  15571. // Native handler
  15572. handle = ontype && cur[ ontype ];
  15573. if ( handle && handle.apply && acceptData( cur ) ) {
  15574. event.result = handle.apply( cur, data );
  15575. if ( event.result === false ) {
  15576. event.preventDefault();
  15577. }
  15578. }
  15579. }
  15580. event.type = type;
  15581. // If nobody prevented the default action, do it now
  15582. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15583. if ( ( !special._default ||
  15584. special._default.apply( eventPath.pop(), data ) === false ) &&
  15585. acceptData( elem ) ) {
  15586. // Call a native DOM method on the target with the same name as the event.
  15587. // Don't do default actions on window, that's where global variables be (#6170)
  15588. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15589. // Don't re-trigger an onFOO event when we call its FOO() method
  15590. tmp = elem[ ontype ];
  15591. if ( tmp ) {
  15592. elem[ ontype ] = null;
  15593. }
  15594. // Prevent re-triggering of the same event, since we already bubbled it above
  15595. jQuery.event.triggered = type;
  15596. if ( event.isPropagationStopped() ) {
  15597. lastElement.addEventListener( type, stopPropagationCallback );
  15598. }
  15599. elem[ type ]();
  15600. if ( event.isPropagationStopped() ) {
  15601. lastElement.removeEventListener( type, stopPropagationCallback );
  15602. }
  15603. jQuery.event.triggered = undefined;
  15604. if ( tmp ) {
  15605. elem[ ontype ] = tmp;
  15606. }
  15607. }
  15608. }
  15609. }
  15610. return event.result;
  15611. },
  15612. // Piggyback on a donor event to simulate a different one
  15613. // Used only for `focus(in | out)` events
  15614. simulate: function( type, elem, event ) {
  15615. var e = jQuery.extend(
  15616. new jQuery.Event(),
  15617. event,
  15618. {
  15619. type: type,
  15620. isSimulated: true
  15621. }
  15622. );
  15623. jQuery.event.trigger( e, null, elem );
  15624. }
  15625. } );
  15626. jQuery.fn.extend( {
  15627. trigger: function( type, data ) {
  15628. return this.each( function() {
  15629. jQuery.event.trigger( type, data, this );
  15630. } );
  15631. },
  15632. triggerHandler: function( type, data ) {
  15633. var elem = this[ 0 ];
  15634. if ( elem ) {
  15635. return jQuery.event.trigger( type, data, elem, true );
  15636. }
  15637. }
  15638. } );
  15639. // Support: Firefox <=44
  15640. // Firefox doesn't have focus(in | out) events
  15641. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15642. //
  15643. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15644. // focus(in | out) events fire after focus & blur events,
  15645. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15646. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15647. if ( !support.focusin ) {
  15648. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15649. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15650. var handler = function( event ) {
  15651. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15652. };
  15653. jQuery.event.special[ fix ] = {
  15654. setup: function() {
  15655. var doc = this.ownerDocument || this,
  15656. attaches = dataPriv.access( doc, fix );
  15657. if ( !attaches ) {
  15658. doc.addEventListener( orig, handler, true );
  15659. }
  15660. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15661. },
  15662. teardown: function() {
  15663. var doc = this.ownerDocument || this,
  15664. attaches = dataPriv.access( doc, fix ) - 1;
  15665. if ( !attaches ) {
  15666. doc.removeEventListener( orig, handler, true );
  15667. dataPriv.remove( doc, fix );
  15668. } else {
  15669. dataPriv.access( doc, fix, attaches );
  15670. }
  15671. }
  15672. };
  15673. } );
  15674. }
  15675. var location = window.location;
  15676. var nonce = Date.now();
  15677. var rquery = ( /\?/ );
  15678. // Cross-browser xml parsing
  15679. jQuery.parseXML = function( data ) {
  15680. var xml;
  15681. if ( !data || typeof data !== "string" ) {
  15682. return null;
  15683. }
  15684. // Support: IE 9 - 11 only
  15685. // IE throws on parseFromString with invalid input.
  15686. try {
  15687. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15688. } catch ( e ) {
  15689. xml = undefined;
  15690. }
  15691. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15692. jQuery.error( "Invalid XML: " + data );
  15693. }
  15694. return xml;
  15695. };
  15696. var
  15697. rbracket = /\[\]$/,
  15698. rCRLF = /\r?\n/g,
  15699. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15700. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15701. function buildParams( prefix, obj, traditional, add ) {
  15702. var name;
  15703. if ( Array.isArray( obj ) ) {
  15704. // Serialize array item.
  15705. jQuery.each( obj, function( i, v ) {
  15706. if ( traditional || rbracket.test( prefix ) ) {
  15707. // Treat each array item as a scalar.
  15708. add( prefix, v );
  15709. } else {
  15710. // Item is non-scalar (array or object), encode its numeric index.
  15711. buildParams(
  15712. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15713. v,
  15714. traditional,
  15715. add
  15716. );
  15717. }
  15718. } );
  15719. } else if ( !traditional && toType( obj ) === "object" ) {
  15720. // Serialize object item.
  15721. for ( name in obj ) {
  15722. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15723. }
  15724. } else {
  15725. // Serialize scalar item.
  15726. add( prefix, obj );
  15727. }
  15728. }
  15729. // Serialize an array of form elements or a set of
  15730. // key/values into a query string
  15731. jQuery.param = function( a, traditional ) {
  15732. var prefix,
  15733. s = [],
  15734. add = function( key, valueOrFunction ) {
  15735. // If value is a function, invoke it and use its return value
  15736. var value = isFunction( valueOrFunction ) ?
  15737. valueOrFunction() :
  15738. valueOrFunction;
  15739. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15740. encodeURIComponent( value == null ? "" : value );
  15741. };
  15742. if ( a == null ) {
  15743. return "";
  15744. }
  15745. // If an array was passed in, assume that it is an array of form elements.
  15746. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15747. // Serialize the form elements
  15748. jQuery.each( a, function() {
  15749. add( this.name, this.value );
  15750. } );
  15751. } else {
  15752. // If traditional, encode the "old" way (the way 1.3.2 or older
  15753. // did it), otherwise encode params recursively.
  15754. for ( prefix in a ) {
  15755. buildParams( prefix, a[ prefix ], traditional, add );
  15756. }
  15757. }
  15758. // Return the resulting serialization
  15759. return s.join( "&" );
  15760. };
  15761. jQuery.fn.extend( {
  15762. serialize: function() {
  15763. return jQuery.param( this.serializeArray() );
  15764. },
  15765. serializeArray: function() {
  15766. return this.map( function() {
  15767. // Can add propHook for "elements" to filter or add form elements
  15768. var elements = jQuery.prop( this, "elements" );
  15769. return elements ? jQuery.makeArray( elements ) : this;
  15770. } )
  15771. .filter( function() {
  15772. var type = this.type;
  15773. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15774. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15775. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15776. ( this.checked || !rcheckableType.test( type ) );
  15777. } )
  15778. .map( function( i, elem ) {
  15779. var val = jQuery( this ).val();
  15780. if ( val == null ) {
  15781. return null;
  15782. }
  15783. if ( Array.isArray( val ) ) {
  15784. return jQuery.map( val, function( val ) {
  15785. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15786. } );
  15787. }
  15788. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15789. } ).get();
  15790. }
  15791. } );
  15792. var
  15793. r20 = /%20/g,
  15794. rhash = /#.*$/,
  15795. rantiCache = /([?&])_=[^&]*/,
  15796. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15797. // #7653, #8125, #8152: local protocol detection
  15798. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15799. rnoContent = /^(?:GET|HEAD)$/,
  15800. rprotocol = /^\/\//,
  15801. /* Prefilters
  15802. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15803. * 2) These are called:
  15804. * - BEFORE asking for a transport
  15805. * - AFTER param serialization (s.data is a string if s.processData is true)
  15806. * 3) key is the dataType
  15807. * 4) the catchall symbol "*" can be used
  15808. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15809. */
  15810. prefilters = {},
  15811. /* Transports bindings
  15812. * 1) key is the dataType
  15813. * 2) the catchall symbol "*" can be used
  15814. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15815. */
  15816. transports = {},
  15817. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15818. allTypes = "*/".concat( "*" ),
  15819. // Anchor tag for parsing the document origin
  15820. originAnchor = document.createElement( "a" );
  15821. originAnchor.href = location.href;
  15822. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15823. function addToPrefiltersOrTransports( structure ) {
  15824. // dataTypeExpression is optional and defaults to "*"
  15825. return function( dataTypeExpression, func ) {
  15826. if ( typeof dataTypeExpression !== "string" ) {
  15827. func = dataTypeExpression;
  15828. dataTypeExpression = "*";
  15829. }
  15830. var dataType,
  15831. i = 0,
  15832. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15833. if ( isFunction( func ) ) {
  15834. // For each dataType in the dataTypeExpression
  15835. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15836. // Prepend if requested
  15837. if ( dataType[ 0 ] === "+" ) {
  15838. dataType = dataType.slice( 1 ) || "*";
  15839. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15840. // Otherwise append
  15841. } else {
  15842. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15843. }
  15844. }
  15845. }
  15846. };
  15847. }
  15848. // Base inspection function for prefilters and transports
  15849. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15850. var inspected = {},
  15851. seekingTransport = ( structure === transports );
  15852. function inspect( dataType ) {
  15853. var selected;
  15854. inspected[ dataType ] = true;
  15855. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15856. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15857. if ( typeof dataTypeOrTransport === "string" &&
  15858. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15859. options.dataTypes.unshift( dataTypeOrTransport );
  15860. inspect( dataTypeOrTransport );
  15861. return false;
  15862. } else if ( seekingTransport ) {
  15863. return !( selected = dataTypeOrTransport );
  15864. }
  15865. } );
  15866. return selected;
  15867. }
  15868. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15869. }
  15870. // A special extend for ajax options
  15871. // that takes "flat" options (not to be deep extended)
  15872. // Fixes #9887
  15873. function ajaxExtend( target, src ) {
  15874. var key, deep,
  15875. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15876. for ( key in src ) {
  15877. if ( src[ key ] !== undefined ) {
  15878. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15879. }
  15880. }
  15881. if ( deep ) {
  15882. jQuery.extend( true, target, deep );
  15883. }
  15884. return target;
  15885. }
  15886. /* Handles responses to an ajax request:
  15887. * - finds the right dataType (mediates between content-type and expected dataType)
  15888. * - returns the corresponding response
  15889. */
  15890. function ajaxHandleResponses( s, jqXHR, responses ) {
  15891. var ct, type, finalDataType, firstDataType,
  15892. contents = s.contents,
  15893. dataTypes = s.dataTypes;
  15894. // Remove auto dataType and get content-type in the process
  15895. while ( dataTypes[ 0 ] === "*" ) {
  15896. dataTypes.shift();
  15897. if ( ct === undefined ) {
  15898. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15899. }
  15900. }
  15901. // Check if we're dealing with a known content-type
  15902. if ( ct ) {
  15903. for ( type in contents ) {
  15904. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15905. dataTypes.unshift( type );
  15906. break;
  15907. }
  15908. }
  15909. }
  15910. // Check to see if we have a response for the expected dataType
  15911. if ( dataTypes[ 0 ] in responses ) {
  15912. finalDataType = dataTypes[ 0 ];
  15913. } else {
  15914. // Try convertible dataTypes
  15915. for ( type in responses ) {
  15916. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15917. finalDataType = type;
  15918. break;
  15919. }
  15920. if ( !firstDataType ) {
  15921. firstDataType = type;
  15922. }
  15923. }
  15924. // Or just use first one
  15925. finalDataType = finalDataType || firstDataType;
  15926. }
  15927. // If we found a dataType
  15928. // We add the dataType to the list if needed
  15929. // and return the corresponding response
  15930. if ( finalDataType ) {
  15931. if ( finalDataType !== dataTypes[ 0 ] ) {
  15932. dataTypes.unshift( finalDataType );
  15933. }
  15934. return responses[ finalDataType ];
  15935. }
  15936. }
  15937. /* Chain conversions given the request and the original response
  15938. * Also sets the responseXXX fields on the jqXHR instance
  15939. */
  15940. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15941. var conv2, current, conv, tmp, prev,
  15942. converters = {},
  15943. // Work with a copy of dataTypes in case we need to modify it for conversion
  15944. dataTypes = s.dataTypes.slice();
  15945. // Create converters map with lowercased keys
  15946. if ( dataTypes[ 1 ] ) {
  15947. for ( conv in s.converters ) {
  15948. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15949. }
  15950. }
  15951. current = dataTypes.shift();
  15952. // Convert to each sequential dataType
  15953. while ( current ) {
  15954. if ( s.responseFields[ current ] ) {
  15955. jqXHR[ s.responseFields[ current ] ] = response;
  15956. }
  15957. // Apply the dataFilter if provided
  15958. if ( !prev && isSuccess && s.dataFilter ) {
  15959. response = s.dataFilter( response, s.dataType );
  15960. }
  15961. prev = current;
  15962. current = dataTypes.shift();
  15963. if ( current ) {
  15964. // There's only work to do if current dataType is non-auto
  15965. if ( current === "*" ) {
  15966. current = prev;
  15967. // Convert response if prev dataType is non-auto and differs from current
  15968. } else if ( prev !== "*" && prev !== current ) {
  15969. // Seek a direct converter
  15970. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15971. // If none found, seek a pair
  15972. if ( !conv ) {
  15973. for ( conv2 in converters ) {
  15974. // If conv2 outputs current
  15975. tmp = conv2.split( " " );
  15976. if ( tmp[ 1 ] === current ) {
  15977. // If prev can be converted to accepted input
  15978. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15979. converters[ "* " + tmp[ 0 ] ];
  15980. if ( conv ) {
  15981. // Condense equivalence converters
  15982. if ( conv === true ) {
  15983. conv = converters[ conv2 ];
  15984. // Otherwise, insert the intermediate dataType
  15985. } else if ( converters[ conv2 ] !== true ) {
  15986. current = tmp[ 0 ];
  15987. dataTypes.unshift( tmp[ 1 ] );
  15988. }
  15989. break;
  15990. }
  15991. }
  15992. }
  15993. }
  15994. // Apply converter (if not an equivalence)
  15995. if ( conv !== true ) {
  15996. // Unless errors are allowed to bubble, catch and return them
  15997. if ( conv && s.throws ) {
  15998. response = conv( response );
  15999. } else {
  16000. try {
  16001. response = conv( response );
  16002. } catch ( e ) {
  16003. return {
  16004. state: "parsererror",
  16005. error: conv ? e : "No conversion from " + prev + " to " + current
  16006. };
  16007. }
  16008. }
  16009. }
  16010. }
  16011. }
  16012. }
  16013. return { state: "success", data: response };
  16014. }
  16015. jQuery.extend( {
  16016. // Counter for holding the number of active queries
  16017. active: 0,
  16018. // Last-Modified header cache for next request
  16019. lastModified: {},
  16020. etag: {},
  16021. ajaxSettings: {
  16022. url: location.href,
  16023. type: "GET",
  16024. isLocal: rlocalProtocol.test( location.protocol ),
  16025. global: true,
  16026. processData: true,
  16027. async: true,
  16028. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16029. /*
  16030. timeout: 0,
  16031. data: null,
  16032. dataType: null,
  16033. username: null,
  16034. password: null,
  16035. cache: null,
  16036. throws: false,
  16037. traditional: false,
  16038. headers: {},
  16039. */
  16040. accepts: {
  16041. "*": allTypes,
  16042. text: "text/plain",
  16043. html: "text/html",
  16044. xml: "application/xml, text/xml",
  16045. json: "application/json, text/javascript"
  16046. },
  16047. contents: {
  16048. xml: /\bxml\b/,
  16049. html: /\bhtml/,
  16050. json: /\bjson\b/
  16051. },
  16052. responseFields: {
  16053. xml: "responseXML",
  16054. text: "responseText",
  16055. json: "responseJSON"
  16056. },
  16057. // Data converters
  16058. // Keys separate source (or catchall "*") and destination types with a single space
  16059. converters: {
  16060. // Convert anything to text
  16061. "* text": String,
  16062. // Text to html (true = no transformation)
  16063. "text html": true,
  16064. // Evaluate text as a json expression
  16065. "text json": JSON.parse,
  16066. // Parse text as xml
  16067. "text xml": jQuery.parseXML
  16068. },
  16069. // For options that shouldn't be deep extended:
  16070. // you can add your own custom options here if
  16071. // and when you create one that shouldn't be
  16072. // deep extended (see ajaxExtend)
  16073. flatOptions: {
  16074. url: true,
  16075. context: true
  16076. }
  16077. },
  16078. // Creates a full fledged settings object into target
  16079. // with both ajaxSettings and settings fields.
  16080. // If target is omitted, writes into ajaxSettings.
  16081. ajaxSetup: function( target, settings ) {
  16082. return settings ?
  16083. // Building a settings object
  16084. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16085. // Extending ajaxSettings
  16086. ajaxExtend( jQuery.ajaxSettings, target );
  16087. },
  16088. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16089. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16090. // Main method
  16091. ajax: function( url, options ) {
  16092. // If url is an object, simulate pre-1.5 signature
  16093. if ( typeof url === "object" ) {
  16094. options = url;
  16095. url = undefined;
  16096. }
  16097. // Force options to be an object
  16098. options = options || {};
  16099. var transport,
  16100. // URL without anti-cache param
  16101. cacheURL,
  16102. // Response headers
  16103. responseHeadersString,
  16104. responseHeaders,
  16105. // timeout handle
  16106. timeoutTimer,
  16107. // Url cleanup var
  16108. urlAnchor,
  16109. // Request state (becomes false upon send and true upon completion)
  16110. completed,
  16111. // To know if global events are to be dispatched
  16112. fireGlobals,
  16113. // Loop variable
  16114. i,
  16115. // uncached part of the url
  16116. uncached,
  16117. // Create the final options object
  16118. s = jQuery.ajaxSetup( {}, options ),
  16119. // Callbacks context
  16120. callbackContext = s.context || s,
  16121. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16122. globalEventContext = s.context &&
  16123. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16124. jQuery( callbackContext ) :
  16125. jQuery.event,
  16126. // Deferreds
  16127. deferred = jQuery.Deferred(),
  16128. completeDeferred = jQuery.Callbacks( "once memory" ),
  16129. // Status-dependent callbacks
  16130. statusCode = s.statusCode || {},
  16131. // Headers (they are sent all at once)
  16132. requestHeaders = {},
  16133. requestHeadersNames = {},
  16134. // Default abort message
  16135. strAbort = "canceled",
  16136. // Fake xhr
  16137. jqXHR = {
  16138. readyState: 0,
  16139. // Builds headers hashtable if needed
  16140. getResponseHeader: function( key ) {
  16141. var match;
  16142. if ( completed ) {
  16143. if ( !responseHeaders ) {
  16144. responseHeaders = {};
  16145. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16146. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16147. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16148. .concat( match[ 2 ] );
  16149. }
  16150. }
  16151. match = responseHeaders[ key.toLowerCase() + " " ];
  16152. }
  16153. return match == null ? null : match.join( ", " );
  16154. },
  16155. // Raw string
  16156. getAllResponseHeaders: function() {
  16157. return completed ? responseHeadersString : null;
  16158. },
  16159. // Caches the header
  16160. setRequestHeader: function( name, value ) {
  16161. if ( completed == null ) {
  16162. name = requestHeadersNames[ name.toLowerCase() ] =
  16163. requestHeadersNames[ name.toLowerCase() ] || name;
  16164. requestHeaders[ name ] = value;
  16165. }
  16166. return this;
  16167. },
  16168. // Overrides response content-type header
  16169. overrideMimeType: function( type ) {
  16170. if ( completed == null ) {
  16171. s.mimeType = type;
  16172. }
  16173. return this;
  16174. },
  16175. // Status-dependent callbacks
  16176. statusCode: function( map ) {
  16177. var code;
  16178. if ( map ) {
  16179. if ( completed ) {
  16180. // Execute the appropriate callbacks
  16181. jqXHR.always( map[ jqXHR.status ] );
  16182. } else {
  16183. // Lazy-add the new callbacks in a way that preserves old ones
  16184. for ( code in map ) {
  16185. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16186. }
  16187. }
  16188. }
  16189. return this;
  16190. },
  16191. // Cancel the request
  16192. abort: function( statusText ) {
  16193. var finalText = statusText || strAbort;
  16194. if ( transport ) {
  16195. transport.abort( finalText );
  16196. }
  16197. done( 0, finalText );
  16198. return this;
  16199. }
  16200. };
  16201. // Attach deferreds
  16202. deferred.promise( jqXHR );
  16203. // Add protocol if not provided (prefilters might expect it)
  16204. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16205. // We also use the url parameter if available
  16206. s.url = ( ( url || s.url || location.href ) + "" )
  16207. .replace( rprotocol, location.protocol + "//" );
  16208. // Alias method option to type as per ticket #12004
  16209. s.type = options.method || options.type || s.method || s.type;
  16210. // Extract dataTypes list
  16211. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16212. // A cross-domain request is in order when the origin doesn't match the current origin.
  16213. if ( s.crossDomain == null ) {
  16214. urlAnchor = document.createElement( "a" );
  16215. // Support: IE <=8 - 11, Edge 12 - 15
  16216. // IE throws exception on accessing the href property if url is malformed,
  16217. // e.g. http://example.com:80x/
  16218. try {
  16219. urlAnchor.href = s.url;
  16220. // Support: IE <=8 - 11 only
  16221. // Anchor's host property isn't correctly set when s.url is relative
  16222. urlAnchor.href = urlAnchor.href;
  16223. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16224. urlAnchor.protocol + "//" + urlAnchor.host;
  16225. } catch ( e ) {
  16226. // If there is an error parsing the URL, assume it is crossDomain,
  16227. // it can be rejected by the transport if it is invalid
  16228. s.crossDomain = true;
  16229. }
  16230. }
  16231. // Convert data if not already a string
  16232. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16233. s.data = jQuery.param( s.data, s.traditional );
  16234. }
  16235. // Apply prefilters
  16236. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16237. // If request was aborted inside a prefilter, stop there
  16238. if ( completed ) {
  16239. return jqXHR;
  16240. }
  16241. // We can fire global events as of now if asked to
  16242. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16243. fireGlobals = jQuery.event && s.global;
  16244. // Watch for a new set of requests
  16245. if ( fireGlobals && jQuery.active++ === 0 ) {
  16246. jQuery.event.trigger( "ajaxStart" );
  16247. }
  16248. // Uppercase the type
  16249. s.type = s.type.toUpperCase();
  16250. // Determine if request has content
  16251. s.hasContent = !rnoContent.test( s.type );
  16252. // Save the URL in case we're toying with the If-Modified-Since
  16253. // and/or If-None-Match header later on
  16254. // Remove hash to simplify url manipulation
  16255. cacheURL = s.url.replace( rhash, "" );
  16256. // More options handling for requests with no content
  16257. if ( !s.hasContent ) {
  16258. // Remember the hash so we can put it back
  16259. uncached = s.url.slice( cacheURL.length );
  16260. // If data is available and should be processed, append data to url
  16261. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16262. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16263. // #9682: remove data so that it's not used in an eventual retry
  16264. delete s.data;
  16265. }
  16266. // Add or update anti-cache param if needed
  16267. if ( s.cache === false ) {
  16268. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16269. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16270. }
  16271. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16272. s.url = cacheURL + uncached;
  16273. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16274. } else if ( s.data && s.processData &&
  16275. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16276. s.data = s.data.replace( r20, "+" );
  16277. }
  16278. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16279. if ( s.ifModified ) {
  16280. if ( jQuery.lastModified[ cacheURL ] ) {
  16281. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16282. }
  16283. if ( jQuery.etag[ cacheURL ] ) {
  16284. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16285. }
  16286. }
  16287. // Set the correct header, if data is being sent
  16288. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16289. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16290. }
  16291. // Set the Accepts header for the server, depending on the dataType
  16292. jqXHR.setRequestHeader(
  16293. "Accept",
  16294. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16295. s.accepts[ s.dataTypes[ 0 ] ] +
  16296. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16297. s.accepts[ "*" ]
  16298. );
  16299. // Check for headers option
  16300. for ( i in s.headers ) {
  16301. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16302. }
  16303. // Allow custom headers/mimetypes and early abort
  16304. if ( s.beforeSend &&
  16305. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16306. // Abort if not done already and return
  16307. return jqXHR.abort();
  16308. }
  16309. // Aborting is no longer a cancellation
  16310. strAbort = "abort";
  16311. // Install callbacks on deferreds
  16312. completeDeferred.add( s.complete );
  16313. jqXHR.done( s.success );
  16314. jqXHR.fail( s.error );
  16315. // Get transport
  16316. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16317. // If no transport, we auto-abort
  16318. if ( !transport ) {
  16319. done( -1, "No Transport" );
  16320. } else {
  16321. jqXHR.readyState = 1;
  16322. // Send global event
  16323. if ( fireGlobals ) {
  16324. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16325. }
  16326. // If request was aborted inside ajaxSend, stop there
  16327. if ( completed ) {
  16328. return jqXHR;
  16329. }
  16330. // Timeout
  16331. if ( s.async && s.timeout > 0 ) {
  16332. timeoutTimer = window.setTimeout( function() {
  16333. jqXHR.abort( "timeout" );
  16334. }, s.timeout );
  16335. }
  16336. try {
  16337. completed = false;
  16338. transport.send( requestHeaders, done );
  16339. } catch ( e ) {
  16340. // Rethrow post-completion exceptions
  16341. if ( completed ) {
  16342. throw e;
  16343. }
  16344. // Propagate others as results
  16345. done( -1, e );
  16346. }
  16347. }
  16348. // Callback for when everything is done
  16349. function done( status, nativeStatusText, responses, headers ) {
  16350. var isSuccess, success, error, response, modified,
  16351. statusText = nativeStatusText;
  16352. // Ignore repeat invocations
  16353. if ( completed ) {
  16354. return;
  16355. }
  16356. completed = true;
  16357. // Clear timeout if it exists
  16358. if ( timeoutTimer ) {
  16359. window.clearTimeout( timeoutTimer );
  16360. }
  16361. // Dereference transport for early garbage collection
  16362. // (no matter how long the jqXHR object will be used)
  16363. transport = undefined;
  16364. // Cache response headers
  16365. responseHeadersString = headers || "";
  16366. // Set readyState
  16367. jqXHR.readyState = status > 0 ? 4 : 0;
  16368. // Determine if successful
  16369. isSuccess = status >= 200 && status < 300 || status === 304;
  16370. // Get response data
  16371. if ( responses ) {
  16372. response = ajaxHandleResponses( s, jqXHR, responses );
  16373. }
  16374. // Convert no matter what (that way responseXXX fields are always set)
  16375. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16376. // If successful, handle type chaining
  16377. if ( isSuccess ) {
  16378. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16379. if ( s.ifModified ) {
  16380. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16381. if ( modified ) {
  16382. jQuery.lastModified[ cacheURL ] = modified;
  16383. }
  16384. modified = jqXHR.getResponseHeader( "etag" );
  16385. if ( modified ) {
  16386. jQuery.etag[ cacheURL ] = modified;
  16387. }
  16388. }
  16389. // if no content
  16390. if ( status === 204 || s.type === "HEAD" ) {
  16391. statusText = "nocontent";
  16392. // if not modified
  16393. } else if ( status === 304 ) {
  16394. statusText = "notmodified";
  16395. // If we have data, let's convert it
  16396. } else {
  16397. statusText = response.state;
  16398. success = response.data;
  16399. error = response.error;
  16400. isSuccess = !error;
  16401. }
  16402. } else {
  16403. // Extract error from statusText and normalize for non-aborts
  16404. error = statusText;
  16405. if ( status || !statusText ) {
  16406. statusText = "error";
  16407. if ( status < 0 ) {
  16408. status = 0;
  16409. }
  16410. }
  16411. }
  16412. // Set data for the fake xhr object
  16413. jqXHR.status = status;
  16414. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16415. // Success/Error
  16416. if ( isSuccess ) {
  16417. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16418. } else {
  16419. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16420. }
  16421. // Status-dependent callbacks
  16422. jqXHR.statusCode( statusCode );
  16423. statusCode = undefined;
  16424. if ( fireGlobals ) {
  16425. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16426. [ jqXHR, s, isSuccess ? success : error ] );
  16427. }
  16428. // Complete
  16429. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16430. if ( fireGlobals ) {
  16431. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16432. // Handle the global AJAX counter
  16433. if ( !( --jQuery.active ) ) {
  16434. jQuery.event.trigger( "ajaxStop" );
  16435. }
  16436. }
  16437. }
  16438. return jqXHR;
  16439. },
  16440. getJSON: function( url, data, callback ) {
  16441. return jQuery.get( url, data, callback, "json" );
  16442. },
  16443. getScript: function( url, callback ) {
  16444. return jQuery.get( url, undefined, callback, "script" );
  16445. }
  16446. } );
  16447. jQuery.each( [ "get", "post" ], function( i, method ) {
  16448. jQuery[ method ] = function( url, data, callback, type ) {
  16449. // Shift arguments if data argument was omitted
  16450. if ( isFunction( data ) ) {
  16451. type = type || callback;
  16452. callback = data;
  16453. data = undefined;
  16454. }
  16455. // The url can be an options object (which then must have .url)
  16456. return jQuery.ajax( jQuery.extend( {
  16457. url: url,
  16458. type: method,
  16459. dataType: type,
  16460. data: data,
  16461. success: callback
  16462. }, jQuery.isPlainObject( url ) && url ) );
  16463. };
  16464. } );
  16465. jQuery._evalUrl = function( url, options ) {
  16466. return jQuery.ajax( {
  16467. url: url,
  16468. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16469. type: "GET",
  16470. dataType: "script",
  16471. cache: true,
  16472. async: false,
  16473. global: false,
  16474. // Only evaluate the response if it is successful (gh-4126)
  16475. // dataFilter is not invoked for failure responses, so using it instead
  16476. // of the default converter is kludgy but it works.
  16477. converters: {
  16478. "text script": function() {}
  16479. },
  16480. dataFilter: function( response ) {
  16481. jQuery.globalEval( response, options );
  16482. }
  16483. } );
  16484. };
  16485. jQuery.fn.extend( {
  16486. wrapAll: function( html ) {
  16487. var wrap;
  16488. if ( this[ 0 ] ) {
  16489. if ( isFunction( html ) ) {
  16490. html = html.call( this[ 0 ] );
  16491. }
  16492. // The elements to wrap the target around
  16493. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16494. if ( this[ 0 ].parentNode ) {
  16495. wrap.insertBefore( this[ 0 ] );
  16496. }
  16497. wrap.map( function() {
  16498. var elem = this;
  16499. while ( elem.firstElementChild ) {
  16500. elem = elem.firstElementChild;
  16501. }
  16502. return elem;
  16503. } ).append( this );
  16504. }
  16505. return this;
  16506. },
  16507. wrapInner: function( html ) {
  16508. if ( isFunction( html ) ) {
  16509. return this.each( function( i ) {
  16510. jQuery( this ).wrapInner( html.call( this, i ) );
  16511. } );
  16512. }
  16513. return this.each( function() {
  16514. var self = jQuery( this ),
  16515. contents = self.contents();
  16516. if ( contents.length ) {
  16517. contents.wrapAll( html );
  16518. } else {
  16519. self.append( html );
  16520. }
  16521. } );
  16522. },
  16523. wrap: function( html ) {
  16524. var htmlIsFunction = isFunction( html );
  16525. return this.each( function( i ) {
  16526. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16527. } );
  16528. },
  16529. unwrap: function( selector ) {
  16530. this.parent( selector ).not( "body" ).each( function() {
  16531. jQuery( this ).replaceWith( this.childNodes );
  16532. } );
  16533. return this;
  16534. }
  16535. } );
  16536. jQuery.expr.pseudos.hidden = function( elem ) {
  16537. return !jQuery.expr.pseudos.visible( elem );
  16538. };
  16539. jQuery.expr.pseudos.visible = function( elem ) {
  16540. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16541. };
  16542. jQuery.ajaxSettings.xhr = function() {
  16543. try {
  16544. return new window.XMLHttpRequest();
  16545. } catch ( e ) {}
  16546. };
  16547. var xhrSuccessStatus = {
  16548. // File protocol always yields status code 0, assume 200
  16549. 0: 200,
  16550. // Support: IE <=9 only
  16551. // #1450: sometimes IE returns 1223 when it should be 204
  16552. 1223: 204
  16553. },
  16554. xhrSupported = jQuery.ajaxSettings.xhr();
  16555. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16556. support.ajax = xhrSupported = !!xhrSupported;
  16557. jQuery.ajaxTransport( function( options ) {
  16558. var callback, errorCallback;
  16559. // Cross domain only allowed if supported through XMLHttpRequest
  16560. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16561. return {
  16562. send: function( headers, complete ) {
  16563. var i,
  16564. xhr = options.xhr();
  16565. xhr.open(
  16566. options.type,
  16567. options.url,
  16568. options.async,
  16569. options.username,
  16570. options.password
  16571. );
  16572. // Apply custom fields if provided
  16573. if ( options.xhrFields ) {
  16574. for ( i in options.xhrFields ) {
  16575. xhr[ i ] = options.xhrFields[ i ];
  16576. }
  16577. }
  16578. // Override mime type if needed
  16579. if ( options.mimeType && xhr.overrideMimeType ) {
  16580. xhr.overrideMimeType( options.mimeType );
  16581. }
  16582. // X-Requested-With header
  16583. // For cross-domain requests, seeing as conditions for a preflight are
  16584. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16585. // (it can always be set on a per-request basis or even using ajaxSetup)
  16586. // For same-domain requests, won't change header if already provided.
  16587. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16588. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16589. }
  16590. // Set headers
  16591. for ( i in headers ) {
  16592. xhr.setRequestHeader( i, headers[ i ] );
  16593. }
  16594. // Callback
  16595. callback = function( type ) {
  16596. return function() {
  16597. if ( callback ) {
  16598. callback = errorCallback = xhr.onload =
  16599. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16600. xhr.onreadystatechange = null;
  16601. if ( type === "abort" ) {
  16602. xhr.abort();
  16603. } else if ( type === "error" ) {
  16604. // Support: IE <=9 only
  16605. // On a manual native abort, IE9 throws
  16606. // errors on any property access that is not readyState
  16607. if ( typeof xhr.status !== "number" ) {
  16608. complete( 0, "error" );
  16609. } else {
  16610. complete(
  16611. // File: protocol always yields status 0; see #8605, #14207
  16612. xhr.status,
  16613. xhr.statusText
  16614. );
  16615. }
  16616. } else {
  16617. complete(
  16618. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16619. xhr.statusText,
  16620. // Support: IE <=9 only
  16621. // IE9 has no XHR2 but throws on binary (trac-11426)
  16622. // For XHR2 non-text, let the caller handle it (gh-2498)
  16623. ( xhr.responseType || "text" ) !== "text" ||
  16624. typeof xhr.responseText !== "string" ?
  16625. { binary: xhr.response } :
  16626. { text: xhr.responseText },
  16627. xhr.getAllResponseHeaders()
  16628. );
  16629. }
  16630. }
  16631. };
  16632. };
  16633. // Listen to events
  16634. xhr.onload = callback();
  16635. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16636. // Support: IE 9 only
  16637. // Use onreadystatechange to replace onabort
  16638. // to handle uncaught aborts
  16639. if ( xhr.onabort !== undefined ) {
  16640. xhr.onabort = errorCallback;
  16641. } else {
  16642. xhr.onreadystatechange = function() {
  16643. // Check readyState before timeout as it changes
  16644. if ( xhr.readyState === 4 ) {
  16645. // Allow onerror to be called first,
  16646. // but that will not handle a native abort
  16647. // Also, save errorCallback to a variable
  16648. // as xhr.onerror cannot be accessed
  16649. window.setTimeout( function() {
  16650. if ( callback ) {
  16651. errorCallback();
  16652. }
  16653. } );
  16654. }
  16655. };
  16656. }
  16657. // Create the abort callback
  16658. callback = callback( "abort" );
  16659. try {
  16660. // Do send the request (this may raise an exception)
  16661. xhr.send( options.hasContent && options.data || null );
  16662. } catch ( e ) {
  16663. // #14683: Only rethrow if this hasn't been notified as an error yet
  16664. if ( callback ) {
  16665. throw e;
  16666. }
  16667. }
  16668. },
  16669. abort: function() {
  16670. if ( callback ) {
  16671. callback();
  16672. }
  16673. }
  16674. };
  16675. }
  16676. } );
  16677. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16678. jQuery.ajaxPrefilter( function( s ) {
  16679. if ( s.crossDomain ) {
  16680. s.contents.script = false;
  16681. }
  16682. } );
  16683. // Install script dataType
  16684. jQuery.ajaxSetup( {
  16685. accepts: {
  16686. script: "text/javascript, application/javascript, " +
  16687. "application/ecmascript, application/x-ecmascript"
  16688. },
  16689. contents: {
  16690. script: /\b(?:java|ecma)script\b/
  16691. },
  16692. converters: {
  16693. "text script": function( text ) {
  16694. jQuery.globalEval( text );
  16695. return text;
  16696. }
  16697. }
  16698. } );
  16699. // Handle cache's special case and crossDomain
  16700. jQuery.ajaxPrefilter( "script", function( s ) {
  16701. if ( s.cache === undefined ) {
  16702. s.cache = false;
  16703. }
  16704. if ( s.crossDomain ) {
  16705. s.type = "GET";
  16706. }
  16707. } );
  16708. // Bind script tag hack transport
  16709. jQuery.ajaxTransport( "script", function( s ) {
  16710. // This transport only deals with cross domain or forced-by-attrs requests
  16711. if ( s.crossDomain || s.scriptAttrs ) {
  16712. var script, callback;
  16713. return {
  16714. send: function( _, complete ) {
  16715. script = jQuery( "<script>" )
  16716. .attr( s.scriptAttrs || {} )
  16717. .prop( { charset: s.scriptCharset, src: s.url } )
  16718. .on( "load error", callback = function( evt ) {
  16719. script.remove();
  16720. callback = null;
  16721. if ( evt ) {
  16722. complete( evt.type === "error" ? 404 : 200, evt.type );
  16723. }
  16724. } );
  16725. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16726. document.head.appendChild( script[ 0 ] );
  16727. },
  16728. abort: function() {
  16729. if ( callback ) {
  16730. callback();
  16731. }
  16732. }
  16733. };
  16734. }
  16735. } );
  16736. var oldCallbacks = [],
  16737. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16738. // Default jsonp settings
  16739. jQuery.ajaxSetup( {
  16740. jsonp: "callback",
  16741. jsonpCallback: function() {
  16742. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16743. this[ callback ] = true;
  16744. return callback;
  16745. }
  16746. } );
  16747. // Detect, normalize options and install callbacks for jsonp requests
  16748. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16749. var callbackName, overwritten, responseContainer,
  16750. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16751. "url" :
  16752. typeof s.data === "string" &&
  16753. ( s.contentType || "" )
  16754. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16755. rjsonp.test( s.data ) && "data"
  16756. );
  16757. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16758. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16759. // Get callback name, remembering preexisting value associated with it
  16760. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16761. s.jsonpCallback() :
  16762. s.jsonpCallback;
  16763. // Insert callback into url or form data
  16764. if ( jsonProp ) {
  16765. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16766. } else if ( s.jsonp !== false ) {
  16767. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16768. }
  16769. // Use data converter to retrieve json after script execution
  16770. s.converters[ "script json" ] = function() {
  16771. if ( !responseContainer ) {
  16772. jQuery.error( callbackName + " was not called" );
  16773. }
  16774. return responseContainer[ 0 ];
  16775. };
  16776. // Force json dataType
  16777. s.dataTypes[ 0 ] = "json";
  16778. // Install callback
  16779. overwritten = window[ callbackName ];
  16780. window[ callbackName ] = function() {
  16781. responseContainer = arguments;
  16782. };
  16783. // Clean-up function (fires after converters)
  16784. jqXHR.always( function() {
  16785. // If previous value didn't exist - remove it
  16786. if ( overwritten === undefined ) {
  16787. jQuery( window ).removeProp( callbackName );
  16788. // Otherwise restore preexisting value
  16789. } else {
  16790. window[ callbackName ] = overwritten;
  16791. }
  16792. // Save back as free
  16793. if ( s[ callbackName ] ) {
  16794. // Make sure that re-using the options doesn't screw things around
  16795. s.jsonpCallback = originalSettings.jsonpCallback;
  16796. // Save the callback name for future use
  16797. oldCallbacks.push( callbackName );
  16798. }
  16799. // Call if it was a function and we have a response
  16800. if ( responseContainer && isFunction( overwritten ) ) {
  16801. overwritten( responseContainer[ 0 ] );
  16802. }
  16803. responseContainer = overwritten = undefined;
  16804. } );
  16805. // Delegate to script
  16806. return "script";
  16807. }
  16808. } );
  16809. // Support: Safari 8 only
  16810. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16811. // collapse sibling forms: the second one becomes a child of the first one.
  16812. // Because of that, this security measure has to be disabled in Safari 8.
  16813. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16814. support.createHTMLDocument = ( function() {
  16815. var body = document.implementation.createHTMLDocument( "" ).body;
  16816. body.innerHTML = "<form></form><form></form>";
  16817. return body.childNodes.length === 2;
  16818. } )();
  16819. // Argument "data" should be string of html
  16820. // context (optional): If specified, the fragment will be created in this context,
  16821. // defaults to document
  16822. // keepScripts (optional): If true, will include scripts passed in the html string
  16823. jQuery.parseHTML = function( data, context, keepScripts ) {
  16824. if ( typeof data !== "string" ) {
  16825. return [];
  16826. }
  16827. if ( typeof context === "boolean" ) {
  16828. keepScripts = context;
  16829. context = false;
  16830. }
  16831. var base, parsed, scripts;
  16832. if ( !context ) {
  16833. // Stop scripts or inline event handlers from being executed immediately
  16834. // by using document.implementation
  16835. if ( support.createHTMLDocument ) {
  16836. context = document.implementation.createHTMLDocument( "" );
  16837. // Set the base href for the created document
  16838. // so any parsed elements with URLs
  16839. // are based on the document's URL (gh-2965)
  16840. base = context.createElement( "base" );
  16841. base.href = document.location.href;
  16842. context.head.appendChild( base );
  16843. } else {
  16844. context = document;
  16845. }
  16846. }
  16847. parsed = rsingleTag.exec( data );
  16848. scripts = !keepScripts && [];
  16849. // Single tag
  16850. if ( parsed ) {
  16851. return [ context.createElement( parsed[ 1 ] ) ];
  16852. }
  16853. parsed = buildFragment( [ data ], context, scripts );
  16854. if ( scripts && scripts.length ) {
  16855. jQuery( scripts ).remove();
  16856. }
  16857. return jQuery.merge( [], parsed.childNodes );
  16858. };
  16859. /**
  16860. * Load a url into a page
  16861. */
  16862. jQuery.fn.load = function( url, params, callback ) {
  16863. var selector, type, response,
  16864. self = this,
  16865. off = url.indexOf( " " );
  16866. if ( off > -1 ) {
  16867. selector = stripAndCollapse( url.slice( off ) );
  16868. url = url.slice( 0, off );
  16869. }
  16870. // If it's a function
  16871. if ( isFunction( params ) ) {
  16872. // We assume that it's the callback
  16873. callback = params;
  16874. params = undefined;
  16875. // Otherwise, build a param string
  16876. } else if ( params && typeof params === "object" ) {
  16877. type = "POST";
  16878. }
  16879. // If we have elements to modify, make the request
  16880. if ( self.length > 0 ) {
  16881. jQuery.ajax( {
  16882. url: url,
  16883. // If "type" variable is undefined, then "GET" method will be used.
  16884. // Make value of this field explicit since
  16885. // user can override it through ajaxSetup method
  16886. type: type || "GET",
  16887. dataType: "html",
  16888. data: params
  16889. } ).done( function( responseText ) {
  16890. // Save response for use in complete callback
  16891. response = arguments;
  16892. self.html( selector ?
  16893. // If a selector was specified, locate the right elements in a dummy div
  16894. // Exclude scripts to avoid IE 'Permission Denied' errors
  16895. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16896. // Otherwise use the full result
  16897. responseText );
  16898. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16899. // but they are ignored because response was set above.
  16900. // If it fails, this function gets "jqXHR", "status", "error"
  16901. } ).always( callback && function( jqXHR, status ) {
  16902. self.each( function() {
  16903. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16904. } );
  16905. } );
  16906. }
  16907. return this;
  16908. };
  16909. // Attach a bunch of functions for handling common AJAX events
  16910. jQuery.each( [
  16911. "ajaxStart",
  16912. "ajaxStop",
  16913. "ajaxComplete",
  16914. "ajaxError",
  16915. "ajaxSuccess",
  16916. "ajaxSend"
  16917. ], function( i, type ) {
  16918. jQuery.fn[ type ] = function( fn ) {
  16919. return this.on( type, fn );
  16920. };
  16921. } );
  16922. jQuery.expr.pseudos.animated = function( elem ) {
  16923. return jQuery.grep( jQuery.timers, function( fn ) {
  16924. return elem === fn.elem;
  16925. } ).length;
  16926. };
  16927. jQuery.offset = {
  16928. setOffset: function( elem, options, i ) {
  16929. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16930. position = jQuery.css( elem, "position" ),
  16931. curElem = jQuery( elem ),
  16932. props = {};
  16933. // Set position first, in-case top/left are set even on static elem
  16934. if ( position === "static" ) {
  16935. elem.style.position = "relative";
  16936. }
  16937. curOffset = curElem.offset();
  16938. curCSSTop = jQuery.css( elem, "top" );
  16939. curCSSLeft = jQuery.css( elem, "left" );
  16940. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16941. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16942. // Need to be able to calculate position if either
  16943. // top or left is auto and position is either absolute or fixed
  16944. if ( calculatePosition ) {
  16945. curPosition = curElem.position();
  16946. curTop = curPosition.top;
  16947. curLeft = curPosition.left;
  16948. } else {
  16949. curTop = parseFloat( curCSSTop ) || 0;
  16950. curLeft = parseFloat( curCSSLeft ) || 0;
  16951. }
  16952. if ( isFunction( options ) ) {
  16953. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16954. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16955. }
  16956. if ( options.top != null ) {
  16957. props.top = ( options.top - curOffset.top ) + curTop;
  16958. }
  16959. if ( options.left != null ) {
  16960. props.left = ( options.left - curOffset.left ) + curLeft;
  16961. }
  16962. if ( "using" in options ) {
  16963. options.using.call( elem, props );
  16964. } else {
  16965. curElem.css( props );
  16966. }
  16967. }
  16968. };
  16969. jQuery.fn.extend( {
  16970. // offset() relates an element's border box to the document origin
  16971. offset: function( options ) {
  16972. // Preserve chaining for setter
  16973. if ( arguments.length ) {
  16974. return options === undefined ?
  16975. this :
  16976. this.each( function( i ) {
  16977. jQuery.offset.setOffset( this, options, i );
  16978. } );
  16979. }
  16980. var rect, win,
  16981. elem = this[ 0 ];
  16982. if ( !elem ) {
  16983. return;
  16984. }
  16985. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16986. // Support: IE <=11 only
  16987. // Running getBoundingClientRect on a
  16988. // disconnected node in IE throws an error
  16989. if ( !elem.getClientRects().length ) {
  16990. return { top: 0, left: 0 };
  16991. }
  16992. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16993. rect = elem.getBoundingClientRect();
  16994. win = elem.ownerDocument.defaultView;
  16995. return {
  16996. top: rect.top + win.pageYOffset,
  16997. left: rect.left + win.pageXOffset
  16998. };
  16999. },
  17000. // position() relates an element's margin box to its offset parent's padding box
  17001. // This corresponds to the behavior of CSS absolute positioning
  17002. position: function() {
  17003. if ( !this[ 0 ] ) {
  17004. return;
  17005. }
  17006. var offsetParent, offset, doc,
  17007. elem = this[ 0 ],
  17008. parentOffset = { top: 0, left: 0 };
  17009. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17010. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17011. // Assume position:fixed implies availability of getBoundingClientRect
  17012. offset = elem.getBoundingClientRect();
  17013. } else {
  17014. offset = this.offset();
  17015. // Account for the *real* offset parent, which can be the document or its root element
  17016. // when a statically positioned element is identified
  17017. doc = elem.ownerDocument;
  17018. offsetParent = elem.offsetParent || doc.documentElement;
  17019. while ( offsetParent &&
  17020. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17021. jQuery.css( offsetParent, "position" ) === "static" ) {
  17022. offsetParent = offsetParent.parentNode;
  17023. }
  17024. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17025. // Incorporate borders into its offset, since they are outside its content origin
  17026. parentOffset = jQuery( offsetParent ).offset();
  17027. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17028. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17029. }
  17030. }
  17031. // Subtract parent offsets and element margins
  17032. return {
  17033. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17034. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17035. };
  17036. },
  17037. // This method will return documentElement in the following cases:
  17038. // 1) For the element inside the iframe without offsetParent, this method will return
  17039. // documentElement of the parent window
  17040. // 2) For the hidden or detached element
  17041. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17042. //
  17043. // but those exceptions were never presented as a real life use-cases
  17044. // and might be considered as more preferable results.
  17045. //
  17046. // This logic, however, is not guaranteed and can change at any point in the future
  17047. offsetParent: function() {
  17048. return this.map( function() {
  17049. var offsetParent = this.offsetParent;
  17050. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17051. offsetParent = offsetParent.offsetParent;
  17052. }
  17053. return offsetParent || documentElement;
  17054. } );
  17055. }
  17056. } );
  17057. // Create scrollLeft and scrollTop methods
  17058. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17059. var top = "pageYOffset" === prop;
  17060. jQuery.fn[ method ] = function( val ) {
  17061. return access( this, function( elem, method, val ) {
  17062. // Coalesce documents and windows
  17063. var win;
  17064. if ( isWindow( elem ) ) {
  17065. win = elem;
  17066. } else if ( elem.nodeType === 9 ) {
  17067. win = elem.defaultView;
  17068. }
  17069. if ( val === undefined ) {
  17070. return win ? win[ prop ] : elem[ method ];
  17071. }
  17072. if ( win ) {
  17073. win.scrollTo(
  17074. !top ? val : win.pageXOffset,
  17075. top ? val : win.pageYOffset
  17076. );
  17077. } else {
  17078. elem[ method ] = val;
  17079. }
  17080. }, method, val, arguments.length );
  17081. };
  17082. } );
  17083. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17084. // Add the top/left cssHooks using jQuery.fn.position
  17085. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17086. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17087. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17088. // rather than make the css module depend on the offset module, just check for it here
  17089. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17090. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17091. function( elem, computed ) {
  17092. if ( computed ) {
  17093. computed = curCSS( elem, prop );
  17094. // If curCSS returns percentage, fallback to offset
  17095. return rnumnonpx.test( computed ) ?
  17096. jQuery( elem ).position()[ prop ] + "px" :
  17097. computed;
  17098. }
  17099. }
  17100. );
  17101. } );
  17102. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17103. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17104. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17105. function( defaultExtra, funcName ) {
  17106. // Margin is only for outerHeight, outerWidth
  17107. jQuery.fn[ funcName ] = function( margin, value ) {
  17108. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17109. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17110. return access( this, function( elem, type, value ) {
  17111. var doc;
  17112. if ( isWindow( elem ) ) {
  17113. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17114. return funcName.indexOf( "outer" ) === 0 ?
  17115. elem[ "inner" + name ] :
  17116. elem.document.documentElement[ "client" + name ];
  17117. }
  17118. // Get document width or height
  17119. if ( elem.nodeType === 9 ) {
  17120. doc = elem.documentElement;
  17121. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17122. // whichever is greatest
  17123. return Math.max(
  17124. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17125. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17126. doc[ "client" + name ]
  17127. );
  17128. }
  17129. return value === undefined ?
  17130. // Get width or height on the element, requesting but not forcing parseFloat
  17131. jQuery.css( elem, type, extra ) :
  17132. // Set width or height on the element
  17133. jQuery.style( elem, type, value, extra );
  17134. }, type, chainable ? margin : undefined, chainable );
  17135. };
  17136. } );
  17137. } );
  17138. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17139. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17140. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17141. function( i, name ) {
  17142. // Handle event binding
  17143. jQuery.fn[ name ] = function( data, fn ) {
  17144. return arguments.length > 0 ?
  17145. this.on( name, null, data, fn ) :
  17146. this.trigger( name );
  17147. };
  17148. } );
  17149. jQuery.fn.extend( {
  17150. hover: function( fnOver, fnOut ) {
  17151. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17152. }
  17153. } );
  17154. jQuery.fn.extend( {
  17155. bind: function( types, data, fn ) {
  17156. return this.on( types, null, data, fn );
  17157. },
  17158. unbind: function( types, fn ) {
  17159. return this.off( types, null, fn );
  17160. },
  17161. delegate: function( selector, types, data, fn ) {
  17162. return this.on( types, selector, data, fn );
  17163. },
  17164. undelegate: function( selector, types, fn ) {
  17165. // ( namespace ) or ( selector, types [, fn] )
  17166. return arguments.length === 1 ?
  17167. this.off( selector, "**" ) :
  17168. this.off( types, selector || "**", fn );
  17169. }
  17170. } );
  17171. // Bind a function to a context, optionally partially applying any
  17172. // arguments.
  17173. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17174. // However, it is not slated for removal any time soon
  17175. jQuery.proxy = function( fn, context ) {
  17176. var tmp, args, proxy;
  17177. if ( typeof context === "string" ) {
  17178. tmp = fn[ context ];
  17179. context = fn;
  17180. fn = tmp;
  17181. }
  17182. // Quick check to determine if target is callable, in the spec
  17183. // this throws a TypeError, but we will just return undefined.
  17184. if ( !isFunction( fn ) ) {
  17185. return undefined;
  17186. }
  17187. // Simulated bind
  17188. args = slice.call( arguments, 2 );
  17189. proxy = function() {
  17190. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17191. };
  17192. // Set the guid of unique handler to the same of original handler, so it can be removed
  17193. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17194. return proxy;
  17195. };
  17196. jQuery.holdReady = function( hold ) {
  17197. if ( hold ) {
  17198. jQuery.readyWait++;
  17199. } else {
  17200. jQuery.ready( true );
  17201. }
  17202. };
  17203. jQuery.isArray = Array.isArray;
  17204. jQuery.parseJSON = JSON.parse;
  17205. jQuery.nodeName = nodeName;
  17206. jQuery.isFunction = isFunction;
  17207. jQuery.isWindow = isWindow;
  17208. jQuery.camelCase = camelCase;
  17209. jQuery.type = toType;
  17210. jQuery.now = Date.now;
  17211. jQuery.isNumeric = function( obj ) {
  17212. // As of jQuery 3.0, isNumeric is limited to
  17213. // strings and numbers (primitives or objects)
  17214. // that can be coerced to finite numbers (gh-2662)
  17215. var type = jQuery.type( obj );
  17216. return ( type === "number" || type === "string" ) &&
  17217. // parseFloat NaNs numeric-cast false positives ("")
  17218. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17219. // subtraction forces infinities to NaN
  17220. !isNaN( obj - parseFloat( obj ) );
  17221. };
  17222. // Register as a named AMD module, since jQuery can be concatenated with other
  17223. // files that may use define, but not via a proper concatenation script that
  17224. // understands anonymous AMD modules. A named AMD is safest and most robust
  17225. // way to register. Lowercase jquery is used because AMD module names are
  17226. // derived from file names, and jQuery is normally delivered in a lowercase
  17227. // file name. Do this after creating the global so that if an AMD module wants
  17228. // to call noConflict to hide this version of jQuery, it will work.
  17229. // Note that for maximum portability, libraries that are not jQuery should
  17230. // declare themselves as anonymous modules, and avoid setting a global if an
  17231. // AMD loader is present. jQuery is a special case. For more information, see
  17232. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17233. if ( true ) {
  17234. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17235. return jQuery;
  17236. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17237. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17238. }
  17239. var
  17240. // Map over jQuery in case of overwrite
  17241. _jQuery = window.jQuery,
  17242. // Map over the $ in case of overwrite
  17243. _$ = window.$;
  17244. jQuery.noConflict = function( deep ) {
  17245. if ( window.$ === jQuery ) {
  17246. window.$ = _$;
  17247. }
  17248. if ( deep && window.jQuery === jQuery ) {
  17249. window.jQuery = _jQuery;
  17250. }
  17251. return jQuery;
  17252. };
  17253. // Expose jQuery and $ identifiers, even in AMD
  17254. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17255. // and CommonJS for browser emulators (#13566)
  17256. if ( !noGlobal ) {
  17257. window.jQuery = window.$ = jQuery;
  17258. }
  17259. return jQuery;
  17260. } );
  17261. /***/ }),
  17262. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17263. /*!************************************************!*\
  17264. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17265. \************************************************/
  17266. /*! exports provided: default */
  17267. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17268. "use strict";
  17269. __webpack_require__.r(__webpack_exports__);
  17270. var classCallCheck = function (instance, Constructor) {
  17271. if (!(instance instanceof Constructor)) {
  17272. throw new TypeError("Cannot call a class as a function");
  17273. }
  17274. };
  17275. var createClass = function () {
  17276. function defineProperties(target, props) {
  17277. for (var i = 0; i < props.length; i++) {
  17278. var descriptor = props[i];
  17279. descriptor.enumerable = descriptor.enumerable || false;
  17280. descriptor.configurable = true;
  17281. if ("value" in descriptor) descriptor.writable = true;
  17282. Object.defineProperty(target, descriptor.key, descriptor);
  17283. }
  17284. }
  17285. return function (Constructor, protoProps, staticProps) {
  17286. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17287. if (staticProps) defineProperties(Constructor, staticProps);
  17288. return Constructor;
  17289. };
  17290. }();
  17291. var _extends = Object.assign || function (target) {
  17292. for (var i = 1; i < arguments.length; i++) {
  17293. var source = arguments[i];
  17294. for (var key in source) {
  17295. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17296. target[key] = source[key];
  17297. }
  17298. }
  17299. }
  17300. return target;
  17301. };
  17302. var inherits = function (subClass, superClass) {
  17303. if (typeof superClass !== "function" && superClass !== null) {
  17304. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17305. }
  17306. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17307. constructor: {
  17308. value: subClass,
  17309. enumerable: false,
  17310. writable: true,
  17311. configurable: true
  17312. }
  17313. });
  17314. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17315. };
  17316. var possibleConstructorReturn = function (self, call) {
  17317. if (!self) {
  17318. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17319. }
  17320. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17321. };
  17322. var Connector = function () {
  17323. /**
  17324. * Create a new class instance.
  17325. */
  17326. function Connector(options) {
  17327. classCallCheck(this, Connector);
  17328. /**
  17329. * Default connector options.
  17330. */
  17331. this._defaultOptions = {
  17332. auth: {
  17333. headers: {}
  17334. },
  17335. authEndpoint: '/broadcasting/auth',
  17336. broadcaster: 'pusher',
  17337. csrfToken: null,
  17338. host: null,
  17339. key: null,
  17340. namespace: 'App.Events'
  17341. };
  17342. this.setOptions(options);
  17343. this.connect();
  17344. }
  17345. /**
  17346. * Merge the custom options with the defaults.
  17347. */
  17348. createClass(Connector, [{
  17349. key: 'setOptions',
  17350. value: function setOptions(options) {
  17351. this.options = _extends(this._defaultOptions, options);
  17352. if (this.csrfToken()) {
  17353. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17354. }
  17355. return options;
  17356. }
  17357. /**
  17358. * Extract the CSRF token from the page.
  17359. */
  17360. }, {
  17361. key: 'csrfToken',
  17362. value: function csrfToken() {
  17363. var selector = void 0;
  17364. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17365. return window['Laravel'].csrfToken;
  17366. } else if (this.options.csrfToken) {
  17367. return this.options.csrfToken;
  17368. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17369. return selector.getAttribute('content');
  17370. }
  17371. return null;
  17372. }
  17373. }]);
  17374. return Connector;
  17375. }();
  17376. /**
  17377. * This class represents a basic channel.
  17378. */
  17379. var Channel = function () {
  17380. function Channel() {
  17381. classCallCheck(this, Channel);
  17382. }
  17383. createClass(Channel, [{
  17384. key: 'listenForWhisper',
  17385. /**
  17386. * Listen for a whisper event on the channel instance.
  17387. */
  17388. value: function listenForWhisper(event, callback) {
  17389. return this.listen('.client-' + event, callback);
  17390. }
  17391. /**
  17392. * Listen for an event on the channel instance.
  17393. */
  17394. }, {
  17395. key: 'notification',
  17396. value: function notification(callback) {
  17397. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17398. }
  17399. /**
  17400. * Stop listening for a whispser event on the channel instance.
  17401. */
  17402. }, {
  17403. key: 'stopListeningForWhisper',
  17404. value: function stopListeningForWhisper(event) {
  17405. return this.stopListening('.client-' + event);
  17406. }
  17407. }]);
  17408. return Channel;
  17409. }();
  17410. /**
  17411. * Event name formatter
  17412. */
  17413. var EventFormatter = function () {
  17414. /**
  17415. * Create a new class instance.
  17416. */
  17417. function EventFormatter(namespace) {
  17418. classCallCheck(this, EventFormatter);
  17419. this.setNamespace(namespace);
  17420. }
  17421. /**
  17422. * Format the given event name.
  17423. */
  17424. createClass(EventFormatter, [{
  17425. key: 'format',
  17426. value: function format(event) {
  17427. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17428. return event.substr(1);
  17429. } else if (this.namespace) {
  17430. event = this.namespace + '.' + event;
  17431. }
  17432. return event.replace(/\./g, '\\');
  17433. }
  17434. /**
  17435. * Set the event namespace.
  17436. */
  17437. }, {
  17438. key: 'setNamespace',
  17439. value: function setNamespace(value) {
  17440. this.namespace = value;
  17441. }
  17442. }]);
  17443. return EventFormatter;
  17444. }();
  17445. /**
  17446. * This class represents a Pusher channel.
  17447. */
  17448. var PusherChannel = function (_Channel) {
  17449. inherits(PusherChannel, _Channel);
  17450. /**
  17451. * Create a new class instance.
  17452. */
  17453. function PusherChannel(pusher, name, options) {
  17454. classCallCheck(this, PusherChannel);
  17455. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17456. _this.name = name;
  17457. _this.pusher = pusher;
  17458. _this.options = options;
  17459. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17460. _this.subscribe();
  17461. return _this;
  17462. }
  17463. /**
  17464. * Subscribe to a Pusher channel.
  17465. */
  17466. createClass(PusherChannel, [{
  17467. key: 'subscribe',
  17468. value: function subscribe() {
  17469. this.subscription = this.pusher.subscribe(this.name);
  17470. }
  17471. /**
  17472. * Unsubscribe from a Pusher channel.
  17473. */
  17474. }, {
  17475. key: 'unsubscribe',
  17476. value: function unsubscribe() {
  17477. this.pusher.unsubscribe(this.name);
  17478. }
  17479. /**
  17480. * Listen for an event on the channel instance.
  17481. */
  17482. }, {
  17483. key: 'listen',
  17484. value: function listen(event, callback) {
  17485. this.on(this.eventFormatter.format(event), callback);
  17486. return this;
  17487. }
  17488. /**
  17489. * Stop listening for an event on the channel instance.
  17490. */
  17491. }, {
  17492. key: 'stopListening',
  17493. value: function stopListening(event) {
  17494. this.subscription.unbind(this.eventFormatter.format(event));
  17495. return this;
  17496. }
  17497. /**
  17498. * Bind a channel to an event.
  17499. */
  17500. }, {
  17501. key: 'on',
  17502. value: function on(event, callback) {
  17503. this.subscription.bind(event, callback);
  17504. return this;
  17505. }
  17506. }]);
  17507. return PusherChannel;
  17508. }(Channel);
  17509. /**
  17510. * This class represents a Pusher private channel.
  17511. */
  17512. var PusherPrivateChannel = function (_PusherChannel) {
  17513. inherits(PusherPrivateChannel, _PusherChannel);
  17514. function PusherPrivateChannel() {
  17515. classCallCheck(this, PusherPrivateChannel);
  17516. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17517. }
  17518. createClass(PusherPrivateChannel, [{
  17519. key: 'whisper',
  17520. /**
  17521. * Trigger client event on the channel.
  17522. */
  17523. value: function whisper(eventName, data) {
  17524. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17525. return this;
  17526. }
  17527. }]);
  17528. return PusherPrivateChannel;
  17529. }(PusherChannel);
  17530. /**
  17531. * This class represents a Pusher presence channel.
  17532. */
  17533. var PusherPresenceChannel = function (_PusherChannel) {
  17534. inherits(PusherPresenceChannel, _PusherChannel);
  17535. function PusherPresenceChannel() {
  17536. classCallCheck(this, PusherPresenceChannel);
  17537. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17538. }
  17539. createClass(PusherPresenceChannel, [{
  17540. key: 'here',
  17541. /**
  17542. * Register a callback to be called anytime the member list changes.
  17543. */
  17544. value: function here(callback) {
  17545. this.on('pusher:subscription_succeeded', function (data) {
  17546. callback(Object.keys(data.members).map(function (k) {
  17547. return data.members[k];
  17548. }));
  17549. });
  17550. return this;
  17551. }
  17552. /**
  17553. * Listen for someone joining the channel.
  17554. */
  17555. }, {
  17556. key: 'joining',
  17557. value: function joining(callback) {
  17558. this.on('pusher:member_added', function (member) {
  17559. callback(member.info);
  17560. });
  17561. return this;
  17562. }
  17563. /**
  17564. * Listen for someone leaving the channel.
  17565. */
  17566. }, {
  17567. key: 'leaving',
  17568. value: function leaving(callback) {
  17569. this.on('pusher:member_removed', function (member) {
  17570. callback(member.info);
  17571. });
  17572. return this;
  17573. }
  17574. /**
  17575. * Trigger client event on the channel.
  17576. */
  17577. }, {
  17578. key: 'whisper',
  17579. value: function whisper(eventName, data) {
  17580. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17581. return this;
  17582. }
  17583. }]);
  17584. return PusherPresenceChannel;
  17585. }(PusherChannel);
  17586. /**
  17587. * This class represents a Socket.io channel.
  17588. */
  17589. var SocketIoChannel = function (_Channel) {
  17590. inherits(SocketIoChannel, _Channel);
  17591. /**
  17592. * Create a new class instance.
  17593. */
  17594. function SocketIoChannel(socket, name, options) {
  17595. classCallCheck(this, SocketIoChannel);
  17596. /**
  17597. * The event callbacks applied to the channel.
  17598. */
  17599. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17600. _this.events = {};
  17601. _this.name = name;
  17602. _this.socket = socket;
  17603. _this.options = options;
  17604. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17605. _this.subscribe();
  17606. _this.configureReconnector();
  17607. return _this;
  17608. }
  17609. /**
  17610. * Subscribe to a Socket.io channel.
  17611. */
  17612. createClass(SocketIoChannel, [{
  17613. key: 'subscribe',
  17614. value: function subscribe() {
  17615. this.socket.emit('subscribe', {
  17616. channel: this.name,
  17617. auth: this.options.auth || {}
  17618. });
  17619. }
  17620. /**
  17621. * Unsubscribe from channel and ubind event callbacks.
  17622. */
  17623. }, {
  17624. key: 'unsubscribe',
  17625. value: function unsubscribe() {
  17626. this.unbind();
  17627. this.socket.emit('unsubscribe', {
  17628. channel: this.name,
  17629. auth: this.options.auth || {}
  17630. });
  17631. }
  17632. /**
  17633. * Listen for an event on the channel instance.
  17634. */
  17635. }, {
  17636. key: 'listen',
  17637. value: function listen(event, callback) {
  17638. this.on(this.eventFormatter.format(event), callback);
  17639. return this;
  17640. }
  17641. /**
  17642. * Stop listening for an event on the channel instance.
  17643. */
  17644. }, {
  17645. key: 'stopListening',
  17646. value: function stopListening(event) {
  17647. var name = this.eventFormatter.format(event);
  17648. this.socket.removeListener(name);
  17649. delete this.events[name];
  17650. return this;
  17651. }
  17652. /**
  17653. * Bind the channel's socket to an event and store the callback.
  17654. */
  17655. }, {
  17656. key: 'on',
  17657. value: function on(event, callback) {
  17658. var _this2 = this;
  17659. var listener = function listener(channel, data) {
  17660. if (_this2.name == channel) {
  17661. callback(data);
  17662. }
  17663. };
  17664. this.socket.on(event, listener);
  17665. this.bind(event, listener);
  17666. }
  17667. /**
  17668. * Attach a 'reconnect' listener and bind the event.
  17669. */
  17670. }, {
  17671. key: 'configureReconnector',
  17672. value: function configureReconnector() {
  17673. var _this3 = this;
  17674. var listener = function listener() {
  17675. _this3.subscribe();
  17676. };
  17677. this.socket.on('reconnect', listener);
  17678. this.bind('reconnect', listener);
  17679. }
  17680. /**
  17681. * Bind the channel's socket to an event and store the callback.
  17682. */
  17683. }, {
  17684. key: 'bind',
  17685. value: function bind(event, callback) {
  17686. this.events[event] = this.events[event] || [];
  17687. this.events[event].push(callback);
  17688. }
  17689. /**
  17690. * Unbind the channel's socket from all stored event callbacks.
  17691. */
  17692. }, {
  17693. key: 'unbind',
  17694. value: function unbind() {
  17695. var _this4 = this;
  17696. Object.keys(this.events).forEach(function (event) {
  17697. _this4.events[event].forEach(function (callback) {
  17698. _this4.socket.removeListener(event, callback);
  17699. });
  17700. delete _this4.events[event];
  17701. });
  17702. }
  17703. }]);
  17704. return SocketIoChannel;
  17705. }(Channel);
  17706. /**
  17707. * This class represents a Socket.io presence channel.
  17708. */
  17709. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17710. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17711. function SocketIoPrivateChannel() {
  17712. classCallCheck(this, SocketIoPrivateChannel);
  17713. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17714. }
  17715. createClass(SocketIoPrivateChannel, [{
  17716. key: 'whisper',
  17717. /**
  17718. * Trigger client event on the channel.
  17719. */
  17720. value: function whisper(eventName, data) {
  17721. this.socket.emit('client event', {
  17722. channel: this.name,
  17723. event: 'client-' + eventName,
  17724. data: data
  17725. });
  17726. return this;
  17727. }
  17728. }]);
  17729. return SocketIoPrivateChannel;
  17730. }(SocketIoChannel);
  17731. /**
  17732. * This class represents a Socket.io presence channel.
  17733. */
  17734. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17735. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17736. function SocketIoPresenceChannel() {
  17737. classCallCheck(this, SocketIoPresenceChannel);
  17738. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17739. }
  17740. createClass(SocketIoPresenceChannel, [{
  17741. key: 'here',
  17742. /**
  17743. * Register a callback to be called anytime the member list changes.
  17744. */
  17745. value: function here(callback) {
  17746. this.on('presence:subscribed', function (members) {
  17747. callback(members.map(function (m) {
  17748. return m.user_info;
  17749. }));
  17750. });
  17751. return this;
  17752. }
  17753. /**
  17754. * Listen for someone joining the channel.
  17755. */
  17756. }, {
  17757. key: 'joining',
  17758. value: function joining(callback) {
  17759. this.on('presence:joining', function (member) {
  17760. return callback(member.user_info);
  17761. });
  17762. return this;
  17763. }
  17764. /**
  17765. * Listen for someone leaving the channel.
  17766. */
  17767. }, {
  17768. key: 'leaving',
  17769. value: function leaving(callback) {
  17770. this.on('presence:leaving', function (member) {
  17771. return callback(member.user_info);
  17772. });
  17773. return this;
  17774. }
  17775. }]);
  17776. return SocketIoPresenceChannel;
  17777. }(SocketIoPrivateChannel);
  17778. /**
  17779. * This class represents a null channel.
  17780. */
  17781. var NullChannel = function (_Channel) {
  17782. inherits(NullChannel, _Channel);
  17783. function NullChannel() {
  17784. classCallCheck(this, NullChannel);
  17785. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17786. }
  17787. createClass(NullChannel, [{
  17788. key: 'subscribe',
  17789. /**
  17790. * Subscribe to a channel.
  17791. */
  17792. value: function subscribe() {}
  17793. //
  17794. /**
  17795. * Unsubscribe from a channel.
  17796. */
  17797. }, {
  17798. key: 'unsubscribe',
  17799. value: function unsubscribe() {}
  17800. //
  17801. /**
  17802. * Listen for an event on the channel instance.
  17803. */
  17804. }, {
  17805. key: 'listen',
  17806. value: function listen(event, callback) {
  17807. return this;
  17808. }
  17809. /**
  17810. * Stop listening for an event on the channel instance.
  17811. */
  17812. }, {
  17813. key: 'stopListening',
  17814. value: function stopListening(event) {
  17815. return this;
  17816. }
  17817. /**
  17818. * Bind a channel to an event.
  17819. */
  17820. }, {
  17821. key: 'on',
  17822. value: function on(event, callback) {
  17823. return this;
  17824. }
  17825. }]);
  17826. return NullChannel;
  17827. }(Channel);
  17828. /**
  17829. * This class represents a null private channel.
  17830. */
  17831. var NullPrivateChannel = function (_NullChannel) {
  17832. inherits(NullPrivateChannel, _NullChannel);
  17833. function NullPrivateChannel() {
  17834. classCallCheck(this, NullPrivateChannel);
  17835. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17836. }
  17837. createClass(NullPrivateChannel, [{
  17838. key: 'whisper',
  17839. /**
  17840. * Trigger client event on the channel.
  17841. */
  17842. value: function whisper(eventName, data) {
  17843. return this;
  17844. }
  17845. }]);
  17846. return NullPrivateChannel;
  17847. }(NullChannel);
  17848. /**
  17849. * This class represents a null presence channel.
  17850. */
  17851. var NullPresenceChannel = function (_NullChannel) {
  17852. inherits(NullPresenceChannel, _NullChannel);
  17853. function NullPresenceChannel() {
  17854. classCallCheck(this, NullPresenceChannel);
  17855. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17856. }
  17857. createClass(NullPresenceChannel, [{
  17858. key: 'here',
  17859. /**
  17860. * Register a callback to be called anytime the member list changes.
  17861. */
  17862. value: function here(callback) {
  17863. return this;
  17864. }
  17865. /**
  17866. * Listen for someone joining the channel.
  17867. */
  17868. }, {
  17869. key: 'joining',
  17870. value: function joining(callback) {
  17871. return this;
  17872. }
  17873. /**
  17874. * Listen for someone leaving the channel.
  17875. */
  17876. }, {
  17877. key: 'leaving',
  17878. value: function leaving(callback) {
  17879. return this;
  17880. }
  17881. /**
  17882. * Trigger client event on the channel.
  17883. */
  17884. }, {
  17885. key: 'whisper',
  17886. value: function whisper(eventName, data) {
  17887. return this;
  17888. }
  17889. }]);
  17890. return NullPresenceChannel;
  17891. }(NullChannel);
  17892. /**
  17893. * This class creates a connector to Pusher.
  17894. */
  17895. var PusherConnector = function (_Connector) {
  17896. inherits(PusherConnector, _Connector);
  17897. function PusherConnector() {
  17898. classCallCheck(this, PusherConnector);
  17899. /**
  17900. * All of the subscribed channel names.
  17901. */
  17902. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17903. _this.channels = {};
  17904. return _this;
  17905. }
  17906. /**
  17907. * Create a fresh Pusher connection.
  17908. */
  17909. createClass(PusherConnector, [{
  17910. key: 'connect',
  17911. value: function connect() {
  17912. if (typeof this.options.client !== 'undefined') {
  17913. this.pusher = this.options.client;
  17914. } else {
  17915. this.pusher = new Pusher(this.options.key, this.options);
  17916. }
  17917. }
  17918. /**
  17919. * Listen for an event on a channel instance.
  17920. */
  17921. }, {
  17922. key: 'listen',
  17923. value: function listen(name, event, callback) {
  17924. return this.channel(name).listen(event, callback);
  17925. }
  17926. /**
  17927. * Get a channel instance by name.
  17928. */
  17929. }, {
  17930. key: 'channel',
  17931. value: function channel(name) {
  17932. if (!this.channels[name]) {
  17933. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17934. }
  17935. return this.channels[name];
  17936. }
  17937. /**
  17938. * Get a private channel instance by name.
  17939. */
  17940. }, {
  17941. key: 'privateChannel',
  17942. value: function privateChannel(name) {
  17943. if (!this.channels['private-' + name]) {
  17944. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17945. }
  17946. return this.channels['private-' + name];
  17947. }
  17948. /**
  17949. * Get a presence channel instance by name.
  17950. */
  17951. }, {
  17952. key: 'presenceChannel',
  17953. value: function presenceChannel(name) {
  17954. if (!this.channels['presence-' + name]) {
  17955. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17956. }
  17957. return this.channels['presence-' + name];
  17958. }
  17959. /**
  17960. * Leave the given channel, as well as its private and presence variants.
  17961. */
  17962. }, {
  17963. key: 'leave',
  17964. value: function leave(name) {
  17965. var _this2 = this;
  17966. var channels = [name, 'private-' + name, 'presence-' + name];
  17967. channels.forEach(function (name, index) {
  17968. _this2.leaveChannel(name);
  17969. });
  17970. }
  17971. /**
  17972. * Leave the given channel.
  17973. */
  17974. }, {
  17975. key: 'leaveChannel',
  17976. value: function leaveChannel(name) {
  17977. if (this.channels[name]) {
  17978. this.channels[name].unsubscribe();
  17979. delete this.channels[name];
  17980. }
  17981. }
  17982. /**
  17983. * Get the socket ID for the connection.
  17984. */
  17985. }, {
  17986. key: 'socketId',
  17987. value: function socketId() {
  17988. return this.pusher.connection.socket_id;
  17989. }
  17990. /**
  17991. * Disconnect Pusher connection.
  17992. */
  17993. }, {
  17994. key: 'disconnect',
  17995. value: function disconnect() {
  17996. this.pusher.disconnect();
  17997. }
  17998. }]);
  17999. return PusherConnector;
  18000. }(Connector);
  18001. /**
  18002. * This class creates a connnector to a Socket.io server.
  18003. */
  18004. var SocketIoConnector = function (_Connector) {
  18005. inherits(SocketIoConnector, _Connector);
  18006. function SocketIoConnector() {
  18007. classCallCheck(this, SocketIoConnector);
  18008. /**
  18009. * All of the subscribed channel names.
  18010. */
  18011. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18012. _this.channels = {};
  18013. return _this;
  18014. }
  18015. /**
  18016. * Create a fresh Socket.io connection.
  18017. */
  18018. createClass(SocketIoConnector, [{
  18019. key: 'connect',
  18020. value: function connect() {
  18021. var io = this.getSocketIO();
  18022. this.socket = io(this.options.host, this.options);
  18023. return this.socket;
  18024. }
  18025. /**
  18026. * Get socket.io module from global scope or options.
  18027. */
  18028. }, {
  18029. key: 'getSocketIO',
  18030. value: function getSocketIO() {
  18031. if (typeof this.options.client !== 'undefined') {
  18032. return this.options.client;
  18033. }
  18034. if (typeof io !== 'undefined') {
  18035. return io;
  18036. }
  18037. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18038. }
  18039. /**
  18040. * Listen for an event on a channel instance.
  18041. */
  18042. }, {
  18043. key: 'listen',
  18044. value: function listen(name, event, callback) {
  18045. return this.channel(name).listen(event, callback);
  18046. }
  18047. /**
  18048. * Get a channel instance by name.
  18049. */
  18050. }, {
  18051. key: 'channel',
  18052. value: function channel(name) {
  18053. if (!this.channels[name]) {
  18054. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18055. }
  18056. return this.channels[name];
  18057. }
  18058. /**
  18059. * Get a private channel instance by name.
  18060. */
  18061. }, {
  18062. key: 'privateChannel',
  18063. value: function privateChannel(name) {
  18064. if (!this.channels['private-' + name]) {
  18065. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18066. }
  18067. return this.channels['private-' + name];
  18068. }
  18069. /**
  18070. * Get a presence channel instance by name.
  18071. */
  18072. }, {
  18073. key: 'presenceChannel',
  18074. value: function presenceChannel(name) {
  18075. if (!this.channels['presence-' + name]) {
  18076. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18077. }
  18078. return this.channels['presence-' + name];
  18079. }
  18080. /**
  18081. * Leave the given channel, as well as its private and presence variants.
  18082. */
  18083. }, {
  18084. key: 'leave',
  18085. value: function leave(name) {
  18086. var _this2 = this;
  18087. var channels = [name, 'private-' + name, 'presence-' + name];
  18088. channels.forEach(function (name) {
  18089. _this2.leaveChannel(name);
  18090. });
  18091. }
  18092. /**
  18093. * Leave the given channel.
  18094. */
  18095. }, {
  18096. key: 'leaveChannel',
  18097. value: function leaveChannel(name) {
  18098. if (this.channels[name]) {
  18099. this.channels[name].unsubscribe();
  18100. delete this.channels[name];
  18101. }
  18102. }
  18103. /**
  18104. * Get the socket ID for the connection.
  18105. */
  18106. }, {
  18107. key: 'socketId',
  18108. value: function socketId() {
  18109. return this.socket.id;
  18110. }
  18111. /**
  18112. * Disconnect Socketio connection.
  18113. */
  18114. }, {
  18115. key: 'disconnect',
  18116. value: function disconnect() {
  18117. this.socket.disconnect();
  18118. }
  18119. }]);
  18120. return SocketIoConnector;
  18121. }(Connector);
  18122. /**
  18123. * This class creates a null connector.
  18124. */
  18125. var NullConnector = function (_Connector) {
  18126. inherits(NullConnector, _Connector);
  18127. function NullConnector() {
  18128. classCallCheck(this, NullConnector);
  18129. /**
  18130. * All of the subscribed channel names.
  18131. */
  18132. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18133. _this.channels = {};
  18134. return _this;
  18135. }
  18136. /**
  18137. * Create a fresh connection.
  18138. */
  18139. createClass(NullConnector, [{
  18140. key: 'connect',
  18141. value: function connect() {}
  18142. //
  18143. /**
  18144. * Listen for an event on a channel instance.
  18145. */
  18146. }, {
  18147. key: 'listen',
  18148. value: function listen(name, event, callback) {
  18149. return new NullChannel();
  18150. }
  18151. /**
  18152. * Get a channel instance by name.
  18153. */
  18154. }, {
  18155. key: 'channel',
  18156. value: function channel(name) {
  18157. return new NullChannel();
  18158. }
  18159. /**
  18160. * Get a private channel instance by name.
  18161. */
  18162. }, {
  18163. key: 'privateChannel',
  18164. value: function privateChannel(name) {
  18165. return new NullPrivateChannel();
  18166. }
  18167. /**
  18168. * Get a presence channel instance by name.
  18169. */
  18170. }, {
  18171. key: 'presenceChannel',
  18172. value: function presenceChannel(name) {
  18173. return new NullPresenceChannel();
  18174. }
  18175. /**
  18176. * Leave the given channel, as well as its private and presence variants.
  18177. */
  18178. }, {
  18179. key: 'leave',
  18180. value: function leave(name) {}
  18181. //
  18182. /**
  18183. * Leave the given channel.
  18184. */
  18185. }, {
  18186. key: 'leaveChannel',
  18187. value: function leaveChannel(name) {}
  18188. //
  18189. /**
  18190. * Get the socket ID for the connection.
  18191. */
  18192. }, {
  18193. key: 'socketId',
  18194. value: function socketId() {
  18195. return 'fake-socket-id';
  18196. }
  18197. /**
  18198. * Disconnect the connection.
  18199. */
  18200. }, {
  18201. key: 'disconnect',
  18202. value: function disconnect() {
  18203. //
  18204. }
  18205. }]);
  18206. return NullConnector;
  18207. }(Connector);
  18208. /**
  18209. * This class is the primary API for interacting with broadcasting.
  18210. */
  18211. var Echo = function () {
  18212. /**
  18213. * Create a new class instance.
  18214. */
  18215. function Echo(options) {
  18216. classCallCheck(this, Echo);
  18217. this.options = options;
  18218. this.connect();
  18219. if (!this.options.withoutInterceptors) {
  18220. this.registerInterceptors();
  18221. }
  18222. }
  18223. /**
  18224. * Get a channel instance by name.
  18225. */
  18226. createClass(Echo, [{
  18227. key: 'channel',
  18228. value: function channel(_channel) {
  18229. return this.connector.channel(_channel);
  18230. }
  18231. /**
  18232. * Create a new connection.
  18233. */
  18234. }, {
  18235. key: 'connect',
  18236. value: function connect() {
  18237. if (this.options.broadcaster == 'pusher') {
  18238. this.connector = new PusherConnector(this.options);
  18239. } else if (this.options.broadcaster == 'socket.io') {
  18240. this.connector = new SocketIoConnector(this.options);
  18241. } else if (this.options.broadcaster == 'null') {
  18242. this.connector = new NullConnector(this.options);
  18243. } else if (typeof this.options.broadcaster == 'function') {
  18244. this.connector = new this.options.broadcaster(this.options);
  18245. }
  18246. }
  18247. /**
  18248. * Disconnect from the Echo server.
  18249. */
  18250. }, {
  18251. key: 'disconnect',
  18252. value: function disconnect() {
  18253. this.connector.disconnect();
  18254. }
  18255. /**
  18256. * Get a presence channel instance by name.
  18257. */
  18258. }, {
  18259. key: 'join',
  18260. value: function join(channel) {
  18261. return this.connector.presenceChannel(channel);
  18262. }
  18263. /**
  18264. * Leave the given channel, as well as its private and presence variants.
  18265. */
  18266. }, {
  18267. key: 'leave',
  18268. value: function leave(channel) {
  18269. this.connector.leave(channel);
  18270. }
  18271. /**
  18272. * Leave the given channel.
  18273. */
  18274. }, {
  18275. key: 'leaveChannel',
  18276. value: function leaveChannel(channel) {
  18277. this.connector.leaveChannel(channel);
  18278. }
  18279. /**
  18280. * Listen for an event on a channel instance.
  18281. */
  18282. }, {
  18283. key: 'listen',
  18284. value: function listen(channel, event, callback) {
  18285. return this.connector.listen(channel, event, callback);
  18286. }
  18287. /**
  18288. * Get a private channel instance by name.
  18289. */
  18290. }, {
  18291. key: 'private',
  18292. value: function _private(channel) {
  18293. return this.connector.privateChannel(channel);
  18294. }
  18295. /**
  18296. * Get the Socket ID for the connection.
  18297. */
  18298. }, {
  18299. key: 'socketId',
  18300. value: function socketId() {
  18301. return this.connector.socketId();
  18302. }
  18303. /**
  18304. * Register 3rd party request interceptiors. These are used to automatically
  18305. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18306. */
  18307. }, {
  18308. key: 'registerInterceptors',
  18309. value: function registerInterceptors() {
  18310. if (typeof Vue === 'function' && Vue.http) {
  18311. this.registerVueRequestInterceptor();
  18312. }
  18313. if (typeof axios === 'function') {
  18314. this.registerAxiosRequestInterceptor();
  18315. }
  18316. if (typeof jQuery === 'function') {
  18317. this.registerjQueryAjaxSetup();
  18318. }
  18319. }
  18320. /**
  18321. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18322. */
  18323. }, {
  18324. key: 'registerVueRequestInterceptor',
  18325. value: function registerVueRequestInterceptor() {
  18326. var _this = this;
  18327. Vue.http.interceptors.push(function (request, next) {
  18328. if (_this.socketId()) {
  18329. request.headers.set('X-Socket-ID', _this.socketId());
  18330. }
  18331. next();
  18332. });
  18333. }
  18334. /**
  18335. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18336. */
  18337. }, {
  18338. key: 'registerAxiosRequestInterceptor',
  18339. value: function registerAxiosRequestInterceptor() {
  18340. var _this2 = this;
  18341. axios.interceptors.request.use(function (config) {
  18342. if (_this2.socketId()) {
  18343. config.headers['X-Socket-Id'] = _this2.socketId();
  18344. }
  18345. return config;
  18346. });
  18347. }
  18348. /**
  18349. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18350. */
  18351. }, {
  18352. key: 'registerjQueryAjaxSetup',
  18353. value: function registerjQueryAjaxSetup() {
  18354. var _this3 = this;
  18355. if (typeof jQuery.ajax != 'undefined') {
  18356. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18357. if (_this3.socketId()) {
  18358. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18359. }
  18360. });
  18361. }
  18362. }
  18363. }]);
  18364. return Echo;
  18365. }();
  18366. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18367. /***/ }),
  18368. /***/ "./node_modules/lodash/lodash.js":
  18369. /*!***************************************!*\
  18370. !*** ./node_modules/lodash/lodash.js ***!
  18371. \***************************************/
  18372. /*! no static exports found */
  18373. /***/ (function(module, exports, __webpack_require__) {
  18374. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18375. * @license
  18376. * Lodash <https://lodash.com/>
  18377. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18378. * Released under MIT license <https://lodash.com/license>
  18379. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18380. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18381. */
  18382. ;(function() {
  18383. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18384. var undefined;
  18385. /** Used as the semantic version number. */
  18386. var VERSION = '4.17.15';
  18387. /** Used as the size to enable large array optimizations. */
  18388. var LARGE_ARRAY_SIZE = 200;
  18389. /** Error message constants. */
  18390. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18391. FUNC_ERROR_TEXT = 'Expected a function';
  18392. /** Used to stand-in for `undefined` hash values. */
  18393. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18394. /** Used as the maximum memoize cache size. */
  18395. var MAX_MEMOIZE_SIZE = 500;
  18396. /** Used as the internal argument placeholder. */
  18397. var PLACEHOLDER = '__lodash_placeholder__';
  18398. /** Used to compose bitmasks for cloning. */
  18399. var CLONE_DEEP_FLAG = 1,
  18400. CLONE_FLAT_FLAG = 2,
  18401. CLONE_SYMBOLS_FLAG = 4;
  18402. /** Used to compose bitmasks for value comparisons. */
  18403. var COMPARE_PARTIAL_FLAG = 1,
  18404. COMPARE_UNORDERED_FLAG = 2;
  18405. /** Used to compose bitmasks for function metadata. */
  18406. var WRAP_BIND_FLAG = 1,
  18407. WRAP_BIND_KEY_FLAG = 2,
  18408. WRAP_CURRY_BOUND_FLAG = 4,
  18409. WRAP_CURRY_FLAG = 8,
  18410. WRAP_CURRY_RIGHT_FLAG = 16,
  18411. WRAP_PARTIAL_FLAG = 32,
  18412. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18413. WRAP_ARY_FLAG = 128,
  18414. WRAP_REARG_FLAG = 256,
  18415. WRAP_FLIP_FLAG = 512;
  18416. /** Used as default options for `_.truncate`. */
  18417. var DEFAULT_TRUNC_LENGTH = 30,
  18418. DEFAULT_TRUNC_OMISSION = '...';
  18419. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18420. var HOT_COUNT = 800,
  18421. HOT_SPAN = 16;
  18422. /** Used to indicate the type of lazy iteratees. */
  18423. var LAZY_FILTER_FLAG = 1,
  18424. LAZY_MAP_FLAG = 2,
  18425. LAZY_WHILE_FLAG = 3;
  18426. /** Used as references for various `Number` constants. */
  18427. var INFINITY = 1 / 0,
  18428. MAX_SAFE_INTEGER = 9007199254740991,
  18429. MAX_INTEGER = 1.7976931348623157e+308,
  18430. NAN = 0 / 0;
  18431. /** Used as references for the maximum length and index of an array. */
  18432. var MAX_ARRAY_LENGTH = 4294967295,
  18433. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18434. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18435. /** Used to associate wrap methods with their bit flags. */
  18436. var wrapFlags = [
  18437. ['ary', WRAP_ARY_FLAG],
  18438. ['bind', WRAP_BIND_FLAG],
  18439. ['bindKey', WRAP_BIND_KEY_FLAG],
  18440. ['curry', WRAP_CURRY_FLAG],
  18441. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18442. ['flip', WRAP_FLIP_FLAG],
  18443. ['partial', WRAP_PARTIAL_FLAG],
  18444. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18445. ['rearg', WRAP_REARG_FLAG]
  18446. ];
  18447. /** `Object#toString` result references. */
  18448. var argsTag = '[object Arguments]',
  18449. arrayTag = '[object Array]',
  18450. asyncTag = '[object AsyncFunction]',
  18451. boolTag = '[object Boolean]',
  18452. dateTag = '[object Date]',
  18453. domExcTag = '[object DOMException]',
  18454. errorTag = '[object Error]',
  18455. funcTag = '[object Function]',
  18456. genTag = '[object GeneratorFunction]',
  18457. mapTag = '[object Map]',
  18458. numberTag = '[object Number]',
  18459. nullTag = '[object Null]',
  18460. objectTag = '[object Object]',
  18461. promiseTag = '[object Promise]',
  18462. proxyTag = '[object Proxy]',
  18463. regexpTag = '[object RegExp]',
  18464. setTag = '[object Set]',
  18465. stringTag = '[object String]',
  18466. symbolTag = '[object Symbol]',
  18467. undefinedTag = '[object Undefined]',
  18468. weakMapTag = '[object WeakMap]',
  18469. weakSetTag = '[object WeakSet]';
  18470. var arrayBufferTag = '[object ArrayBuffer]',
  18471. dataViewTag = '[object DataView]',
  18472. float32Tag = '[object Float32Array]',
  18473. float64Tag = '[object Float64Array]',
  18474. int8Tag = '[object Int8Array]',
  18475. int16Tag = '[object Int16Array]',
  18476. int32Tag = '[object Int32Array]',
  18477. uint8Tag = '[object Uint8Array]',
  18478. uint8ClampedTag = '[object Uint8ClampedArray]',
  18479. uint16Tag = '[object Uint16Array]',
  18480. uint32Tag = '[object Uint32Array]';
  18481. /** Used to match empty string literals in compiled template source. */
  18482. var reEmptyStringLeading = /\b__p \+= '';/g,
  18483. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18484. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18485. /** Used to match HTML entities and HTML characters. */
  18486. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18487. reUnescapedHtml = /[&<>"']/g,
  18488. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18489. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18490. /** Used to match template delimiters. */
  18491. var reEscape = /<%-([\s\S]+?)%>/g,
  18492. reEvaluate = /<%([\s\S]+?)%>/g,
  18493. reInterpolate = /<%=([\s\S]+?)%>/g;
  18494. /** Used to match property names within property paths. */
  18495. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18496. reIsPlainProp = /^\w*$/,
  18497. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18498. /**
  18499. * Used to match `RegExp`
  18500. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18501. */
  18502. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18503. reHasRegExpChar = RegExp(reRegExpChar.source);
  18504. /** Used to match leading and trailing whitespace. */
  18505. var reTrim = /^\s+|\s+$/g,
  18506. reTrimStart = /^\s+/,
  18507. reTrimEnd = /\s+$/;
  18508. /** Used to match wrap detail comments. */
  18509. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18510. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18511. reSplitDetails = /,? & /;
  18512. /** Used to match words composed of alphanumeric characters. */
  18513. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18514. /** Used to match backslashes in property paths. */
  18515. var reEscapeChar = /\\(\\)?/g;
  18516. /**
  18517. * Used to match
  18518. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18519. */
  18520. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18521. /** Used to match `RegExp` flags from their coerced string values. */
  18522. var reFlags = /\w*$/;
  18523. /** Used to detect bad signed hexadecimal string values. */
  18524. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18525. /** Used to detect binary string values. */
  18526. var reIsBinary = /^0b[01]+$/i;
  18527. /** Used to detect host constructors (Safari). */
  18528. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18529. /** Used to detect octal string values. */
  18530. var reIsOctal = /^0o[0-7]+$/i;
  18531. /** Used to detect unsigned integer values. */
  18532. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18533. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18534. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18535. /** Used to ensure capturing order of template delimiters. */
  18536. var reNoMatch = /($^)/;
  18537. /** Used to match unescaped characters in compiled string literals. */
  18538. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18539. /** Used to compose unicode character classes. */
  18540. var rsAstralRange = '\\ud800-\\udfff',
  18541. rsComboMarksRange = '\\u0300-\\u036f',
  18542. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18543. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18544. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18545. rsDingbatRange = '\\u2700-\\u27bf',
  18546. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18547. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18548. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18549. rsPunctuationRange = '\\u2000-\\u206f',
  18550. 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',
  18551. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18552. rsVarRange = '\\ufe0e\\ufe0f',
  18553. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18554. /** Used to compose unicode capture groups. */
  18555. var rsApos = "['\u2019]",
  18556. rsAstral = '[' + rsAstralRange + ']',
  18557. rsBreak = '[' + rsBreakRange + ']',
  18558. rsCombo = '[' + rsComboRange + ']',
  18559. rsDigits = '\\d+',
  18560. rsDingbat = '[' + rsDingbatRange + ']',
  18561. rsLower = '[' + rsLowerRange + ']',
  18562. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18563. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18564. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18565. rsNonAstral = '[^' + rsAstralRange + ']',
  18566. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18567. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18568. rsUpper = '[' + rsUpperRange + ']',
  18569. rsZWJ = '\\u200d';
  18570. /** Used to compose unicode regexes. */
  18571. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18572. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18573. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18574. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18575. reOptMod = rsModifier + '?',
  18576. rsOptVar = '[' + rsVarRange + ']?',
  18577. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18578. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18579. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18580. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18581. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18582. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18583. /** Used to match apostrophes. */
  18584. var reApos = RegExp(rsApos, 'g');
  18585. /**
  18586. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18587. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18588. */
  18589. var reComboMark = RegExp(rsCombo, 'g');
  18590. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18591. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18592. /** Used to match complex or compound words. */
  18593. var reUnicodeWord = RegExp([
  18594. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18595. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18596. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18597. rsUpper + '+' + rsOptContrUpper,
  18598. rsOrdUpper,
  18599. rsOrdLower,
  18600. rsDigits,
  18601. rsEmoji
  18602. ].join('|'), 'g');
  18603. /** 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/). */
  18604. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18605. /** Used to detect strings that need a more robust regexp to match words. */
  18606. 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 ]/;
  18607. /** Used to assign default `context` object properties. */
  18608. var contextProps = [
  18609. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18610. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18611. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18612. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18613. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18614. ];
  18615. /** Used to make template sourceURLs easier to identify. */
  18616. var templateCounter = -1;
  18617. /** Used to identify `toStringTag` values of typed arrays. */
  18618. var typedArrayTags = {};
  18619. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18620. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18621. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18622. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18623. typedArrayTags[uint32Tag] = true;
  18624. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18625. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18626. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18627. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18628. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18629. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18630. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18631. typedArrayTags[weakMapTag] = false;
  18632. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18633. var cloneableTags = {};
  18634. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18635. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18636. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18637. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18638. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18639. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18640. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18641. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18642. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18643. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18644. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18645. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18646. cloneableTags[weakMapTag] = false;
  18647. /** Used to map Latin Unicode letters to basic Latin letters. */
  18648. var deburredLetters = {
  18649. // Latin-1 Supplement block.
  18650. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18651. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18652. '\xc7': 'C', '\xe7': 'c',
  18653. '\xd0': 'D', '\xf0': 'd',
  18654. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18655. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18656. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18657. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18658. '\xd1': 'N', '\xf1': 'n',
  18659. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18660. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18661. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18662. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18663. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18664. '\xc6': 'Ae', '\xe6': 'ae',
  18665. '\xde': 'Th', '\xfe': 'th',
  18666. '\xdf': 'ss',
  18667. // Latin Extended-A block.
  18668. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18669. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18670. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18671. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18672. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18673. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18674. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18675. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18676. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18677. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18678. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18679. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18680. '\u0134': 'J', '\u0135': 'j',
  18681. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18682. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18683. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18684. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18685. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18686. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18687. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18688. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18689. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18690. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18691. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18692. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18693. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18694. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18695. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18696. '\u0174': 'W', '\u0175': 'w',
  18697. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18698. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18699. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18700. '\u0132': 'IJ', '\u0133': 'ij',
  18701. '\u0152': 'Oe', '\u0153': 'oe',
  18702. '\u0149': "'n", '\u017f': 's'
  18703. };
  18704. /** Used to map characters to HTML entities. */
  18705. var htmlEscapes = {
  18706. '&': '&amp;',
  18707. '<': '&lt;',
  18708. '>': '&gt;',
  18709. '"': '&quot;',
  18710. "'": '&#39;'
  18711. };
  18712. /** Used to map HTML entities to characters. */
  18713. var htmlUnescapes = {
  18714. '&amp;': '&',
  18715. '&lt;': '<',
  18716. '&gt;': '>',
  18717. '&quot;': '"',
  18718. '&#39;': "'"
  18719. };
  18720. /** Used to escape characters for inclusion in compiled string literals. */
  18721. var stringEscapes = {
  18722. '\\': '\\',
  18723. "'": "'",
  18724. '\n': 'n',
  18725. '\r': 'r',
  18726. '\u2028': 'u2028',
  18727. '\u2029': 'u2029'
  18728. };
  18729. /** Built-in method references without a dependency on `root`. */
  18730. var freeParseFloat = parseFloat,
  18731. freeParseInt = parseInt;
  18732. /** Detect free variable `global` from Node.js. */
  18733. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18734. /** Detect free variable `self`. */
  18735. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18736. /** Used as a reference to the global object. */
  18737. var root = freeGlobal || freeSelf || Function('return this')();
  18738. /** Detect free variable `exports`. */
  18739. var freeExports = true && exports && !exports.nodeType && exports;
  18740. /** Detect free variable `module`. */
  18741. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18742. /** Detect the popular CommonJS extension `module.exports`. */
  18743. var moduleExports = freeModule && freeModule.exports === freeExports;
  18744. /** Detect free variable `process` from Node.js. */
  18745. var freeProcess = moduleExports && freeGlobal.process;
  18746. /** Used to access faster Node.js helpers. */
  18747. var nodeUtil = (function() {
  18748. try {
  18749. // Use `util.types` for Node.js 10+.
  18750. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18751. if (types) {
  18752. return types;
  18753. }
  18754. // Legacy `process.binding('util')` for Node.js < 10.
  18755. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18756. } catch (e) {}
  18757. }());
  18758. /* Node.js helper references. */
  18759. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18760. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18761. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18762. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18763. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18764. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18765. /*--------------------------------------------------------------------------*/
  18766. /**
  18767. * A faster alternative to `Function#apply`, this function invokes `func`
  18768. * with the `this` binding of `thisArg` and the arguments of `args`.
  18769. *
  18770. * @private
  18771. * @param {Function} func The function to invoke.
  18772. * @param {*} thisArg The `this` binding of `func`.
  18773. * @param {Array} args The arguments to invoke `func` with.
  18774. * @returns {*} Returns the result of `func`.
  18775. */
  18776. function apply(func, thisArg, args) {
  18777. switch (args.length) {
  18778. case 0: return func.call(thisArg);
  18779. case 1: return func.call(thisArg, args[0]);
  18780. case 2: return func.call(thisArg, args[0], args[1]);
  18781. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18782. }
  18783. return func.apply(thisArg, args);
  18784. }
  18785. /**
  18786. * A specialized version of `baseAggregator` for arrays.
  18787. *
  18788. * @private
  18789. * @param {Array} [array] The array to iterate over.
  18790. * @param {Function} setter The function to set `accumulator` values.
  18791. * @param {Function} iteratee The iteratee to transform keys.
  18792. * @param {Object} accumulator The initial aggregated object.
  18793. * @returns {Function} Returns `accumulator`.
  18794. */
  18795. function arrayAggregator(array, setter, iteratee, accumulator) {
  18796. var index = -1,
  18797. length = array == null ? 0 : array.length;
  18798. while (++index < length) {
  18799. var value = array[index];
  18800. setter(accumulator, value, iteratee(value), array);
  18801. }
  18802. return accumulator;
  18803. }
  18804. /**
  18805. * A specialized version of `_.forEach` for arrays without support for
  18806. * iteratee shorthands.
  18807. *
  18808. * @private
  18809. * @param {Array} [array] The array to iterate over.
  18810. * @param {Function} iteratee The function invoked per iteration.
  18811. * @returns {Array} Returns `array`.
  18812. */
  18813. function arrayEach(array, iteratee) {
  18814. var index = -1,
  18815. length = array == null ? 0 : array.length;
  18816. while (++index < length) {
  18817. if (iteratee(array[index], index, array) === false) {
  18818. break;
  18819. }
  18820. }
  18821. return array;
  18822. }
  18823. /**
  18824. * A specialized version of `_.forEachRight` for arrays without support for
  18825. * iteratee shorthands.
  18826. *
  18827. * @private
  18828. * @param {Array} [array] The array to iterate over.
  18829. * @param {Function} iteratee The function invoked per iteration.
  18830. * @returns {Array} Returns `array`.
  18831. */
  18832. function arrayEachRight(array, iteratee) {
  18833. var length = array == null ? 0 : array.length;
  18834. while (length--) {
  18835. if (iteratee(array[length], length, array) === false) {
  18836. break;
  18837. }
  18838. }
  18839. return array;
  18840. }
  18841. /**
  18842. * A specialized version of `_.every` for arrays without support for
  18843. * iteratee shorthands.
  18844. *
  18845. * @private
  18846. * @param {Array} [array] The array to iterate over.
  18847. * @param {Function} predicate The function invoked per iteration.
  18848. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18849. * else `false`.
  18850. */
  18851. function arrayEvery(array, predicate) {
  18852. var index = -1,
  18853. length = array == null ? 0 : array.length;
  18854. while (++index < length) {
  18855. if (!predicate(array[index], index, array)) {
  18856. return false;
  18857. }
  18858. }
  18859. return true;
  18860. }
  18861. /**
  18862. * A specialized version of `_.filter` for arrays without support for
  18863. * iteratee shorthands.
  18864. *
  18865. * @private
  18866. * @param {Array} [array] The array to iterate over.
  18867. * @param {Function} predicate The function invoked per iteration.
  18868. * @returns {Array} Returns the new filtered array.
  18869. */
  18870. function arrayFilter(array, predicate) {
  18871. var index = -1,
  18872. length = array == null ? 0 : array.length,
  18873. resIndex = 0,
  18874. result = [];
  18875. while (++index < length) {
  18876. var value = array[index];
  18877. if (predicate(value, index, array)) {
  18878. result[resIndex++] = value;
  18879. }
  18880. }
  18881. return result;
  18882. }
  18883. /**
  18884. * A specialized version of `_.includes` for arrays without support for
  18885. * specifying an index to search from.
  18886. *
  18887. * @private
  18888. * @param {Array} [array] The array to inspect.
  18889. * @param {*} target The value to search for.
  18890. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18891. */
  18892. function arrayIncludes(array, value) {
  18893. var length = array == null ? 0 : array.length;
  18894. return !!length && baseIndexOf(array, value, 0) > -1;
  18895. }
  18896. /**
  18897. * This function is like `arrayIncludes` except that it accepts a comparator.
  18898. *
  18899. * @private
  18900. * @param {Array} [array] The array to inspect.
  18901. * @param {*} target The value to search for.
  18902. * @param {Function} comparator The comparator invoked per element.
  18903. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18904. */
  18905. function arrayIncludesWith(array, value, comparator) {
  18906. var index = -1,
  18907. length = array == null ? 0 : array.length;
  18908. while (++index < length) {
  18909. if (comparator(value, array[index])) {
  18910. return true;
  18911. }
  18912. }
  18913. return false;
  18914. }
  18915. /**
  18916. * A specialized version of `_.map` for arrays without support for iteratee
  18917. * shorthands.
  18918. *
  18919. * @private
  18920. * @param {Array} [array] The array to iterate over.
  18921. * @param {Function} iteratee The function invoked per iteration.
  18922. * @returns {Array} Returns the new mapped array.
  18923. */
  18924. function arrayMap(array, iteratee) {
  18925. var index = -1,
  18926. length = array == null ? 0 : array.length,
  18927. result = Array(length);
  18928. while (++index < length) {
  18929. result[index] = iteratee(array[index], index, array);
  18930. }
  18931. return result;
  18932. }
  18933. /**
  18934. * Appends the elements of `values` to `array`.
  18935. *
  18936. * @private
  18937. * @param {Array} array The array to modify.
  18938. * @param {Array} values The values to append.
  18939. * @returns {Array} Returns `array`.
  18940. */
  18941. function arrayPush(array, values) {
  18942. var index = -1,
  18943. length = values.length,
  18944. offset = array.length;
  18945. while (++index < length) {
  18946. array[offset + index] = values[index];
  18947. }
  18948. return array;
  18949. }
  18950. /**
  18951. * A specialized version of `_.reduce` for arrays without support for
  18952. * iteratee shorthands.
  18953. *
  18954. * @private
  18955. * @param {Array} [array] The array to iterate over.
  18956. * @param {Function} iteratee The function invoked per iteration.
  18957. * @param {*} [accumulator] The initial value.
  18958. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18959. * the initial value.
  18960. * @returns {*} Returns the accumulated value.
  18961. */
  18962. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18963. var index = -1,
  18964. length = array == null ? 0 : array.length;
  18965. if (initAccum && length) {
  18966. accumulator = array[++index];
  18967. }
  18968. while (++index < length) {
  18969. accumulator = iteratee(accumulator, array[index], index, array);
  18970. }
  18971. return accumulator;
  18972. }
  18973. /**
  18974. * A specialized version of `_.reduceRight` for arrays without support for
  18975. * iteratee shorthands.
  18976. *
  18977. * @private
  18978. * @param {Array} [array] The array to iterate over.
  18979. * @param {Function} iteratee The function invoked per iteration.
  18980. * @param {*} [accumulator] The initial value.
  18981. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18982. * the initial value.
  18983. * @returns {*} Returns the accumulated value.
  18984. */
  18985. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18986. var length = array == null ? 0 : array.length;
  18987. if (initAccum && length) {
  18988. accumulator = array[--length];
  18989. }
  18990. while (length--) {
  18991. accumulator = iteratee(accumulator, array[length], length, array);
  18992. }
  18993. return accumulator;
  18994. }
  18995. /**
  18996. * A specialized version of `_.some` for arrays without support for iteratee
  18997. * shorthands.
  18998. *
  18999. * @private
  19000. * @param {Array} [array] The array to iterate over.
  19001. * @param {Function} predicate The function invoked per iteration.
  19002. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19003. * else `false`.
  19004. */
  19005. function arraySome(array, predicate) {
  19006. var index = -1,
  19007. length = array == null ? 0 : array.length;
  19008. while (++index < length) {
  19009. if (predicate(array[index], index, array)) {
  19010. return true;
  19011. }
  19012. }
  19013. return false;
  19014. }
  19015. /**
  19016. * Gets the size of an ASCII `string`.
  19017. *
  19018. * @private
  19019. * @param {string} string The string inspect.
  19020. * @returns {number} Returns the string size.
  19021. */
  19022. var asciiSize = baseProperty('length');
  19023. /**
  19024. * Converts an ASCII `string` to an array.
  19025. *
  19026. * @private
  19027. * @param {string} string The string to convert.
  19028. * @returns {Array} Returns the converted array.
  19029. */
  19030. function asciiToArray(string) {
  19031. return string.split('');
  19032. }
  19033. /**
  19034. * Splits an ASCII `string` into an array of its words.
  19035. *
  19036. * @private
  19037. * @param {string} The string to inspect.
  19038. * @returns {Array} Returns the words of `string`.
  19039. */
  19040. function asciiWords(string) {
  19041. return string.match(reAsciiWord) || [];
  19042. }
  19043. /**
  19044. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19045. * without support for iteratee shorthands, which iterates over `collection`
  19046. * using `eachFunc`.
  19047. *
  19048. * @private
  19049. * @param {Array|Object} collection The collection to inspect.
  19050. * @param {Function} predicate The function invoked per iteration.
  19051. * @param {Function} eachFunc The function to iterate over `collection`.
  19052. * @returns {*} Returns the found element or its key, else `undefined`.
  19053. */
  19054. function baseFindKey(collection, predicate, eachFunc) {
  19055. var result;
  19056. eachFunc(collection, function(value, key, collection) {
  19057. if (predicate(value, key, collection)) {
  19058. result = key;
  19059. return false;
  19060. }
  19061. });
  19062. return result;
  19063. }
  19064. /**
  19065. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19066. * support for iteratee shorthands.
  19067. *
  19068. * @private
  19069. * @param {Array} array The array to inspect.
  19070. * @param {Function} predicate The function invoked per iteration.
  19071. * @param {number} fromIndex The index to search from.
  19072. * @param {boolean} [fromRight] Specify iterating from right to left.
  19073. * @returns {number} Returns the index of the matched value, else `-1`.
  19074. */
  19075. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19076. var length = array.length,
  19077. index = fromIndex + (fromRight ? 1 : -1);
  19078. while ((fromRight ? index-- : ++index < length)) {
  19079. if (predicate(array[index], index, array)) {
  19080. return index;
  19081. }
  19082. }
  19083. return -1;
  19084. }
  19085. /**
  19086. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19087. *
  19088. * @private
  19089. * @param {Array} array The array to inspect.
  19090. * @param {*} value The value to search for.
  19091. * @param {number} fromIndex The index to search from.
  19092. * @returns {number} Returns the index of the matched value, else `-1`.
  19093. */
  19094. function baseIndexOf(array, value, fromIndex) {
  19095. return value === value
  19096. ? strictIndexOf(array, value, fromIndex)
  19097. : baseFindIndex(array, baseIsNaN, fromIndex);
  19098. }
  19099. /**
  19100. * This function is like `baseIndexOf` except that it accepts a comparator.
  19101. *
  19102. * @private
  19103. * @param {Array} array The array to inspect.
  19104. * @param {*} value The value to search for.
  19105. * @param {number} fromIndex The index to search from.
  19106. * @param {Function} comparator The comparator invoked per element.
  19107. * @returns {number} Returns the index of the matched value, else `-1`.
  19108. */
  19109. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19110. var index = fromIndex - 1,
  19111. length = array.length;
  19112. while (++index < length) {
  19113. if (comparator(array[index], value)) {
  19114. return index;
  19115. }
  19116. }
  19117. return -1;
  19118. }
  19119. /**
  19120. * The base implementation of `_.isNaN` without support for number objects.
  19121. *
  19122. * @private
  19123. * @param {*} value The value to check.
  19124. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19125. */
  19126. function baseIsNaN(value) {
  19127. return value !== value;
  19128. }
  19129. /**
  19130. * The base implementation of `_.mean` and `_.meanBy` without support for
  19131. * iteratee shorthands.
  19132. *
  19133. * @private
  19134. * @param {Array} array The array to iterate over.
  19135. * @param {Function} iteratee The function invoked per iteration.
  19136. * @returns {number} Returns the mean.
  19137. */
  19138. function baseMean(array, iteratee) {
  19139. var length = array == null ? 0 : array.length;
  19140. return length ? (baseSum(array, iteratee) / length) : NAN;
  19141. }
  19142. /**
  19143. * The base implementation of `_.property` without support for deep paths.
  19144. *
  19145. * @private
  19146. * @param {string} key The key of the property to get.
  19147. * @returns {Function} Returns the new accessor function.
  19148. */
  19149. function baseProperty(key) {
  19150. return function(object) {
  19151. return object == null ? undefined : object[key];
  19152. };
  19153. }
  19154. /**
  19155. * The base implementation of `_.propertyOf` without support for deep paths.
  19156. *
  19157. * @private
  19158. * @param {Object} object The object to query.
  19159. * @returns {Function} Returns the new accessor function.
  19160. */
  19161. function basePropertyOf(object) {
  19162. return function(key) {
  19163. return object == null ? undefined : object[key];
  19164. };
  19165. }
  19166. /**
  19167. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19168. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19169. *
  19170. * @private
  19171. * @param {Array|Object} collection The collection to iterate over.
  19172. * @param {Function} iteratee The function invoked per iteration.
  19173. * @param {*} accumulator The initial value.
  19174. * @param {boolean} initAccum Specify using the first or last element of
  19175. * `collection` as the initial value.
  19176. * @param {Function} eachFunc The function to iterate over `collection`.
  19177. * @returns {*} Returns the accumulated value.
  19178. */
  19179. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19180. eachFunc(collection, function(value, index, collection) {
  19181. accumulator = initAccum
  19182. ? (initAccum = false, value)
  19183. : iteratee(accumulator, value, index, collection);
  19184. });
  19185. return accumulator;
  19186. }
  19187. /**
  19188. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19189. * sort order of `array` and replaces criteria objects with their corresponding
  19190. * values.
  19191. *
  19192. * @private
  19193. * @param {Array} array The array to sort.
  19194. * @param {Function} comparer The function to define sort order.
  19195. * @returns {Array} Returns `array`.
  19196. */
  19197. function baseSortBy(array, comparer) {
  19198. var length = array.length;
  19199. array.sort(comparer);
  19200. while (length--) {
  19201. array[length] = array[length].value;
  19202. }
  19203. return array;
  19204. }
  19205. /**
  19206. * The base implementation of `_.sum` and `_.sumBy` without support for
  19207. * iteratee shorthands.
  19208. *
  19209. * @private
  19210. * @param {Array} array The array to iterate over.
  19211. * @param {Function} iteratee The function invoked per iteration.
  19212. * @returns {number} Returns the sum.
  19213. */
  19214. function baseSum(array, iteratee) {
  19215. var result,
  19216. index = -1,
  19217. length = array.length;
  19218. while (++index < length) {
  19219. var current = iteratee(array[index]);
  19220. if (current !== undefined) {
  19221. result = result === undefined ? current : (result + current);
  19222. }
  19223. }
  19224. return result;
  19225. }
  19226. /**
  19227. * The base implementation of `_.times` without support for iteratee shorthands
  19228. * or max array length checks.
  19229. *
  19230. * @private
  19231. * @param {number} n The number of times to invoke `iteratee`.
  19232. * @param {Function} iteratee The function invoked per iteration.
  19233. * @returns {Array} Returns the array of results.
  19234. */
  19235. function baseTimes(n, iteratee) {
  19236. var index = -1,
  19237. result = Array(n);
  19238. while (++index < n) {
  19239. result[index] = iteratee(index);
  19240. }
  19241. return result;
  19242. }
  19243. /**
  19244. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19245. * of key-value pairs for `object` corresponding to the property names of `props`.
  19246. *
  19247. * @private
  19248. * @param {Object} object The object to query.
  19249. * @param {Array} props The property names to get values for.
  19250. * @returns {Object} Returns the key-value pairs.
  19251. */
  19252. function baseToPairs(object, props) {
  19253. return arrayMap(props, function(key) {
  19254. return [key, object[key]];
  19255. });
  19256. }
  19257. /**
  19258. * The base implementation of `_.unary` without support for storing metadata.
  19259. *
  19260. * @private
  19261. * @param {Function} func The function to cap arguments for.
  19262. * @returns {Function} Returns the new capped function.
  19263. */
  19264. function baseUnary(func) {
  19265. return function(value) {
  19266. return func(value);
  19267. };
  19268. }
  19269. /**
  19270. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19271. * array of `object` property values corresponding to the property names
  19272. * of `props`.
  19273. *
  19274. * @private
  19275. * @param {Object} object The object to query.
  19276. * @param {Array} props The property names to get values for.
  19277. * @returns {Object} Returns the array of property values.
  19278. */
  19279. function baseValues(object, props) {
  19280. return arrayMap(props, function(key) {
  19281. return object[key];
  19282. });
  19283. }
  19284. /**
  19285. * Checks if a `cache` value for `key` exists.
  19286. *
  19287. * @private
  19288. * @param {Object} cache The cache to query.
  19289. * @param {string} key The key of the entry to check.
  19290. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19291. */
  19292. function cacheHas(cache, key) {
  19293. return cache.has(key);
  19294. }
  19295. /**
  19296. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19297. * that is not found in the character symbols.
  19298. *
  19299. * @private
  19300. * @param {Array} strSymbols The string symbols to inspect.
  19301. * @param {Array} chrSymbols The character symbols to find.
  19302. * @returns {number} Returns the index of the first unmatched string symbol.
  19303. */
  19304. function charsStartIndex(strSymbols, chrSymbols) {
  19305. var index = -1,
  19306. length = strSymbols.length;
  19307. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19308. return index;
  19309. }
  19310. /**
  19311. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19312. * that is not found in the character symbols.
  19313. *
  19314. * @private
  19315. * @param {Array} strSymbols The string symbols to inspect.
  19316. * @param {Array} chrSymbols The character symbols to find.
  19317. * @returns {number} Returns the index of the last unmatched string symbol.
  19318. */
  19319. function charsEndIndex(strSymbols, chrSymbols) {
  19320. var index = strSymbols.length;
  19321. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19322. return index;
  19323. }
  19324. /**
  19325. * Gets the number of `placeholder` occurrences in `array`.
  19326. *
  19327. * @private
  19328. * @param {Array} array The array to inspect.
  19329. * @param {*} placeholder The placeholder to search for.
  19330. * @returns {number} Returns the placeholder count.
  19331. */
  19332. function countHolders(array, placeholder) {
  19333. var length = array.length,
  19334. result = 0;
  19335. while (length--) {
  19336. if (array[length] === placeholder) {
  19337. ++result;
  19338. }
  19339. }
  19340. return result;
  19341. }
  19342. /**
  19343. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19344. * letters to basic Latin letters.
  19345. *
  19346. * @private
  19347. * @param {string} letter The matched letter to deburr.
  19348. * @returns {string} Returns the deburred letter.
  19349. */
  19350. var deburrLetter = basePropertyOf(deburredLetters);
  19351. /**
  19352. * Used by `_.escape` to convert characters to HTML entities.
  19353. *
  19354. * @private
  19355. * @param {string} chr The matched character to escape.
  19356. * @returns {string} Returns the escaped character.
  19357. */
  19358. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19359. /**
  19360. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19361. *
  19362. * @private
  19363. * @param {string} chr The matched character to escape.
  19364. * @returns {string} Returns the escaped character.
  19365. */
  19366. function escapeStringChar(chr) {
  19367. return '\\' + stringEscapes[chr];
  19368. }
  19369. /**
  19370. * Gets the value at `key` of `object`.
  19371. *
  19372. * @private
  19373. * @param {Object} [object] The object to query.
  19374. * @param {string} key The key of the property to get.
  19375. * @returns {*} Returns the property value.
  19376. */
  19377. function getValue(object, key) {
  19378. return object == null ? undefined : object[key];
  19379. }
  19380. /**
  19381. * Checks if `string` contains Unicode symbols.
  19382. *
  19383. * @private
  19384. * @param {string} string The string to inspect.
  19385. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19386. */
  19387. function hasUnicode(string) {
  19388. return reHasUnicode.test(string);
  19389. }
  19390. /**
  19391. * Checks if `string` contains a word composed of Unicode symbols.
  19392. *
  19393. * @private
  19394. * @param {string} string The string to inspect.
  19395. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19396. */
  19397. function hasUnicodeWord(string) {
  19398. return reHasUnicodeWord.test(string);
  19399. }
  19400. /**
  19401. * Converts `iterator` to an array.
  19402. *
  19403. * @private
  19404. * @param {Object} iterator The iterator to convert.
  19405. * @returns {Array} Returns the converted array.
  19406. */
  19407. function iteratorToArray(iterator) {
  19408. var data,
  19409. result = [];
  19410. while (!(data = iterator.next()).done) {
  19411. result.push(data.value);
  19412. }
  19413. return result;
  19414. }
  19415. /**
  19416. * Converts `map` to its key-value pairs.
  19417. *
  19418. * @private
  19419. * @param {Object} map The map to convert.
  19420. * @returns {Array} Returns the key-value pairs.
  19421. */
  19422. function mapToArray(map) {
  19423. var index = -1,
  19424. result = Array(map.size);
  19425. map.forEach(function(value, key) {
  19426. result[++index] = [key, value];
  19427. });
  19428. return result;
  19429. }
  19430. /**
  19431. * Creates a unary function that invokes `func` with its argument transformed.
  19432. *
  19433. * @private
  19434. * @param {Function} func The function to wrap.
  19435. * @param {Function} transform The argument transform.
  19436. * @returns {Function} Returns the new function.
  19437. */
  19438. function overArg(func, transform) {
  19439. return function(arg) {
  19440. return func(transform(arg));
  19441. };
  19442. }
  19443. /**
  19444. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19445. * and returns an array of their indexes.
  19446. *
  19447. * @private
  19448. * @param {Array} array The array to modify.
  19449. * @param {*} placeholder The placeholder to replace.
  19450. * @returns {Array} Returns the new array of placeholder indexes.
  19451. */
  19452. function replaceHolders(array, placeholder) {
  19453. var index = -1,
  19454. length = array.length,
  19455. resIndex = 0,
  19456. result = [];
  19457. while (++index < length) {
  19458. var value = array[index];
  19459. if (value === placeholder || value === PLACEHOLDER) {
  19460. array[index] = PLACEHOLDER;
  19461. result[resIndex++] = index;
  19462. }
  19463. }
  19464. return result;
  19465. }
  19466. /**
  19467. * Converts `set` to an array of its values.
  19468. *
  19469. * @private
  19470. * @param {Object} set The set to convert.
  19471. * @returns {Array} Returns the values.
  19472. */
  19473. function setToArray(set) {
  19474. var index = -1,
  19475. result = Array(set.size);
  19476. set.forEach(function(value) {
  19477. result[++index] = value;
  19478. });
  19479. return result;
  19480. }
  19481. /**
  19482. * Converts `set` to its value-value pairs.
  19483. *
  19484. * @private
  19485. * @param {Object} set The set to convert.
  19486. * @returns {Array} Returns the value-value pairs.
  19487. */
  19488. function setToPairs(set) {
  19489. var index = -1,
  19490. result = Array(set.size);
  19491. set.forEach(function(value) {
  19492. result[++index] = [value, value];
  19493. });
  19494. return result;
  19495. }
  19496. /**
  19497. * A specialized version of `_.indexOf` which performs strict equality
  19498. * comparisons of values, i.e. `===`.
  19499. *
  19500. * @private
  19501. * @param {Array} array The array to inspect.
  19502. * @param {*} value The value to search for.
  19503. * @param {number} fromIndex The index to search from.
  19504. * @returns {number} Returns the index of the matched value, else `-1`.
  19505. */
  19506. function strictIndexOf(array, value, fromIndex) {
  19507. var index = fromIndex - 1,
  19508. length = array.length;
  19509. while (++index < length) {
  19510. if (array[index] === value) {
  19511. return index;
  19512. }
  19513. }
  19514. return -1;
  19515. }
  19516. /**
  19517. * A specialized version of `_.lastIndexOf` which performs strict equality
  19518. * comparisons of values, i.e. `===`.
  19519. *
  19520. * @private
  19521. * @param {Array} array The array to inspect.
  19522. * @param {*} value The value to search for.
  19523. * @param {number} fromIndex The index to search from.
  19524. * @returns {number} Returns the index of the matched value, else `-1`.
  19525. */
  19526. function strictLastIndexOf(array, value, fromIndex) {
  19527. var index = fromIndex + 1;
  19528. while (index--) {
  19529. if (array[index] === value) {
  19530. return index;
  19531. }
  19532. }
  19533. return index;
  19534. }
  19535. /**
  19536. * Gets the number of symbols in `string`.
  19537. *
  19538. * @private
  19539. * @param {string} string The string to inspect.
  19540. * @returns {number} Returns the string size.
  19541. */
  19542. function stringSize(string) {
  19543. return hasUnicode(string)
  19544. ? unicodeSize(string)
  19545. : asciiSize(string);
  19546. }
  19547. /**
  19548. * Converts `string` to an array.
  19549. *
  19550. * @private
  19551. * @param {string} string The string to convert.
  19552. * @returns {Array} Returns the converted array.
  19553. */
  19554. function stringToArray(string) {
  19555. return hasUnicode(string)
  19556. ? unicodeToArray(string)
  19557. : asciiToArray(string);
  19558. }
  19559. /**
  19560. * Used by `_.unescape` to convert HTML entities to characters.
  19561. *
  19562. * @private
  19563. * @param {string} chr The matched character to unescape.
  19564. * @returns {string} Returns the unescaped character.
  19565. */
  19566. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19567. /**
  19568. * Gets the size of a Unicode `string`.
  19569. *
  19570. * @private
  19571. * @param {string} string The string inspect.
  19572. * @returns {number} Returns the string size.
  19573. */
  19574. function unicodeSize(string) {
  19575. var result = reUnicode.lastIndex = 0;
  19576. while (reUnicode.test(string)) {
  19577. ++result;
  19578. }
  19579. return result;
  19580. }
  19581. /**
  19582. * Converts a Unicode `string` to an array.
  19583. *
  19584. * @private
  19585. * @param {string} string The string to convert.
  19586. * @returns {Array} Returns the converted array.
  19587. */
  19588. function unicodeToArray(string) {
  19589. return string.match(reUnicode) || [];
  19590. }
  19591. /**
  19592. * Splits a Unicode `string` into an array of its words.
  19593. *
  19594. * @private
  19595. * @param {string} The string to inspect.
  19596. * @returns {Array} Returns the words of `string`.
  19597. */
  19598. function unicodeWords(string) {
  19599. return string.match(reUnicodeWord) || [];
  19600. }
  19601. /*--------------------------------------------------------------------------*/
  19602. /**
  19603. * Create a new pristine `lodash` function using the `context` object.
  19604. *
  19605. * @static
  19606. * @memberOf _
  19607. * @since 1.1.0
  19608. * @category Util
  19609. * @param {Object} [context=root] The context object.
  19610. * @returns {Function} Returns a new `lodash` function.
  19611. * @example
  19612. *
  19613. * _.mixin({ 'foo': _.constant('foo') });
  19614. *
  19615. * var lodash = _.runInContext();
  19616. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19617. *
  19618. * _.isFunction(_.foo);
  19619. * // => true
  19620. * _.isFunction(_.bar);
  19621. * // => false
  19622. *
  19623. * lodash.isFunction(lodash.foo);
  19624. * // => false
  19625. * lodash.isFunction(lodash.bar);
  19626. * // => true
  19627. *
  19628. * // Create a suped-up `defer` in Node.js.
  19629. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19630. */
  19631. var runInContext = (function runInContext(context) {
  19632. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19633. /** Built-in constructor references. */
  19634. var Array = context.Array,
  19635. Date = context.Date,
  19636. Error = context.Error,
  19637. Function = context.Function,
  19638. Math = context.Math,
  19639. Object = context.Object,
  19640. RegExp = context.RegExp,
  19641. String = context.String,
  19642. TypeError = context.TypeError;
  19643. /** Used for built-in method references. */
  19644. var arrayProto = Array.prototype,
  19645. funcProto = Function.prototype,
  19646. objectProto = Object.prototype;
  19647. /** Used to detect overreaching core-js shims. */
  19648. var coreJsData = context['__core-js_shared__'];
  19649. /** Used to resolve the decompiled source of functions. */
  19650. var funcToString = funcProto.toString;
  19651. /** Used to check objects for own properties. */
  19652. var hasOwnProperty = objectProto.hasOwnProperty;
  19653. /** Used to generate unique IDs. */
  19654. var idCounter = 0;
  19655. /** Used to detect methods masquerading as native. */
  19656. var maskSrcKey = (function() {
  19657. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19658. return uid ? ('Symbol(src)_1.' + uid) : '';
  19659. }());
  19660. /**
  19661. * Used to resolve the
  19662. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19663. * of values.
  19664. */
  19665. var nativeObjectToString = objectProto.toString;
  19666. /** Used to infer the `Object` constructor. */
  19667. var objectCtorString = funcToString.call(Object);
  19668. /** Used to restore the original `_` reference in `_.noConflict`. */
  19669. var oldDash = root._;
  19670. /** Used to detect if a method is native. */
  19671. var reIsNative = RegExp('^' +
  19672. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19673. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19674. );
  19675. /** Built-in value references. */
  19676. var Buffer = moduleExports ? context.Buffer : undefined,
  19677. Symbol = context.Symbol,
  19678. Uint8Array = context.Uint8Array,
  19679. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19680. getPrototype = overArg(Object.getPrototypeOf, Object),
  19681. objectCreate = Object.create,
  19682. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19683. splice = arrayProto.splice,
  19684. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19685. symIterator = Symbol ? Symbol.iterator : undefined,
  19686. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19687. var defineProperty = (function() {
  19688. try {
  19689. var func = getNative(Object, 'defineProperty');
  19690. func({}, '', {});
  19691. return func;
  19692. } catch (e) {}
  19693. }());
  19694. /** Mocked built-ins. */
  19695. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19696. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19697. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19698. /* Built-in method references for those with the same name as other `lodash` methods. */
  19699. var nativeCeil = Math.ceil,
  19700. nativeFloor = Math.floor,
  19701. nativeGetSymbols = Object.getOwnPropertySymbols,
  19702. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19703. nativeIsFinite = context.isFinite,
  19704. nativeJoin = arrayProto.join,
  19705. nativeKeys = overArg(Object.keys, Object),
  19706. nativeMax = Math.max,
  19707. nativeMin = Math.min,
  19708. nativeNow = Date.now,
  19709. nativeParseInt = context.parseInt,
  19710. nativeRandom = Math.random,
  19711. nativeReverse = arrayProto.reverse;
  19712. /* Built-in method references that are verified to be native. */
  19713. var DataView = getNative(context, 'DataView'),
  19714. Map = getNative(context, 'Map'),
  19715. Promise = getNative(context, 'Promise'),
  19716. Set = getNative(context, 'Set'),
  19717. WeakMap = getNative(context, 'WeakMap'),
  19718. nativeCreate = getNative(Object, 'create');
  19719. /** Used to store function metadata. */
  19720. var metaMap = WeakMap && new WeakMap;
  19721. /** Used to lookup unminified function names. */
  19722. var realNames = {};
  19723. /** Used to detect maps, sets, and weakmaps. */
  19724. var dataViewCtorString = toSource(DataView),
  19725. mapCtorString = toSource(Map),
  19726. promiseCtorString = toSource(Promise),
  19727. setCtorString = toSource(Set),
  19728. weakMapCtorString = toSource(WeakMap);
  19729. /** Used to convert symbols to primitives and strings. */
  19730. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19731. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19732. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19733. /*------------------------------------------------------------------------*/
  19734. /**
  19735. * Creates a `lodash` object which wraps `value` to enable implicit method
  19736. * chain sequences. Methods that operate on and return arrays, collections,
  19737. * and functions can be chained together. Methods that retrieve a single value
  19738. * or may return a primitive value will automatically end the chain sequence
  19739. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19740. * with `_#value`.
  19741. *
  19742. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19743. * enabled using `_.chain`.
  19744. *
  19745. * The execution of chained methods is lazy, that is, it's deferred until
  19746. * `_#value` is implicitly or explicitly called.
  19747. *
  19748. * Lazy evaluation allows several methods to support shortcut fusion.
  19749. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19750. * the creation of intermediate arrays and can greatly reduce the number of
  19751. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19752. * fusion if the section is applied to an array and iteratees accept only
  19753. * one argument. The heuristic for whether a section qualifies for shortcut
  19754. * fusion is subject to change.
  19755. *
  19756. * Chaining is supported in custom builds as long as the `_#value` method is
  19757. * directly or indirectly included in the build.
  19758. *
  19759. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19760. *
  19761. * The wrapper `Array` methods are:
  19762. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19763. *
  19764. * The wrapper `String` methods are:
  19765. * `replace` and `split`
  19766. *
  19767. * The wrapper methods that support shortcut fusion are:
  19768. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19769. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19770. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19771. *
  19772. * The chainable wrapper methods are:
  19773. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19774. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19775. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19776. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19777. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19778. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19779. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19780. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19781. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19782. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19783. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19784. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19785. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19786. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19787. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19788. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19789. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19790. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19791. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19792. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19793. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19794. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19795. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19796. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19797. *
  19798. * The wrapper methods that are **not** chainable by default are:
  19799. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19800. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19801. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19802. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19803. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19804. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19805. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19806. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19807. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19808. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19809. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19810. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19811. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19812. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19813. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19814. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19815. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19816. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19817. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19818. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19819. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19820. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19821. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19822. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19823. * `upperFirst`, `value`, and `words`
  19824. *
  19825. * @name _
  19826. * @constructor
  19827. * @category Seq
  19828. * @param {*} value The value to wrap in a `lodash` instance.
  19829. * @returns {Object} Returns the new `lodash` wrapper instance.
  19830. * @example
  19831. *
  19832. * function square(n) {
  19833. * return n * n;
  19834. * }
  19835. *
  19836. * var wrapped = _([1, 2, 3]);
  19837. *
  19838. * // Returns an unwrapped value.
  19839. * wrapped.reduce(_.add);
  19840. * // => 6
  19841. *
  19842. * // Returns a wrapped value.
  19843. * var squares = wrapped.map(square);
  19844. *
  19845. * _.isArray(squares);
  19846. * // => false
  19847. *
  19848. * _.isArray(squares.value());
  19849. * // => true
  19850. */
  19851. function lodash(value) {
  19852. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19853. if (value instanceof LodashWrapper) {
  19854. return value;
  19855. }
  19856. if (hasOwnProperty.call(value, '__wrapped__')) {
  19857. return wrapperClone(value);
  19858. }
  19859. }
  19860. return new LodashWrapper(value);
  19861. }
  19862. /**
  19863. * The base implementation of `_.create` without support for assigning
  19864. * properties to the created object.
  19865. *
  19866. * @private
  19867. * @param {Object} proto The object to inherit from.
  19868. * @returns {Object} Returns the new object.
  19869. */
  19870. var baseCreate = (function() {
  19871. function object() {}
  19872. return function(proto) {
  19873. if (!isObject(proto)) {
  19874. return {};
  19875. }
  19876. if (objectCreate) {
  19877. return objectCreate(proto);
  19878. }
  19879. object.prototype = proto;
  19880. var result = new object;
  19881. object.prototype = undefined;
  19882. return result;
  19883. };
  19884. }());
  19885. /**
  19886. * The function whose prototype chain sequence wrappers inherit from.
  19887. *
  19888. * @private
  19889. */
  19890. function baseLodash() {
  19891. // No operation performed.
  19892. }
  19893. /**
  19894. * The base constructor for creating `lodash` wrapper objects.
  19895. *
  19896. * @private
  19897. * @param {*} value The value to wrap.
  19898. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19899. */
  19900. function LodashWrapper(value, chainAll) {
  19901. this.__wrapped__ = value;
  19902. this.__actions__ = [];
  19903. this.__chain__ = !!chainAll;
  19904. this.__index__ = 0;
  19905. this.__values__ = undefined;
  19906. }
  19907. /**
  19908. * By default, the template delimiters used by lodash are like those in
  19909. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19910. * following template settings to use alternative delimiters.
  19911. *
  19912. * @static
  19913. * @memberOf _
  19914. * @type {Object}
  19915. */
  19916. lodash.templateSettings = {
  19917. /**
  19918. * Used to detect `data` property values to be HTML-escaped.
  19919. *
  19920. * @memberOf _.templateSettings
  19921. * @type {RegExp}
  19922. */
  19923. 'escape': reEscape,
  19924. /**
  19925. * Used to detect code to be evaluated.
  19926. *
  19927. * @memberOf _.templateSettings
  19928. * @type {RegExp}
  19929. */
  19930. 'evaluate': reEvaluate,
  19931. /**
  19932. * Used to detect `data` property values to inject.
  19933. *
  19934. * @memberOf _.templateSettings
  19935. * @type {RegExp}
  19936. */
  19937. 'interpolate': reInterpolate,
  19938. /**
  19939. * Used to reference the data object in the template text.
  19940. *
  19941. * @memberOf _.templateSettings
  19942. * @type {string}
  19943. */
  19944. 'variable': '',
  19945. /**
  19946. * Used to import variables into the compiled template.
  19947. *
  19948. * @memberOf _.templateSettings
  19949. * @type {Object}
  19950. */
  19951. 'imports': {
  19952. /**
  19953. * A reference to the `lodash` function.
  19954. *
  19955. * @memberOf _.templateSettings.imports
  19956. * @type {Function}
  19957. */
  19958. '_': lodash
  19959. }
  19960. };
  19961. // Ensure wrappers are instances of `baseLodash`.
  19962. lodash.prototype = baseLodash.prototype;
  19963. lodash.prototype.constructor = lodash;
  19964. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19965. LodashWrapper.prototype.constructor = LodashWrapper;
  19966. /*------------------------------------------------------------------------*/
  19967. /**
  19968. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19969. *
  19970. * @private
  19971. * @constructor
  19972. * @param {*} value The value to wrap.
  19973. */
  19974. function LazyWrapper(value) {
  19975. this.__wrapped__ = value;
  19976. this.__actions__ = [];
  19977. this.__dir__ = 1;
  19978. this.__filtered__ = false;
  19979. this.__iteratees__ = [];
  19980. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19981. this.__views__ = [];
  19982. }
  19983. /**
  19984. * Creates a clone of the lazy wrapper object.
  19985. *
  19986. * @private
  19987. * @name clone
  19988. * @memberOf LazyWrapper
  19989. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19990. */
  19991. function lazyClone() {
  19992. var result = new LazyWrapper(this.__wrapped__);
  19993. result.__actions__ = copyArray(this.__actions__);
  19994. result.__dir__ = this.__dir__;
  19995. result.__filtered__ = this.__filtered__;
  19996. result.__iteratees__ = copyArray(this.__iteratees__);
  19997. result.__takeCount__ = this.__takeCount__;
  19998. result.__views__ = copyArray(this.__views__);
  19999. return result;
  20000. }
  20001. /**
  20002. * Reverses the direction of lazy iteration.
  20003. *
  20004. * @private
  20005. * @name reverse
  20006. * @memberOf LazyWrapper
  20007. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20008. */
  20009. function lazyReverse() {
  20010. if (this.__filtered__) {
  20011. var result = new LazyWrapper(this);
  20012. result.__dir__ = -1;
  20013. result.__filtered__ = true;
  20014. } else {
  20015. result = this.clone();
  20016. result.__dir__ *= -1;
  20017. }
  20018. return result;
  20019. }
  20020. /**
  20021. * Extracts the unwrapped value from its lazy wrapper.
  20022. *
  20023. * @private
  20024. * @name value
  20025. * @memberOf LazyWrapper
  20026. * @returns {*} Returns the unwrapped value.
  20027. */
  20028. function lazyValue() {
  20029. var array = this.__wrapped__.value(),
  20030. dir = this.__dir__,
  20031. isArr = isArray(array),
  20032. isRight = dir < 0,
  20033. arrLength = isArr ? array.length : 0,
  20034. view = getView(0, arrLength, this.__views__),
  20035. start = view.start,
  20036. end = view.end,
  20037. length = end - start,
  20038. index = isRight ? end : (start - 1),
  20039. iteratees = this.__iteratees__,
  20040. iterLength = iteratees.length,
  20041. resIndex = 0,
  20042. takeCount = nativeMin(length, this.__takeCount__);
  20043. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20044. return baseWrapperValue(array, this.__actions__);
  20045. }
  20046. var result = [];
  20047. outer:
  20048. while (length-- && resIndex < takeCount) {
  20049. index += dir;
  20050. var iterIndex = -1,
  20051. value = array[index];
  20052. while (++iterIndex < iterLength) {
  20053. var data = iteratees[iterIndex],
  20054. iteratee = data.iteratee,
  20055. type = data.type,
  20056. computed = iteratee(value);
  20057. if (type == LAZY_MAP_FLAG) {
  20058. value = computed;
  20059. } else if (!computed) {
  20060. if (type == LAZY_FILTER_FLAG) {
  20061. continue outer;
  20062. } else {
  20063. break outer;
  20064. }
  20065. }
  20066. }
  20067. result[resIndex++] = value;
  20068. }
  20069. return result;
  20070. }
  20071. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20072. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20073. LazyWrapper.prototype.constructor = LazyWrapper;
  20074. /*------------------------------------------------------------------------*/
  20075. /**
  20076. * Creates a hash object.
  20077. *
  20078. * @private
  20079. * @constructor
  20080. * @param {Array} [entries] The key-value pairs to cache.
  20081. */
  20082. function Hash(entries) {
  20083. var index = -1,
  20084. length = entries == null ? 0 : entries.length;
  20085. this.clear();
  20086. while (++index < length) {
  20087. var entry = entries[index];
  20088. this.set(entry[0], entry[1]);
  20089. }
  20090. }
  20091. /**
  20092. * Removes all key-value entries from the hash.
  20093. *
  20094. * @private
  20095. * @name clear
  20096. * @memberOf Hash
  20097. */
  20098. function hashClear() {
  20099. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20100. this.size = 0;
  20101. }
  20102. /**
  20103. * Removes `key` and its value from the hash.
  20104. *
  20105. * @private
  20106. * @name delete
  20107. * @memberOf Hash
  20108. * @param {Object} hash The hash to modify.
  20109. * @param {string} key The key of the value to remove.
  20110. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20111. */
  20112. function hashDelete(key) {
  20113. var result = this.has(key) && delete this.__data__[key];
  20114. this.size -= result ? 1 : 0;
  20115. return result;
  20116. }
  20117. /**
  20118. * Gets the hash value for `key`.
  20119. *
  20120. * @private
  20121. * @name get
  20122. * @memberOf Hash
  20123. * @param {string} key The key of the value to get.
  20124. * @returns {*} Returns the entry value.
  20125. */
  20126. function hashGet(key) {
  20127. var data = this.__data__;
  20128. if (nativeCreate) {
  20129. var result = data[key];
  20130. return result === HASH_UNDEFINED ? undefined : result;
  20131. }
  20132. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20133. }
  20134. /**
  20135. * Checks if a hash value for `key` exists.
  20136. *
  20137. * @private
  20138. * @name has
  20139. * @memberOf Hash
  20140. * @param {string} key The key of the entry to check.
  20141. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20142. */
  20143. function hashHas(key) {
  20144. var data = this.__data__;
  20145. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20146. }
  20147. /**
  20148. * Sets the hash `key` to `value`.
  20149. *
  20150. * @private
  20151. * @name set
  20152. * @memberOf Hash
  20153. * @param {string} key The key of the value to set.
  20154. * @param {*} value The value to set.
  20155. * @returns {Object} Returns the hash instance.
  20156. */
  20157. function hashSet(key, value) {
  20158. var data = this.__data__;
  20159. this.size += this.has(key) ? 0 : 1;
  20160. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20161. return this;
  20162. }
  20163. // Add methods to `Hash`.
  20164. Hash.prototype.clear = hashClear;
  20165. Hash.prototype['delete'] = hashDelete;
  20166. Hash.prototype.get = hashGet;
  20167. Hash.prototype.has = hashHas;
  20168. Hash.prototype.set = hashSet;
  20169. /*------------------------------------------------------------------------*/
  20170. /**
  20171. * Creates an list cache object.
  20172. *
  20173. * @private
  20174. * @constructor
  20175. * @param {Array} [entries] The key-value pairs to cache.
  20176. */
  20177. function ListCache(entries) {
  20178. var index = -1,
  20179. length = entries == null ? 0 : entries.length;
  20180. this.clear();
  20181. while (++index < length) {
  20182. var entry = entries[index];
  20183. this.set(entry[0], entry[1]);
  20184. }
  20185. }
  20186. /**
  20187. * Removes all key-value entries from the list cache.
  20188. *
  20189. * @private
  20190. * @name clear
  20191. * @memberOf ListCache
  20192. */
  20193. function listCacheClear() {
  20194. this.__data__ = [];
  20195. this.size = 0;
  20196. }
  20197. /**
  20198. * Removes `key` and its value from the list cache.
  20199. *
  20200. * @private
  20201. * @name delete
  20202. * @memberOf ListCache
  20203. * @param {string} key The key of the value to remove.
  20204. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20205. */
  20206. function listCacheDelete(key) {
  20207. var data = this.__data__,
  20208. index = assocIndexOf(data, key);
  20209. if (index < 0) {
  20210. return false;
  20211. }
  20212. var lastIndex = data.length - 1;
  20213. if (index == lastIndex) {
  20214. data.pop();
  20215. } else {
  20216. splice.call(data, index, 1);
  20217. }
  20218. --this.size;
  20219. return true;
  20220. }
  20221. /**
  20222. * Gets the list cache value for `key`.
  20223. *
  20224. * @private
  20225. * @name get
  20226. * @memberOf ListCache
  20227. * @param {string} key The key of the value to get.
  20228. * @returns {*} Returns the entry value.
  20229. */
  20230. function listCacheGet(key) {
  20231. var data = this.__data__,
  20232. index = assocIndexOf(data, key);
  20233. return index < 0 ? undefined : data[index][1];
  20234. }
  20235. /**
  20236. * Checks if a list cache value for `key` exists.
  20237. *
  20238. * @private
  20239. * @name has
  20240. * @memberOf ListCache
  20241. * @param {string} key The key of the entry to check.
  20242. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20243. */
  20244. function listCacheHas(key) {
  20245. return assocIndexOf(this.__data__, key) > -1;
  20246. }
  20247. /**
  20248. * Sets the list cache `key` to `value`.
  20249. *
  20250. * @private
  20251. * @name set
  20252. * @memberOf ListCache
  20253. * @param {string} key The key of the value to set.
  20254. * @param {*} value The value to set.
  20255. * @returns {Object} Returns the list cache instance.
  20256. */
  20257. function listCacheSet(key, value) {
  20258. var data = this.__data__,
  20259. index = assocIndexOf(data, key);
  20260. if (index < 0) {
  20261. ++this.size;
  20262. data.push([key, value]);
  20263. } else {
  20264. data[index][1] = value;
  20265. }
  20266. return this;
  20267. }
  20268. // Add methods to `ListCache`.
  20269. ListCache.prototype.clear = listCacheClear;
  20270. ListCache.prototype['delete'] = listCacheDelete;
  20271. ListCache.prototype.get = listCacheGet;
  20272. ListCache.prototype.has = listCacheHas;
  20273. ListCache.prototype.set = listCacheSet;
  20274. /*------------------------------------------------------------------------*/
  20275. /**
  20276. * Creates a map cache object to store key-value pairs.
  20277. *
  20278. * @private
  20279. * @constructor
  20280. * @param {Array} [entries] The key-value pairs to cache.
  20281. */
  20282. function MapCache(entries) {
  20283. var index = -1,
  20284. length = entries == null ? 0 : entries.length;
  20285. this.clear();
  20286. while (++index < length) {
  20287. var entry = entries[index];
  20288. this.set(entry[0], entry[1]);
  20289. }
  20290. }
  20291. /**
  20292. * Removes all key-value entries from the map.
  20293. *
  20294. * @private
  20295. * @name clear
  20296. * @memberOf MapCache
  20297. */
  20298. function mapCacheClear() {
  20299. this.size = 0;
  20300. this.__data__ = {
  20301. 'hash': new Hash,
  20302. 'map': new (Map || ListCache),
  20303. 'string': new Hash
  20304. };
  20305. }
  20306. /**
  20307. * Removes `key` and its value from the map.
  20308. *
  20309. * @private
  20310. * @name delete
  20311. * @memberOf MapCache
  20312. * @param {string} key The key of the value to remove.
  20313. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20314. */
  20315. function mapCacheDelete(key) {
  20316. var result = getMapData(this, key)['delete'](key);
  20317. this.size -= result ? 1 : 0;
  20318. return result;
  20319. }
  20320. /**
  20321. * Gets the map value for `key`.
  20322. *
  20323. * @private
  20324. * @name get
  20325. * @memberOf MapCache
  20326. * @param {string} key The key of the value to get.
  20327. * @returns {*} Returns the entry value.
  20328. */
  20329. function mapCacheGet(key) {
  20330. return getMapData(this, key).get(key);
  20331. }
  20332. /**
  20333. * Checks if a map value for `key` exists.
  20334. *
  20335. * @private
  20336. * @name has
  20337. * @memberOf MapCache
  20338. * @param {string} key The key of the entry to check.
  20339. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20340. */
  20341. function mapCacheHas(key) {
  20342. return getMapData(this, key).has(key);
  20343. }
  20344. /**
  20345. * Sets the map `key` to `value`.
  20346. *
  20347. * @private
  20348. * @name set
  20349. * @memberOf MapCache
  20350. * @param {string} key The key of the value to set.
  20351. * @param {*} value The value to set.
  20352. * @returns {Object} Returns the map cache instance.
  20353. */
  20354. function mapCacheSet(key, value) {
  20355. var data = getMapData(this, key),
  20356. size = data.size;
  20357. data.set(key, value);
  20358. this.size += data.size == size ? 0 : 1;
  20359. return this;
  20360. }
  20361. // Add methods to `MapCache`.
  20362. MapCache.prototype.clear = mapCacheClear;
  20363. MapCache.prototype['delete'] = mapCacheDelete;
  20364. MapCache.prototype.get = mapCacheGet;
  20365. MapCache.prototype.has = mapCacheHas;
  20366. MapCache.prototype.set = mapCacheSet;
  20367. /*------------------------------------------------------------------------*/
  20368. /**
  20369. *
  20370. * Creates an array cache object to store unique values.
  20371. *
  20372. * @private
  20373. * @constructor
  20374. * @param {Array} [values] The values to cache.
  20375. */
  20376. function SetCache(values) {
  20377. var index = -1,
  20378. length = values == null ? 0 : values.length;
  20379. this.__data__ = new MapCache;
  20380. while (++index < length) {
  20381. this.add(values[index]);
  20382. }
  20383. }
  20384. /**
  20385. * Adds `value` to the array cache.
  20386. *
  20387. * @private
  20388. * @name add
  20389. * @memberOf SetCache
  20390. * @alias push
  20391. * @param {*} value The value to cache.
  20392. * @returns {Object} Returns the cache instance.
  20393. */
  20394. function setCacheAdd(value) {
  20395. this.__data__.set(value, HASH_UNDEFINED);
  20396. return this;
  20397. }
  20398. /**
  20399. * Checks if `value` is in the array cache.
  20400. *
  20401. * @private
  20402. * @name has
  20403. * @memberOf SetCache
  20404. * @param {*} value The value to search for.
  20405. * @returns {number} Returns `true` if `value` is found, else `false`.
  20406. */
  20407. function setCacheHas(value) {
  20408. return this.__data__.has(value);
  20409. }
  20410. // Add methods to `SetCache`.
  20411. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20412. SetCache.prototype.has = setCacheHas;
  20413. /*------------------------------------------------------------------------*/
  20414. /**
  20415. * Creates a stack cache object to store key-value pairs.
  20416. *
  20417. * @private
  20418. * @constructor
  20419. * @param {Array} [entries] The key-value pairs to cache.
  20420. */
  20421. function Stack(entries) {
  20422. var data = this.__data__ = new ListCache(entries);
  20423. this.size = data.size;
  20424. }
  20425. /**
  20426. * Removes all key-value entries from the stack.
  20427. *
  20428. * @private
  20429. * @name clear
  20430. * @memberOf Stack
  20431. */
  20432. function stackClear() {
  20433. this.__data__ = new ListCache;
  20434. this.size = 0;
  20435. }
  20436. /**
  20437. * Removes `key` and its value from the stack.
  20438. *
  20439. * @private
  20440. * @name delete
  20441. * @memberOf Stack
  20442. * @param {string} key The key of the value to remove.
  20443. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20444. */
  20445. function stackDelete(key) {
  20446. var data = this.__data__,
  20447. result = data['delete'](key);
  20448. this.size = data.size;
  20449. return result;
  20450. }
  20451. /**
  20452. * Gets the stack value for `key`.
  20453. *
  20454. * @private
  20455. * @name get
  20456. * @memberOf Stack
  20457. * @param {string} key The key of the value to get.
  20458. * @returns {*} Returns the entry value.
  20459. */
  20460. function stackGet(key) {
  20461. return this.__data__.get(key);
  20462. }
  20463. /**
  20464. * Checks if a stack value for `key` exists.
  20465. *
  20466. * @private
  20467. * @name has
  20468. * @memberOf Stack
  20469. * @param {string} key The key of the entry to check.
  20470. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20471. */
  20472. function stackHas(key) {
  20473. return this.__data__.has(key);
  20474. }
  20475. /**
  20476. * Sets the stack `key` to `value`.
  20477. *
  20478. * @private
  20479. * @name set
  20480. * @memberOf Stack
  20481. * @param {string} key The key of the value to set.
  20482. * @param {*} value The value to set.
  20483. * @returns {Object} Returns the stack cache instance.
  20484. */
  20485. function stackSet(key, value) {
  20486. var data = this.__data__;
  20487. if (data instanceof ListCache) {
  20488. var pairs = data.__data__;
  20489. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20490. pairs.push([key, value]);
  20491. this.size = ++data.size;
  20492. return this;
  20493. }
  20494. data = this.__data__ = new MapCache(pairs);
  20495. }
  20496. data.set(key, value);
  20497. this.size = data.size;
  20498. return this;
  20499. }
  20500. // Add methods to `Stack`.
  20501. Stack.prototype.clear = stackClear;
  20502. Stack.prototype['delete'] = stackDelete;
  20503. Stack.prototype.get = stackGet;
  20504. Stack.prototype.has = stackHas;
  20505. Stack.prototype.set = stackSet;
  20506. /*------------------------------------------------------------------------*/
  20507. /**
  20508. * Creates an array of the enumerable property names of the array-like `value`.
  20509. *
  20510. * @private
  20511. * @param {*} value The value to query.
  20512. * @param {boolean} inherited Specify returning inherited property names.
  20513. * @returns {Array} Returns the array of property names.
  20514. */
  20515. function arrayLikeKeys(value, inherited) {
  20516. var isArr = isArray(value),
  20517. isArg = !isArr && isArguments(value),
  20518. isBuff = !isArr && !isArg && isBuffer(value),
  20519. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20520. skipIndexes = isArr || isArg || isBuff || isType,
  20521. result = skipIndexes ? baseTimes(value.length, String) : [],
  20522. length = result.length;
  20523. for (var key in value) {
  20524. if ((inherited || hasOwnProperty.call(value, key)) &&
  20525. !(skipIndexes && (
  20526. // Safari 9 has enumerable `arguments.length` in strict mode.
  20527. key == 'length' ||
  20528. // Node.js 0.10 has enumerable non-index properties on buffers.
  20529. (isBuff && (key == 'offset' || key == 'parent')) ||
  20530. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20531. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20532. // Skip index properties.
  20533. isIndex(key, length)
  20534. ))) {
  20535. result.push(key);
  20536. }
  20537. }
  20538. return result;
  20539. }
  20540. /**
  20541. * A specialized version of `_.sample` for arrays.
  20542. *
  20543. * @private
  20544. * @param {Array} array The array to sample.
  20545. * @returns {*} Returns the random element.
  20546. */
  20547. function arraySample(array) {
  20548. var length = array.length;
  20549. return length ? array[baseRandom(0, length - 1)] : undefined;
  20550. }
  20551. /**
  20552. * A specialized version of `_.sampleSize` for arrays.
  20553. *
  20554. * @private
  20555. * @param {Array} array The array to sample.
  20556. * @param {number} n The number of elements to sample.
  20557. * @returns {Array} Returns the random elements.
  20558. */
  20559. function arraySampleSize(array, n) {
  20560. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20561. }
  20562. /**
  20563. * A specialized version of `_.shuffle` for arrays.
  20564. *
  20565. * @private
  20566. * @param {Array} array The array to shuffle.
  20567. * @returns {Array} Returns the new shuffled array.
  20568. */
  20569. function arrayShuffle(array) {
  20570. return shuffleSelf(copyArray(array));
  20571. }
  20572. /**
  20573. * This function is like `assignValue` except that it doesn't assign
  20574. * `undefined` values.
  20575. *
  20576. * @private
  20577. * @param {Object} object The object to modify.
  20578. * @param {string} key The key of the property to assign.
  20579. * @param {*} value The value to assign.
  20580. */
  20581. function assignMergeValue(object, key, value) {
  20582. if ((value !== undefined && !eq(object[key], value)) ||
  20583. (value === undefined && !(key in object))) {
  20584. baseAssignValue(object, key, value);
  20585. }
  20586. }
  20587. /**
  20588. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20589. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20590. * for equality comparisons.
  20591. *
  20592. * @private
  20593. * @param {Object} object The object to modify.
  20594. * @param {string} key The key of the property to assign.
  20595. * @param {*} value The value to assign.
  20596. */
  20597. function assignValue(object, key, value) {
  20598. var objValue = object[key];
  20599. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20600. (value === undefined && !(key in object))) {
  20601. baseAssignValue(object, key, value);
  20602. }
  20603. }
  20604. /**
  20605. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20606. *
  20607. * @private
  20608. * @param {Array} array The array to inspect.
  20609. * @param {*} key The key to search for.
  20610. * @returns {number} Returns the index of the matched value, else `-1`.
  20611. */
  20612. function assocIndexOf(array, key) {
  20613. var length = array.length;
  20614. while (length--) {
  20615. if (eq(array[length][0], key)) {
  20616. return length;
  20617. }
  20618. }
  20619. return -1;
  20620. }
  20621. /**
  20622. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20623. * by `iteratee` and values set by `setter`.
  20624. *
  20625. * @private
  20626. * @param {Array|Object} collection The collection to iterate over.
  20627. * @param {Function} setter The function to set `accumulator` values.
  20628. * @param {Function} iteratee The iteratee to transform keys.
  20629. * @param {Object} accumulator The initial aggregated object.
  20630. * @returns {Function} Returns `accumulator`.
  20631. */
  20632. function baseAggregator(collection, setter, iteratee, accumulator) {
  20633. baseEach(collection, function(value, key, collection) {
  20634. setter(accumulator, value, iteratee(value), collection);
  20635. });
  20636. return accumulator;
  20637. }
  20638. /**
  20639. * The base implementation of `_.assign` without support for multiple sources
  20640. * or `customizer` functions.
  20641. *
  20642. * @private
  20643. * @param {Object} object The destination object.
  20644. * @param {Object} source The source object.
  20645. * @returns {Object} Returns `object`.
  20646. */
  20647. function baseAssign(object, source) {
  20648. return object && copyObject(source, keys(source), object);
  20649. }
  20650. /**
  20651. * The base implementation of `_.assignIn` without support for multiple sources
  20652. * or `customizer` functions.
  20653. *
  20654. * @private
  20655. * @param {Object} object The destination object.
  20656. * @param {Object} source The source object.
  20657. * @returns {Object} Returns `object`.
  20658. */
  20659. function baseAssignIn(object, source) {
  20660. return object && copyObject(source, keysIn(source), object);
  20661. }
  20662. /**
  20663. * The base implementation of `assignValue` and `assignMergeValue` without
  20664. * value checks.
  20665. *
  20666. * @private
  20667. * @param {Object} object The object to modify.
  20668. * @param {string} key The key of the property to assign.
  20669. * @param {*} value The value to assign.
  20670. */
  20671. function baseAssignValue(object, key, value) {
  20672. if (key == '__proto__' && defineProperty) {
  20673. defineProperty(object, key, {
  20674. 'configurable': true,
  20675. 'enumerable': true,
  20676. 'value': value,
  20677. 'writable': true
  20678. });
  20679. } else {
  20680. object[key] = value;
  20681. }
  20682. }
  20683. /**
  20684. * The base implementation of `_.at` without support for individual paths.
  20685. *
  20686. * @private
  20687. * @param {Object} object The object to iterate over.
  20688. * @param {string[]} paths The property paths to pick.
  20689. * @returns {Array} Returns the picked elements.
  20690. */
  20691. function baseAt(object, paths) {
  20692. var index = -1,
  20693. length = paths.length,
  20694. result = Array(length),
  20695. skip = object == null;
  20696. while (++index < length) {
  20697. result[index] = skip ? undefined : get(object, paths[index]);
  20698. }
  20699. return result;
  20700. }
  20701. /**
  20702. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20703. *
  20704. * @private
  20705. * @param {number} number The number to clamp.
  20706. * @param {number} [lower] The lower bound.
  20707. * @param {number} upper The upper bound.
  20708. * @returns {number} Returns the clamped number.
  20709. */
  20710. function baseClamp(number, lower, upper) {
  20711. if (number === number) {
  20712. if (upper !== undefined) {
  20713. number = number <= upper ? number : upper;
  20714. }
  20715. if (lower !== undefined) {
  20716. number = number >= lower ? number : lower;
  20717. }
  20718. }
  20719. return number;
  20720. }
  20721. /**
  20722. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20723. * traversed objects.
  20724. *
  20725. * @private
  20726. * @param {*} value The value to clone.
  20727. * @param {boolean} bitmask The bitmask flags.
  20728. * 1 - Deep clone
  20729. * 2 - Flatten inherited properties
  20730. * 4 - Clone symbols
  20731. * @param {Function} [customizer] The function to customize cloning.
  20732. * @param {string} [key] The key of `value`.
  20733. * @param {Object} [object] The parent object of `value`.
  20734. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20735. * @returns {*} Returns the cloned value.
  20736. */
  20737. function baseClone(value, bitmask, customizer, key, object, stack) {
  20738. var result,
  20739. isDeep = bitmask & CLONE_DEEP_FLAG,
  20740. isFlat = bitmask & CLONE_FLAT_FLAG,
  20741. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20742. if (customizer) {
  20743. result = object ? customizer(value, key, object, stack) : customizer(value);
  20744. }
  20745. if (result !== undefined) {
  20746. return result;
  20747. }
  20748. if (!isObject(value)) {
  20749. return value;
  20750. }
  20751. var isArr = isArray(value);
  20752. if (isArr) {
  20753. result = initCloneArray(value);
  20754. if (!isDeep) {
  20755. return copyArray(value, result);
  20756. }
  20757. } else {
  20758. var tag = getTag(value),
  20759. isFunc = tag == funcTag || tag == genTag;
  20760. if (isBuffer(value)) {
  20761. return cloneBuffer(value, isDeep);
  20762. }
  20763. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20764. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20765. if (!isDeep) {
  20766. return isFlat
  20767. ? copySymbolsIn(value, baseAssignIn(result, value))
  20768. : copySymbols(value, baseAssign(result, value));
  20769. }
  20770. } else {
  20771. if (!cloneableTags[tag]) {
  20772. return object ? value : {};
  20773. }
  20774. result = initCloneByTag(value, tag, isDeep);
  20775. }
  20776. }
  20777. // Check for circular references and return its corresponding clone.
  20778. stack || (stack = new Stack);
  20779. var stacked = stack.get(value);
  20780. if (stacked) {
  20781. return stacked;
  20782. }
  20783. stack.set(value, result);
  20784. if (isSet(value)) {
  20785. value.forEach(function(subValue) {
  20786. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20787. });
  20788. } else if (isMap(value)) {
  20789. value.forEach(function(subValue, key) {
  20790. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20791. });
  20792. }
  20793. var keysFunc = isFull
  20794. ? (isFlat ? getAllKeysIn : getAllKeys)
  20795. : (isFlat ? keysIn : keys);
  20796. var props = isArr ? undefined : keysFunc(value);
  20797. arrayEach(props || value, function(subValue, key) {
  20798. if (props) {
  20799. key = subValue;
  20800. subValue = value[key];
  20801. }
  20802. // Recursively populate clone (susceptible to call stack limits).
  20803. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20804. });
  20805. return result;
  20806. }
  20807. /**
  20808. * The base implementation of `_.conforms` which doesn't clone `source`.
  20809. *
  20810. * @private
  20811. * @param {Object} source The object of property predicates to conform to.
  20812. * @returns {Function} Returns the new spec function.
  20813. */
  20814. function baseConforms(source) {
  20815. var props = keys(source);
  20816. return function(object) {
  20817. return baseConformsTo(object, source, props);
  20818. };
  20819. }
  20820. /**
  20821. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20822. *
  20823. * @private
  20824. * @param {Object} object The object to inspect.
  20825. * @param {Object} source The object of property predicates to conform to.
  20826. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20827. */
  20828. function baseConformsTo(object, source, props) {
  20829. var length = props.length;
  20830. if (object == null) {
  20831. return !length;
  20832. }
  20833. object = Object(object);
  20834. while (length--) {
  20835. var key = props[length],
  20836. predicate = source[key],
  20837. value = object[key];
  20838. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20839. return false;
  20840. }
  20841. }
  20842. return true;
  20843. }
  20844. /**
  20845. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20846. * to provide to `func`.
  20847. *
  20848. * @private
  20849. * @param {Function} func The function to delay.
  20850. * @param {number} wait The number of milliseconds to delay invocation.
  20851. * @param {Array} args The arguments to provide to `func`.
  20852. * @returns {number|Object} Returns the timer id or timeout object.
  20853. */
  20854. function baseDelay(func, wait, args) {
  20855. if (typeof func != 'function') {
  20856. throw new TypeError(FUNC_ERROR_TEXT);
  20857. }
  20858. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20859. }
  20860. /**
  20861. * The base implementation of methods like `_.difference` without support
  20862. * for excluding multiple arrays or iteratee shorthands.
  20863. *
  20864. * @private
  20865. * @param {Array} array The array to inspect.
  20866. * @param {Array} values The values to exclude.
  20867. * @param {Function} [iteratee] The iteratee invoked per element.
  20868. * @param {Function} [comparator] The comparator invoked per element.
  20869. * @returns {Array} Returns the new array of filtered values.
  20870. */
  20871. function baseDifference(array, values, iteratee, comparator) {
  20872. var index = -1,
  20873. includes = arrayIncludes,
  20874. isCommon = true,
  20875. length = array.length,
  20876. result = [],
  20877. valuesLength = values.length;
  20878. if (!length) {
  20879. return result;
  20880. }
  20881. if (iteratee) {
  20882. values = arrayMap(values, baseUnary(iteratee));
  20883. }
  20884. if (comparator) {
  20885. includes = arrayIncludesWith;
  20886. isCommon = false;
  20887. }
  20888. else if (values.length >= LARGE_ARRAY_SIZE) {
  20889. includes = cacheHas;
  20890. isCommon = false;
  20891. values = new SetCache(values);
  20892. }
  20893. outer:
  20894. while (++index < length) {
  20895. var value = array[index],
  20896. computed = iteratee == null ? value : iteratee(value);
  20897. value = (comparator || value !== 0) ? value : 0;
  20898. if (isCommon && computed === computed) {
  20899. var valuesIndex = valuesLength;
  20900. while (valuesIndex--) {
  20901. if (values[valuesIndex] === computed) {
  20902. continue outer;
  20903. }
  20904. }
  20905. result.push(value);
  20906. }
  20907. else if (!includes(values, computed, comparator)) {
  20908. result.push(value);
  20909. }
  20910. }
  20911. return result;
  20912. }
  20913. /**
  20914. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20915. *
  20916. * @private
  20917. * @param {Array|Object} collection The collection to iterate over.
  20918. * @param {Function} iteratee The function invoked per iteration.
  20919. * @returns {Array|Object} Returns `collection`.
  20920. */
  20921. var baseEach = createBaseEach(baseForOwn);
  20922. /**
  20923. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20924. *
  20925. * @private
  20926. * @param {Array|Object} collection The collection to iterate over.
  20927. * @param {Function} iteratee The function invoked per iteration.
  20928. * @returns {Array|Object} Returns `collection`.
  20929. */
  20930. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20931. /**
  20932. * The base implementation of `_.every` without support for iteratee shorthands.
  20933. *
  20934. * @private
  20935. * @param {Array|Object} collection The collection to iterate over.
  20936. * @param {Function} predicate The function invoked per iteration.
  20937. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20938. * else `false`
  20939. */
  20940. function baseEvery(collection, predicate) {
  20941. var result = true;
  20942. baseEach(collection, function(value, index, collection) {
  20943. result = !!predicate(value, index, collection);
  20944. return result;
  20945. });
  20946. return result;
  20947. }
  20948. /**
  20949. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20950. * `comparator` to determine the extremum value.
  20951. *
  20952. * @private
  20953. * @param {Array} array The array to iterate over.
  20954. * @param {Function} iteratee The iteratee invoked per iteration.
  20955. * @param {Function} comparator The comparator used to compare values.
  20956. * @returns {*} Returns the extremum value.
  20957. */
  20958. function baseExtremum(array, iteratee, comparator) {
  20959. var index = -1,
  20960. length = array.length;
  20961. while (++index < length) {
  20962. var value = array[index],
  20963. current = iteratee(value);
  20964. if (current != null && (computed === undefined
  20965. ? (current === current && !isSymbol(current))
  20966. : comparator(current, computed)
  20967. )) {
  20968. var computed = current,
  20969. result = value;
  20970. }
  20971. }
  20972. return result;
  20973. }
  20974. /**
  20975. * The base implementation of `_.fill` without an iteratee call guard.
  20976. *
  20977. * @private
  20978. * @param {Array} array The array to fill.
  20979. * @param {*} value The value to fill `array` with.
  20980. * @param {number} [start=0] The start position.
  20981. * @param {number} [end=array.length] The end position.
  20982. * @returns {Array} Returns `array`.
  20983. */
  20984. function baseFill(array, value, start, end) {
  20985. var length = array.length;
  20986. start = toInteger(start);
  20987. if (start < 0) {
  20988. start = -start > length ? 0 : (length + start);
  20989. }
  20990. end = (end === undefined || end > length) ? length : toInteger(end);
  20991. if (end < 0) {
  20992. end += length;
  20993. }
  20994. end = start > end ? 0 : toLength(end);
  20995. while (start < end) {
  20996. array[start++] = value;
  20997. }
  20998. return array;
  20999. }
  21000. /**
  21001. * The base implementation of `_.filter` without support for iteratee shorthands.
  21002. *
  21003. * @private
  21004. * @param {Array|Object} collection The collection to iterate over.
  21005. * @param {Function} predicate The function invoked per iteration.
  21006. * @returns {Array} Returns the new filtered array.
  21007. */
  21008. function baseFilter(collection, predicate) {
  21009. var result = [];
  21010. baseEach(collection, function(value, index, collection) {
  21011. if (predicate(value, index, collection)) {
  21012. result.push(value);
  21013. }
  21014. });
  21015. return result;
  21016. }
  21017. /**
  21018. * The base implementation of `_.flatten` with support for restricting flattening.
  21019. *
  21020. * @private
  21021. * @param {Array} array The array to flatten.
  21022. * @param {number} depth The maximum recursion depth.
  21023. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21024. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21025. * @param {Array} [result=[]] The initial result value.
  21026. * @returns {Array} Returns the new flattened array.
  21027. */
  21028. function baseFlatten(array, depth, predicate, isStrict, result) {
  21029. var index = -1,
  21030. length = array.length;
  21031. predicate || (predicate = isFlattenable);
  21032. result || (result = []);
  21033. while (++index < length) {
  21034. var value = array[index];
  21035. if (depth > 0 && predicate(value)) {
  21036. if (depth > 1) {
  21037. // Recursively flatten arrays (susceptible to call stack limits).
  21038. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21039. } else {
  21040. arrayPush(result, value);
  21041. }
  21042. } else if (!isStrict) {
  21043. result[result.length] = value;
  21044. }
  21045. }
  21046. return result;
  21047. }
  21048. /**
  21049. * The base implementation of `baseForOwn` which iterates over `object`
  21050. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21051. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21052. *
  21053. * @private
  21054. * @param {Object} object The object to iterate over.
  21055. * @param {Function} iteratee The function invoked per iteration.
  21056. * @param {Function} keysFunc The function to get the keys of `object`.
  21057. * @returns {Object} Returns `object`.
  21058. */
  21059. var baseFor = createBaseFor();
  21060. /**
  21061. * This function is like `baseFor` except that it iterates over properties
  21062. * in the opposite order.
  21063. *
  21064. * @private
  21065. * @param {Object} object The object to iterate over.
  21066. * @param {Function} iteratee The function invoked per iteration.
  21067. * @param {Function} keysFunc The function to get the keys of `object`.
  21068. * @returns {Object} Returns `object`.
  21069. */
  21070. var baseForRight = createBaseFor(true);
  21071. /**
  21072. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21073. *
  21074. * @private
  21075. * @param {Object} object The object to iterate over.
  21076. * @param {Function} iteratee The function invoked per iteration.
  21077. * @returns {Object} Returns `object`.
  21078. */
  21079. function baseForOwn(object, iteratee) {
  21080. return object && baseFor(object, iteratee, keys);
  21081. }
  21082. /**
  21083. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21084. *
  21085. * @private
  21086. * @param {Object} object The object to iterate over.
  21087. * @param {Function} iteratee The function invoked per iteration.
  21088. * @returns {Object} Returns `object`.
  21089. */
  21090. function baseForOwnRight(object, iteratee) {
  21091. return object && baseForRight(object, iteratee, keys);
  21092. }
  21093. /**
  21094. * The base implementation of `_.functions` which creates an array of
  21095. * `object` function property names filtered from `props`.
  21096. *
  21097. * @private
  21098. * @param {Object} object The object to inspect.
  21099. * @param {Array} props The property names to filter.
  21100. * @returns {Array} Returns the function names.
  21101. */
  21102. function baseFunctions(object, props) {
  21103. return arrayFilter(props, function(key) {
  21104. return isFunction(object[key]);
  21105. });
  21106. }
  21107. /**
  21108. * The base implementation of `_.get` without support for default values.
  21109. *
  21110. * @private
  21111. * @param {Object} object The object to query.
  21112. * @param {Array|string} path The path of the property to get.
  21113. * @returns {*} Returns the resolved value.
  21114. */
  21115. function baseGet(object, path) {
  21116. path = castPath(path, object);
  21117. var index = 0,
  21118. length = path.length;
  21119. while (object != null && index < length) {
  21120. object = object[toKey(path[index++])];
  21121. }
  21122. return (index && index == length) ? object : undefined;
  21123. }
  21124. /**
  21125. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21126. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21127. * symbols of `object`.
  21128. *
  21129. * @private
  21130. * @param {Object} object The object to query.
  21131. * @param {Function} keysFunc The function to get the keys of `object`.
  21132. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21133. * @returns {Array} Returns the array of property names and symbols.
  21134. */
  21135. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21136. var result = keysFunc(object);
  21137. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21138. }
  21139. /**
  21140. * The base implementation of `getTag` without fallbacks for buggy environments.
  21141. *
  21142. * @private
  21143. * @param {*} value The value to query.
  21144. * @returns {string} Returns the `toStringTag`.
  21145. */
  21146. function baseGetTag(value) {
  21147. if (value == null) {
  21148. return value === undefined ? undefinedTag : nullTag;
  21149. }
  21150. return (symToStringTag && symToStringTag in Object(value))
  21151. ? getRawTag(value)
  21152. : objectToString(value);
  21153. }
  21154. /**
  21155. * The base implementation of `_.gt` which doesn't coerce arguments.
  21156. *
  21157. * @private
  21158. * @param {*} value The value to compare.
  21159. * @param {*} other The other value to compare.
  21160. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21161. * else `false`.
  21162. */
  21163. function baseGt(value, other) {
  21164. return value > other;
  21165. }
  21166. /**
  21167. * The base implementation of `_.has` without support for deep paths.
  21168. *
  21169. * @private
  21170. * @param {Object} [object] The object to query.
  21171. * @param {Array|string} key The key to check.
  21172. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21173. */
  21174. function baseHas(object, key) {
  21175. return object != null && hasOwnProperty.call(object, key);
  21176. }
  21177. /**
  21178. * The base implementation of `_.hasIn` without support for deep paths.
  21179. *
  21180. * @private
  21181. * @param {Object} [object] The object to query.
  21182. * @param {Array|string} key The key to check.
  21183. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21184. */
  21185. function baseHasIn(object, key) {
  21186. return object != null && key in Object(object);
  21187. }
  21188. /**
  21189. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21190. *
  21191. * @private
  21192. * @param {number} number The number to check.
  21193. * @param {number} start The start of the range.
  21194. * @param {number} end The end of the range.
  21195. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21196. */
  21197. function baseInRange(number, start, end) {
  21198. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21199. }
  21200. /**
  21201. * The base implementation of methods like `_.intersection`, without support
  21202. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21203. *
  21204. * @private
  21205. * @param {Array} arrays The arrays to inspect.
  21206. * @param {Function} [iteratee] The iteratee invoked per element.
  21207. * @param {Function} [comparator] The comparator invoked per element.
  21208. * @returns {Array} Returns the new array of shared values.
  21209. */
  21210. function baseIntersection(arrays, iteratee, comparator) {
  21211. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21212. length = arrays[0].length,
  21213. othLength = arrays.length,
  21214. othIndex = othLength,
  21215. caches = Array(othLength),
  21216. maxLength = Infinity,
  21217. result = [];
  21218. while (othIndex--) {
  21219. var array = arrays[othIndex];
  21220. if (othIndex && iteratee) {
  21221. array = arrayMap(array, baseUnary(iteratee));
  21222. }
  21223. maxLength = nativeMin(array.length, maxLength);
  21224. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21225. ? new SetCache(othIndex && array)
  21226. : undefined;
  21227. }
  21228. array = arrays[0];
  21229. var index = -1,
  21230. seen = caches[0];
  21231. outer:
  21232. while (++index < length && result.length < maxLength) {
  21233. var value = array[index],
  21234. computed = iteratee ? iteratee(value) : value;
  21235. value = (comparator || value !== 0) ? value : 0;
  21236. if (!(seen
  21237. ? cacheHas(seen, computed)
  21238. : includes(result, computed, comparator)
  21239. )) {
  21240. othIndex = othLength;
  21241. while (--othIndex) {
  21242. var cache = caches[othIndex];
  21243. if (!(cache
  21244. ? cacheHas(cache, computed)
  21245. : includes(arrays[othIndex], computed, comparator))
  21246. ) {
  21247. continue outer;
  21248. }
  21249. }
  21250. if (seen) {
  21251. seen.push(computed);
  21252. }
  21253. result.push(value);
  21254. }
  21255. }
  21256. return result;
  21257. }
  21258. /**
  21259. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21260. * `object` with values transformed by `iteratee` and set by `setter`.
  21261. *
  21262. * @private
  21263. * @param {Object} object The object to iterate over.
  21264. * @param {Function} setter The function to set `accumulator` values.
  21265. * @param {Function} iteratee The iteratee to transform values.
  21266. * @param {Object} accumulator The initial inverted object.
  21267. * @returns {Function} Returns `accumulator`.
  21268. */
  21269. function baseInverter(object, setter, iteratee, accumulator) {
  21270. baseForOwn(object, function(value, key, object) {
  21271. setter(accumulator, iteratee(value), key, object);
  21272. });
  21273. return accumulator;
  21274. }
  21275. /**
  21276. * The base implementation of `_.invoke` without support for individual
  21277. * method arguments.
  21278. *
  21279. * @private
  21280. * @param {Object} object The object to query.
  21281. * @param {Array|string} path The path of the method to invoke.
  21282. * @param {Array} args The arguments to invoke the method with.
  21283. * @returns {*} Returns the result of the invoked method.
  21284. */
  21285. function baseInvoke(object, path, args) {
  21286. path = castPath(path, object);
  21287. object = parent(object, path);
  21288. var func = object == null ? object : object[toKey(last(path))];
  21289. return func == null ? undefined : apply(func, object, args);
  21290. }
  21291. /**
  21292. * The base implementation of `_.isArguments`.
  21293. *
  21294. * @private
  21295. * @param {*} value The value to check.
  21296. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21297. */
  21298. function baseIsArguments(value) {
  21299. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21300. }
  21301. /**
  21302. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21303. *
  21304. * @private
  21305. * @param {*} value The value to check.
  21306. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21307. */
  21308. function baseIsArrayBuffer(value) {
  21309. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21310. }
  21311. /**
  21312. * The base implementation of `_.isDate` without Node.js optimizations.
  21313. *
  21314. * @private
  21315. * @param {*} value The value to check.
  21316. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21317. */
  21318. function baseIsDate(value) {
  21319. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21320. }
  21321. /**
  21322. * The base implementation of `_.isEqual` which supports partial comparisons
  21323. * and tracks traversed objects.
  21324. *
  21325. * @private
  21326. * @param {*} value The value to compare.
  21327. * @param {*} other The other value to compare.
  21328. * @param {boolean} bitmask The bitmask flags.
  21329. * 1 - Unordered comparison
  21330. * 2 - Partial comparison
  21331. * @param {Function} [customizer] The function to customize comparisons.
  21332. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21333. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21334. */
  21335. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21336. if (value === other) {
  21337. return true;
  21338. }
  21339. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21340. return value !== value && other !== other;
  21341. }
  21342. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21343. }
  21344. /**
  21345. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21346. * deep comparisons and tracks traversed objects enabling objects with circular
  21347. * references to be compared.
  21348. *
  21349. * @private
  21350. * @param {Object} object The object to compare.
  21351. * @param {Object} other The other object to compare.
  21352. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21353. * @param {Function} customizer The function to customize comparisons.
  21354. * @param {Function} equalFunc The function to determine equivalents of values.
  21355. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21356. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21357. */
  21358. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21359. var objIsArr = isArray(object),
  21360. othIsArr = isArray(other),
  21361. objTag = objIsArr ? arrayTag : getTag(object),
  21362. othTag = othIsArr ? arrayTag : getTag(other);
  21363. objTag = objTag == argsTag ? objectTag : objTag;
  21364. othTag = othTag == argsTag ? objectTag : othTag;
  21365. var objIsObj = objTag == objectTag,
  21366. othIsObj = othTag == objectTag,
  21367. isSameTag = objTag == othTag;
  21368. if (isSameTag && isBuffer(object)) {
  21369. if (!isBuffer(other)) {
  21370. return false;
  21371. }
  21372. objIsArr = true;
  21373. objIsObj = false;
  21374. }
  21375. if (isSameTag && !objIsObj) {
  21376. stack || (stack = new Stack);
  21377. return (objIsArr || isTypedArray(object))
  21378. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21379. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21380. }
  21381. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21382. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21383. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21384. if (objIsWrapped || othIsWrapped) {
  21385. var objUnwrapped = objIsWrapped ? object.value() : object,
  21386. othUnwrapped = othIsWrapped ? other.value() : other;
  21387. stack || (stack = new Stack);
  21388. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21389. }
  21390. }
  21391. if (!isSameTag) {
  21392. return false;
  21393. }
  21394. stack || (stack = new Stack);
  21395. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21396. }
  21397. /**
  21398. * The base implementation of `_.isMap` without Node.js optimizations.
  21399. *
  21400. * @private
  21401. * @param {*} value The value to check.
  21402. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21403. */
  21404. function baseIsMap(value) {
  21405. return isObjectLike(value) && getTag(value) == mapTag;
  21406. }
  21407. /**
  21408. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21409. *
  21410. * @private
  21411. * @param {Object} object The object to inspect.
  21412. * @param {Object} source The object of property values to match.
  21413. * @param {Array} matchData The property names, values, and compare flags to match.
  21414. * @param {Function} [customizer] The function to customize comparisons.
  21415. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21416. */
  21417. function baseIsMatch(object, source, matchData, customizer) {
  21418. var index = matchData.length,
  21419. length = index,
  21420. noCustomizer = !customizer;
  21421. if (object == null) {
  21422. return !length;
  21423. }
  21424. object = Object(object);
  21425. while (index--) {
  21426. var data = matchData[index];
  21427. if ((noCustomizer && data[2])
  21428. ? data[1] !== object[data[0]]
  21429. : !(data[0] in object)
  21430. ) {
  21431. return false;
  21432. }
  21433. }
  21434. while (++index < length) {
  21435. data = matchData[index];
  21436. var key = data[0],
  21437. objValue = object[key],
  21438. srcValue = data[1];
  21439. if (noCustomizer && data[2]) {
  21440. if (objValue === undefined && !(key in object)) {
  21441. return false;
  21442. }
  21443. } else {
  21444. var stack = new Stack;
  21445. if (customizer) {
  21446. var result = customizer(objValue, srcValue, key, object, source, stack);
  21447. }
  21448. if (!(result === undefined
  21449. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21450. : result
  21451. )) {
  21452. return false;
  21453. }
  21454. }
  21455. }
  21456. return true;
  21457. }
  21458. /**
  21459. * The base implementation of `_.isNative` without bad shim checks.
  21460. *
  21461. * @private
  21462. * @param {*} value The value to check.
  21463. * @returns {boolean} Returns `true` if `value` is a native function,
  21464. * else `false`.
  21465. */
  21466. function baseIsNative(value) {
  21467. if (!isObject(value) || isMasked(value)) {
  21468. return false;
  21469. }
  21470. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21471. return pattern.test(toSource(value));
  21472. }
  21473. /**
  21474. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21475. *
  21476. * @private
  21477. * @param {*} value The value to check.
  21478. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21479. */
  21480. function baseIsRegExp(value) {
  21481. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21482. }
  21483. /**
  21484. * The base implementation of `_.isSet` without Node.js optimizations.
  21485. *
  21486. * @private
  21487. * @param {*} value The value to check.
  21488. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21489. */
  21490. function baseIsSet(value) {
  21491. return isObjectLike(value) && getTag(value) == setTag;
  21492. }
  21493. /**
  21494. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21495. *
  21496. * @private
  21497. * @param {*} value The value to check.
  21498. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21499. */
  21500. function baseIsTypedArray(value) {
  21501. return isObjectLike(value) &&
  21502. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21503. }
  21504. /**
  21505. * The base implementation of `_.iteratee`.
  21506. *
  21507. * @private
  21508. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21509. * @returns {Function} Returns the iteratee.
  21510. */
  21511. function baseIteratee(value) {
  21512. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21513. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21514. if (typeof value == 'function') {
  21515. return value;
  21516. }
  21517. if (value == null) {
  21518. return identity;
  21519. }
  21520. if (typeof value == 'object') {
  21521. return isArray(value)
  21522. ? baseMatchesProperty(value[0], value[1])
  21523. : baseMatches(value);
  21524. }
  21525. return property(value);
  21526. }
  21527. /**
  21528. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21529. *
  21530. * @private
  21531. * @param {Object} object The object to query.
  21532. * @returns {Array} Returns the array of property names.
  21533. */
  21534. function baseKeys(object) {
  21535. if (!isPrototype(object)) {
  21536. return nativeKeys(object);
  21537. }
  21538. var result = [];
  21539. for (var key in Object(object)) {
  21540. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21541. result.push(key);
  21542. }
  21543. }
  21544. return result;
  21545. }
  21546. /**
  21547. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21548. *
  21549. * @private
  21550. * @param {Object} object The object to query.
  21551. * @returns {Array} Returns the array of property names.
  21552. */
  21553. function baseKeysIn(object) {
  21554. if (!isObject(object)) {
  21555. return nativeKeysIn(object);
  21556. }
  21557. var isProto = isPrototype(object),
  21558. result = [];
  21559. for (var key in object) {
  21560. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21561. result.push(key);
  21562. }
  21563. }
  21564. return result;
  21565. }
  21566. /**
  21567. * The base implementation of `_.lt` which doesn't coerce arguments.
  21568. *
  21569. * @private
  21570. * @param {*} value The value to compare.
  21571. * @param {*} other The other value to compare.
  21572. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21573. * else `false`.
  21574. */
  21575. function baseLt(value, other) {
  21576. return value < other;
  21577. }
  21578. /**
  21579. * The base implementation of `_.map` without support for iteratee shorthands.
  21580. *
  21581. * @private
  21582. * @param {Array|Object} collection The collection to iterate over.
  21583. * @param {Function} iteratee The function invoked per iteration.
  21584. * @returns {Array} Returns the new mapped array.
  21585. */
  21586. function baseMap(collection, iteratee) {
  21587. var index = -1,
  21588. result = isArrayLike(collection) ? Array(collection.length) : [];
  21589. baseEach(collection, function(value, key, collection) {
  21590. result[++index] = iteratee(value, key, collection);
  21591. });
  21592. return result;
  21593. }
  21594. /**
  21595. * The base implementation of `_.matches` which doesn't clone `source`.
  21596. *
  21597. * @private
  21598. * @param {Object} source The object of property values to match.
  21599. * @returns {Function} Returns the new spec function.
  21600. */
  21601. function baseMatches(source) {
  21602. var matchData = getMatchData(source);
  21603. if (matchData.length == 1 && matchData[0][2]) {
  21604. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21605. }
  21606. return function(object) {
  21607. return object === source || baseIsMatch(object, source, matchData);
  21608. };
  21609. }
  21610. /**
  21611. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21612. *
  21613. * @private
  21614. * @param {string} path The path of the property to get.
  21615. * @param {*} srcValue The value to match.
  21616. * @returns {Function} Returns the new spec function.
  21617. */
  21618. function baseMatchesProperty(path, srcValue) {
  21619. if (isKey(path) && isStrictComparable(srcValue)) {
  21620. return matchesStrictComparable(toKey(path), srcValue);
  21621. }
  21622. return function(object) {
  21623. var objValue = get(object, path);
  21624. return (objValue === undefined && objValue === srcValue)
  21625. ? hasIn(object, path)
  21626. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21627. };
  21628. }
  21629. /**
  21630. * The base implementation of `_.merge` without support for multiple sources.
  21631. *
  21632. * @private
  21633. * @param {Object} object The destination object.
  21634. * @param {Object} source The source object.
  21635. * @param {number} srcIndex The index of `source`.
  21636. * @param {Function} [customizer] The function to customize merged values.
  21637. * @param {Object} [stack] Tracks traversed source values and their merged
  21638. * counterparts.
  21639. */
  21640. function baseMerge(object, source, srcIndex, customizer, stack) {
  21641. if (object === source) {
  21642. return;
  21643. }
  21644. baseFor(source, function(srcValue, key) {
  21645. stack || (stack = new Stack);
  21646. if (isObject(srcValue)) {
  21647. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21648. }
  21649. else {
  21650. var newValue = customizer
  21651. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21652. : undefined;
  21653. if (newValue === undefined) {
  21654. newValue = srcValue;
  21655. }
  21656. assignMergeValue(object, key, newValue);
  21657. }
  21658. }, keysIn);
  21659. }
  21660. /**
  21661. * A specialized version of `baseMerge` for arrays and objects which performs
  21662. * deep merges and tracks traversed objects enabling objects with circular
  21663. * references to be merged.
  21664. *
  21665. * @private
  21666. * @param {Object} object The destination object.
  21667. * @param {Object} source The source object.
  21668. * @param {string} key The key of the value to merge.
  21669. * @param {number} srcIndex The index of `source`.
  21670. * @param {Function} mergeFunc The function to merge values.
  21671. * @param {Function} [customizer] The function to customize assigned values.
  21672. * @param {Object} [stack] Tracks traversed source values and their merged
  21673. * counterparts.
  21674. */
  21675. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21676. var objValue = safeGet(object, key),
  21677. srcValue = safeGet(source, key),
  21678. stacked = stack.get(srcValue);
  21679. if (stacked) {
  21680. assignMergeValue(object, key, stacked);
  21681. return;
  21682. }
  21683. var newValue = customizer
  21684. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21685. : undefined;
  21686. var isCommon = newValue === undefined;
  21687. if (isCommon) {
  21688. var isArr = isArray(srcValue),
  21689. isBuff = !isArr && isBuffer(srcValue),
  21690. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21691. newValue = srcValue;
  21692. if (isArr || isBuff || isTyped) {
  21693. if (isArray(objValue)) {
  21694. newValue = objValue;
  21695. }
  21696. else if (isArrayLikeObject(objValue)) {
  21697. newValue = copyArray(objValue);
  21698. }
  21699. else if (isBuff) {
  21700. isCommon = false;
  21701. newValue = cloneBuffer(srcValue, true);
  21702. }
  21703. else if (isTyped) {
  21704. isCommon = false;
  21705. newValue = cloneTypedArray(srcValue, true);
  21706. }
  21707. else {
  21708. newValue = [];
  21709. }
  21710. }
  21711. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21712. newValue = objValue;
  21713. if (isArguments(objValue)) {
  21714. newValue = toPlainObject(objValue);
  21715. }
  21716. else if (!isObject(objValue) || isFunction(objValue)) {
  21717. newValue = initCloneObject(srcValue);
  21718. }
  21719. }
  21720. else {
  21721. isCommon = false;
  21722. }
  21723. }
  21724. if (isCommon) {
  21725. // Recursively merge objects and arrays (susceptible to call stack limits).
  21726. stack.set(srcValue, newValue);
  21727. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21728. stack['delete'](srcValue);
  21729. }
  21730. assignMergeValue(object, key, newValue);
  21731. }
  21732. /**
  21733. * The base implementation of `_.nth` which doesn't coerce arguments.
  21734. *
  21735. * @private
  21736. * @param {Array} array The array to query.
  21737. * @param {number} n The index of the element to return.
  21738. * @returns {*} Returns the nth element of `array`.
  21739. */
  21740. function baseNth(array, n) {
  21741. var length = array.length;
  21742. if (!length) {
  21743. return;
  21744. }
  21745. n += n < 0 ? length : 0;
  21746. return isIndex(n, length) ? array[n] : undefined;
  21747. }
  21748. /**
  21749. * The base implementation of `_.orderBy` without param guards.
  21750. *
  21751. * @private
  21752. * @param {Array|Object} collection The collection to iterate over.
  21753. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21754. * @param {string[]} orders The sort orders of `iteratees`.
  21755. * @returns {Array} Returns the new sorted array.
  21756. */
  21757. function baseOrderBy(collection, iteratees, orders) {
  21758. var index = -1;
  21759. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21760. var result = baseMap(collection, function(value, key, collection) {
  21761. var criteria = arrayMap(iteratees, function(iteratee) {
  21762. return iteratee(value);
  21763. });
  21764. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21765. });
  21766. return baseSortBy(result, function(object, other) {
  21767. return compareMultiple(object, other, orders);
  21768. });
  21769. }
  21770. /**
  21771. * The base implementation of `_.pick` without support for individual
  21772. * property identifiers.
  21773. *
  21774. * @private
  21775. * @param {Object} object The source object.
  21776. * @param {string[]} paths The property paths to pick.
  21777. * @returns {Object} Returns the new object.
  21778. */
  21779. function basePick(object, paths) {
  21780. return basePickBy(object, paths, function(value, path) {
  21781. return hasIn(object, path);
  21782. });
  21783. }
  21784. /**
  21785. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21786. *
  21787. * @private
  21788. * @param {Object} object The source object.
  21789. * @param {string[]} paths The property paths to pick.
  21790. * @param {Function} predicate The function invoked per property.
  21791. * @returns {Object} Returns the new object.
  21792. */
  21793. function basePickBy(object, paths, predicate) {
  21794. var index = -1,
  21795. length = paths.length,
  21796. result = {};
  21797. while (++index < length) {
  21798. var path = paths[index],
  21799. value = baseGet(object, path);
  21800. if (predicate(value, path)) {
  21801. baseSet(result, castPath(path, object), value);
  21802. }
  21803. }
  21804. return result;
  21805. }
  21806. /**
  21807. * A specialized version of `baseProperty` which supports deep paths.
  21808. *
  21809. * @private
  21810. * @param {Array|string} path The path of the property to get.
  21811. * @returns {Function} Returns the new accessor function.
  21812. */
  21813. function basePropertyDeep(path) {
  21814. return function(object) {
  21815. return baseGet(object, path);
  21816. };
  21817. }
  21818. /**
  21819. * The base implementation of `_.pullAllBy` without support for iteratee
  21820. * shorthands.
  21821. *
  21822. * @private
  21823. * @param {Array} array The array to modify.
  21824. * @param {Array} values The values to remove.
  21825. * @param {Function} [iteratee] The iteratee invoked per element.
  21826. * @param {Function} [comparator] The comparator invoked per element.
  21827. * @returns {Array} Returns `array`.
  21828. */
  21829. function basePullAll(array, values, iteratee, comparator) {
  21830. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21831. index = -1,
  21832. length = values.length,
  21833. seen = array;
  21834. if (array === values) {
  21835. values = copyArray(values);
  21836. }
  21837. if (iteratee) {
  21838. seen = arrayMap(array, baseUnary(iteratee));
  21839. }
  21840. while (++index < length) {
  21841. var fromIndex = 0,
  21842. value = values[index],
  21843. computed = iteratee ? iteratee(value) : value;
  21844. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21845. if (seen !== array) {
  21846. splice.call(seen, fromIndex, 1);
  21847. }
  21848. splice.call(array, fromIndex, 1);
  21849. }
  21850. }
  21851. return array;
  21852. }
  21853. /**
  21854. * The base implementation of `_.pullAt` without support for individual
  21855. * indexes or capturing the removed elements.
  21856. *
  21857. * @private
  21858. * @param {Array} array The array to modify.
  21859. * @param {number[]} indexes The indexes of elements to remove.
  21860. * @returns {Array} Returns `array`.
  21861. */
  21862. function basePullAt(array, indexes) {
  21863. var length = array ? indexes.length : 0,
  21864. lastIndex = length - 1;
  21865. while (length--) {
  21866. var index = indexes[length];
  21867. if (length == lastIndex || index !== previous) {
  21868. var previous = index;
  21869. if (isIndex(index)) {
  21870. splice.call(array, index, 1);
  21871. } else {
  21872. baseUnset(array, index);
  21873. }
  21874. }
  21875. }
  21876. return array;
  21877. }
  21878. /**
  21879. * The base implementation of `_.random` without support for returning
  21880. * floating-point numbers.
  21881. *
  21882. * @private
  21883. * @param {number} lower The lower bound.
  21884. * @param {number} upper The upper bound.
  21885. * @returns {number} Returns the random number.
  21886. */
  21887. function baseRandom(lower, upper) {
  21888. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21889. }
  21890. /**
  21891. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21892. * coerce arguments.
  21893. *
  21894. * @private
  21895. * @param {number} start The start of the range.
  21896. * @param {number} end The end of the range.
  21897. * @param {number} step The value to increment or decrement by.
  21898. * @param {boolean} [fromRight] Specify iterating from right to left.
  21899. * @returns {Array} Returns the range of numbers.
  21900. */
  21901. function baseRange(start, end, step, fromRight) {
  21902. var index = -1,
  21903. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21904. result = Array(length);
  21905. while (length--) {
  21906. result[fromRight ? length : ++index] = start;
  21907. start += step;
  21908. }
  21909. return result;
  21910. }
  21911. /**
  21912. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21913. *
  21914. * @private
  21915. * @param {string} string The string to repeat.
  21916. * @param {number} n The number of times to repeat the string.
  21917. * @returns {string} Returns the repeated string.
  21918. */
  21919. function baseRepeat(string, n) {
  21920. var result = '';
  21921. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21922. return result;
  21923. }
  21924. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21925. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21926. do {
  21927. if (n % 2) {
  21928. result += string;
  21929. }
  21930. n = nativeFloor(n / 2);
  21931. if (n) {
  21932. string += string;
  21933. }
  21934. } while (n);
  21935. return result;
  21936. }
  21937. /**
  21938. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21939. *
  21940. * @private
  21941. * @param {Function} func The function to apply a rest parameter to.
  21942. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21943. * @returns {Function} Returns the new function.
  21944. */
  21945. function baseRest(func, start) {
  21946. return setToString(overRest(func, start, identity), func + '');
  21947. }
  21948. /**
  21949. * The base implementation of `_.sample`.
  21950. *
  21951. * @private
  21952. * @param {Array|Object} collection The collection to sample.
  21953. * @returns {*} Returns the random element.
  21954. */
  21955. function baseSample(collection) {
  21956. return arraySample(values(collection));
  21957. }
  21958. /**
  21959. * The base implementation of `_.sampleSize` without param guards.
  21960. *
  21961. * @private
  21962. * @param {Array|Object} collection The collection to sample.
  21963. * @param {number} n The number of elements to sample.
  21964. * @returns {Array} Returns the random elements.
  21965. */
  21966. function baseSampleSize(collection, n) {
  21967. var array = values(collection);
  21968. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21969. }
  21970. /**
  21971. * The base implementation of `_.set`.
  21972. *
  21973. * @private
  21974. * @param {Object} object The object to modify.
  21975. * @param {Array|string} path The path of the property to set.
  21976. * @param {*} value The value to set.
  21977. * @param {Function} [customizer] The function to customize path creation.
  21978. * @returns {Object} Returns `object`.
  21979. */
  21980. function baseSet(object, path, value, customizer) {
  21981. if (!isObject(object)) {
  21982. return object;
  21983. }
  21984. path = castPath(path, object);
  21985. var index = -1,
  21986. length = path.length,
  21987. lastIndex = length - 1,
  21988. nested = object;
  21989. while (nested != null && ++index < length) {
  21990. var key = toKey(path[index]),
  21991. newValue = value;
  21992. if (index != lastIndex) {
  21993. var objValue = nested[key];
  21994. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21995. if (newValue === undefined) {
  21996. newValue = isObject(objValue)
  21997. ? objValue
  21998. : (isIndex(path[index + 1]) ? [] : {});
  21999. }
  22000. }
  22001. assignValue(nested, key, newValue);
  22002. nested = nested[key];
  22003. }
  22004. return object;
  22005. }
  22006. /**
  22007. * The base implementation of `setData` without support for hot loop shorting.
  22008. *
  22009. * @private
  22010. * @param {Function} func The function to associate metadata with.
  22011. * @param {*} data The metadata.
  22012. * @returns {Function} Returns `func`.
  22013. */
  22014. var baseSetData = !metaMap ? identity : function(func, data) {
  22015. metaMap.set(func, data);
  22016. return func;
  22017. };
  22018. /**
  22019. * The base implementation of `setToString` without support for hot loop shorting.
  22020. *
  22021. * @private
  22022. * @param {Function} func The function to modify.
  22023. * @param {Function} string The `toString` result.
  22024. * @returns {Function} Returns `func`.
  22025. */
  22026. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22027. return defineProperty(func, 'toString', {
  22028. 'configurable': true,
  22029. 'enumerable': false,
  22030. 'value': constant(string),
  22031. 'writable': true
  22032. });
  22033. };
  22034. /**
  22035. * The base implementation of `_.shuffle`.
  22036. *
  22037. * @private
  22038. * @param {Array|Object} collection The collection to shuffle.
  22039. * @returns {Array} Returns the new shuffled array.
  22040. */
  22041. function baseShuffle(collection) {
  22042. return shuffleSelf(values(collection));
  22043. }
  22044. /**
  22045. * The base implementation of `_.slice` without an iteratee call guard.
  22046. *
  22047. * @private
  22048. * @param {Array} array The array to slice.
  22049. * @param {number} [start=0] The start position.
  22050. * @param {number} [end=array.length] The end position.
  22051. * @returns {Array} Returns the slice of `array`.
  22052. */
  22053. function baseSlice(array, start, end) {
  22054. var index = -1,
  22055. length = array.length;
  22056. if (start < 0) {
  22057. start = -start > length ? 0 : (length + start);
  22058. }
  22059. end = end > length ? length : end;
  22060. if (end < 0) {
  22061. end += length;
  22062. }
  22063. length = start > end ? 0 : ((end - start) >>> 0);
  22064. start >>>= 0;
  22065. var result = Array(length);
  22066. while (++index < length) {
  22067. result[index] = array[index + start];
  22068. }
  22069. return result;
  22070. }
  22071. /**
  22072. * The base implementation of `_.some` without support for iteratee shorthands.
  22073. *
  22074. * @private
  22075. * @param {Array|Object} collection The collection to iterate over.
  22076. * @param {Function} predicate The function invoked per iteration.
  22077. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22078. * else `false`.
  22079. */
  22080. function baseSome(collection, predicate) {
  22081. var result;
  22082. baseEach(collection, function(value, index, collection) {
  22083. result = predicate(value, index, collection);
  22084. return !result;
  22085. });
  22086. return !!result;
  22087. }
  22088. /**
  22089. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22090. * performs a binary search of `array` to determine the index at which `value`
  22091. * should be inserted into `array` in order to maintain its sort order.
  22092. *
  22093. * @private
  22094. * @param {Array} array The sorted array to inspect.
  22095. * @param {*} value The value to evaluate.
  22096. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22097. * @returns {number} Returns the index at which `value` should be inserted
  22098. * into `array`.
  22099. */
  22100. function baseSortedIndex(array, value, retHighest) {
  22101. var low = 0,
  22102. high = array == null ? low : array.length;
  22103. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22104. while (low < high) {
  22105. var mid = (low + high) >>> 1,
  22106. computed = array[mid];
  22107. if (computed !== null && !isSymbol(computed) &&
  22108. (retHighest ? (computed <= value) : (computed < value))) {
  22109. low = mid + 1;
  22110. } else {
  22111. high = mid;
  22112. }
  22113. }
  22114. return high;
  22115. }
  22116. return baseSortedIndexBy(array, value, identity, retHighest);
  22117. }
  22118. /**
  22119. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22120. * which invokes `iteratee` for `value` and each element of `array` to compute
  22121. * their sort ranking. The iteratee is invoked with one argument; (value).
  22122. *
  22123. * @private
  22124. * @param {Array} array The sorted array to inspect.
  22125. * @param {*} value The value to evaluate.
  22126. * @param {Function} iteratee The iteratee invoked per element.
  22127. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22128. * @returns {number} Returns the index at which `value` should be inserted
  22129. * into `array`.
  22130. */
  22131. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22132. value = iteratee(value);
  22133. var low = 0,
  22134. high = array == null ? 0 : array.length,
  22135. valIsNaN = value !== value,
  22136. valIsNull = value === null,
  22137. valIsSymbol = isSymbol(value),
  22138. valIsUndefined = value === undefined;
  22139. while (low < high) {
  22140. var mid = nativeFloor((low + high) / 2),
  22141. computed = iteratee(array[mid]),
  22142. othIsDefined = computed !== undefined,
  22143. othIsNull = computed === null,
  22144. othIsReflexive = computed === computed,
  22145. othIsSymbol = isSymbol(computed);
  22146. if (valIsNaN) {
  22147. var setLow = retHighest || othIsReflexive;
  22148. } else if (valIsUndefined) {
  22149. setLow = othIsReflexive && (retHighest || othIsDefined);
  22150. } else if (valIsNull) {
  22151. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22152. } else if (valIsSymbol) {
  22153. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22154. } else if (othIsNull || othIsSymbol) {
  22155. setLow = false;
  22156. } else {
  22157. setLow = retHighest ? (computed <= value) : (computed < value);
  22158. }
  22159. if (setLow) {
  22160. low = mid + 1;
  22161. } else {
  22162. high = mid;
  22163. }
  22164. }
  22165. return nativeMin(high, MAX_ARRAY_INDEX);
  22166. }
  22167. /**
  22168. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22169. * support for iteratee shorthands.
  22170. *
  22171. * @private
  22172. * @param {Array} array The array to inspect.
  22173. * @param {Function} [iteratee] The iteratee invoked per element.
  22174. * @returns {Array} Returns the new duplicate free array.
  22175. */
  22176. function baseSortedUniq(array, iteratee) {
  22177. var index = -1,
  22178. length = array.length,
  22179. resIndex = 0,
  22180. result = [];
  22181. while (++index < length) {
  22182. var value = array[index],
  22183. computed = iteratee ? iteratee(value) : value;
  22184. if (!index || !eq(computed, seen)) {
  22185. var seen = computed;
  22186. result[resIndex++] = value === 0 ? 0 : value;
  22187. }
  22188. }
  22189. return result;
  22190. }
  22191. /**
  22192. * The base implementation of `_.toNumber` which doesn't ensure correct
  22193. * conversions of binary, hexadecimal, or octal string values.
  22194. *
  22195. * @private
  22196. * @param {*} value The value to process.
  22197. * @returns {number} Returns the number.
  22198. */
  22199. function baseToNumber(value) {
  22200. if (typeof value == 'number') {
  22201. return value;
  22202. }
  22203. if (isSymbol(value)) {
  22204. return NAN;
  22205. }
  22206. return +value;
  22207. }
  22208. /**
  22209. * The base implementation of `_.toString` which doesn't convert nullish
  22210. * values to empty strings.
  22211. *
  22212. * @private
  22213. * @param {*} value The value to process.
  22214. * @returns {string} Returns the string.
  22215. */
  22216. function baseToString(value) {
  22217. // Exit early for strings to avoid a performance hit in some environments.
  22218. if (typeof value == 'string') {
  22219. return value;
  22220. }
  22221. if (isArray(value)) {
  22222. // Recursively convert values (susceptible to call stack limits).
  22223. return arrayMap(value, baseToString) + '';
  22224. }
  22225. if (isSymbol(value)) {
  22226. return symbolToString ? symbolToString.call(value) : '';
  22227. }
  22228. var result = (value + '');
  22229. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22230. }
  22231. /**
  22232. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22233. *
  22234. * @private
  22235. * @param {Array} array The array to inspect.
  22236. * @param {Function} [iteratee] The iteratee invoked per element.
  22237. * @param {Function} [comparator] The comparator invoked per element.
  22238. * @returns {Array} Returns the new duplicate free array.
  22239. */
  22240. function baseUniq(array, iteratee, comparator) {
  22241. var index = -1,
  22242. includes = arrayIncludes,
  22243. length = array.length,
  22244. isCommon = true,
  22245. result = [],
  22246. seen = result;
  22247. if (comparator) {
  22248. isCommon = false;
  22249. includes = arrayIncludesWith;
  22250. }
  22251. else if (length >= LARGE_ARRAY_SIZE) {
  22252. var set = iteratee ? null : createSet(array);
  22253. if (set) {
  22254. return setToArray(set);
  22255. }
  22256. isCommon = false;
  22257. includes = cacheHas;
  22258. seen = new SetCache;
  22259. }
  22260. else {
  22261. seen = iteratee ? [] : result;
  22262. }
  22263. outer:
  22264. while (++index < length) {
  22265. var value = array[index],
  22266. computed = iteratee ? iteratee(value) : value;
  22267. value = (comparator || value !== 0) ? value : 0;
  22268. if (isCommon && computed === computed) {
  22269. var seenIndex = seen.length;
  22270. while (seenIndex--) {
  22271. if (seen[seenIndex] === computed) {
  22272. continue outer;
  22273. }
  22274. }
  22275. if (iteratee) {
  22276. seen.push(computed);
  22277. }
  22278. result.push(value);
  22279. }
  22280. else if (!includes(seen, computed, comparator)) {
  22281. if (seen !== result) {
  22282. seen.push(computed);
  22283. }
  22284. result.push(value);
  22285. }
  22286. }
  22287. return result;
  22288. }
  22289. /**
  22290. * The base implementation of `_.unset`.
  22291. *
  22292. * @private
  22293. * @param {Object} object The object to modify.
  22294. * @param {Array|string} path The property path to unset.
  22295. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22296. */
  22297. function baseUnset(object, path) {
  22298. path = castPath(path, object);
  22299. object = parent(object, path);
  22300. return object == null || delete object[toKey(last(path))];
  22301. }
  22302. /**
  22303. * The base implementation of `_.update`.
  22304. *
  22305. * @private
  22306. * @param {Object} object The object to modify.
  22307. * @param {Array|string} path The path of the property to update.
  22308. * @param {Function} updater The function to produce the updated value.
  22309. * @param {Function} [customizer] The function to customize path creation.
  22310. * @returns {Object} Returns `object`.
  22311. */
  22312. function baseUpdate(object, path, updater, customizer) {
  22313. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22314. }
  22315. /**
  22316. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22317. * without support for iteratee shorthands.
  22318. *
  22319. * @private
  22320. * @param {Array} array The array to query.
  22321. * @param {Function} predicate The function invoked per iteration.
  22322. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22323. * @param {boolean} [fromRight] Specify iterating from right to left.
  22324. * @returns {Array} Returns the slice of `array`.
  22325. */
  22326. function baseWhile(array, predicate, isDrop, fromRight) {
  22327. var length = array.length,
  22328. index = fromRight ? length : -1;
  22329. while ((fromRight ? index-- : ++index < length) &&
  22330. predicate(array[index], index, array)) {}
  22331. return isDrop
  22332. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22333. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22334. }
  22335. /**
  22336. * The base implementation of `wrapperValue` which returns the result of
  22337. * performing a sequence of actions on the unwrapped `value`, where each
  22338. * successive action is supplied the return value of the previous.
  22339. *
  22340. * @private
  22341. * @param {*} value The unwrapped value.
  22342. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22343. * @returns {*} Returns the resolved value.
  22344. */
  22345. function baseWrapperValue(value, actions) {
  22346. var result = value;
  22347. if (result instanceof LazyWrapper) {
  22348. result = result.value();
  22349. }
  22350. return arrayReduce(actions, function(result, action) {
  22351. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22352. }, result);
  22353. }
  22354. /**
  22355. * The base implementation of methods like `_.xor`, without support for
  22356. * iteratee shorthands, that accepts an array of arrays to inspect.
  22357. *
  22358. * @private
  22359. * @param {Array} arrays The arrays to inspect.
  22360. * @param {Function} [iteratee] The iteratee invoked per element.
  22361. * @param {Function} [comparator] The comparator invoked per element.
  22362. * @returns {Array} Returns the new array of values.
  22363. */
  22364. function baseXor(arrays, iteratee, comparator) {
  22365. var length = arrays.length;
  22366. if (length < 2) {
  22367. return length ? baseUniq(arrays[0]) : [];
  22368. }
  22369. var index = -1,
  22370. result = Array(length);
  22371. while (++index < length) {
  22372. var array = arrays[index],
  22373. othIndex = -1;
  22374. while (++othIndex < length) {
  22375. if (othIndex != index) {
  22376. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22377. }
  22378. }
  22379. }
  22380. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22381. }
  22382. /**
  22383. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22384. *
  22385. * @private
  22386. * @param {Array} props The property identifiers.
  22387. * @param {Array} values The property values.
  22388. * @param {Function} assignFunc The function to assign values.
  22389. * @returns {Object} Returns the new object.
  22390. */
  22391. function baseZipObject(props, values, assignFunc) {
  22392. var index = -1,
  22393. length = props.length,
  22394. valsLength = values.length,
  22395. result = {};
  22396. while (++index < length) {
  22397. var value = index < valsLength ? values[index] : undefined;
  22398. assignFunc(result, props[index], value);
  22399. }
  22400. return result;
  22401. }
  22402. /**
  22403. * Casts `value` to an empty array if it's not an array like object.
  22404. *
  22405. * @private
  22406. * @param {*} value The value to inspect.
  22407. * @returns {Array|Object} Returns the cast array-like object.
  22408. */
  22409. function castArrayLikeObject(value) {
  22410. return isArrayLikeObject(value) ? value : [];
  22411. }
  22412. /**
  22413. * Casts `value` to `identity` if it's not a function.
  22414. *
  22415. * @private
  22416. * @param {*} value The value to inspect.
  22417. * @returns {Function} Returns cast function.
  22418. */
  22419. function castFunction(value) {
  22420. return typeof value == 'function' ? value : identity;
  22421. }
  22422. /**
  22423. * Casts `value` to a path array if it's not one.
  22424. *
  22425. * @private
  22426. * @param {*} value The value to inspect.
  22427. * @param {Object} [object] The object to query keys on.
  22428. * @returns {Array} Returns the cast property path array.
  22429. */
  22430. function castPath(value, object) {
  22431. if (isArray(value)) {
  22432. return value;
  22433. }
  22434. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22435. }
  22436. /**
  22437. * A `baseRest` alias which can be replaced with `identity` by module
  22438. * replacement plugins.
  22439. *
  22440. * @private
  22441. * @type {Function}
  22442. * @param {Function} func The function to apply a rest parameter to.
  22443. * @returns {Function} Returns the new function.
  22444. */
  22445. var castRest = baseRest;
  22446. /**
  22447. * Casts `array` to a slice if it's needed.
  22448. *
  22449. * @private
  22450. * @param {Array} array The array to inspect.
  22451. * @param {number} start The start position.
  22452. * @param {number} [end=array.length] The end position.
  22453. * @returns {Array} Returns the cast slice.
  22454. */
  22455. function castSlice(array, start, end) {
  22456. var length = array.length;
  22457. end = end === undefined ? length : end;
  22458. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22459. }
  22460. /**
  22461. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22462. *
  22463. * @private
  22464. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22465. */
  22466. var clearTimeout = ctxClearTimeout || function(id) {
  22467. return root.clearTimeout(id);
  22468. };
  22469. /**
  22470. * Creates a clone of `buffer`.
  22471. *
  22472. * @private
  22473. * @param {Buffer} buffer The buffer to clone.
  22474. * @param {boolean} [isDeep] Specify a deep clone.
  22475. * @returns {Buffer} Returns the cloned buffer.
  22476. */
  22477. function cloneBuffer(buffer, isDeep) {
  22478. if (isDeep) {
  22479. return buffer.slice();
  22480. }
  22481. var length = buffer.length,
  22482. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22483. buffer.copy(result);
  22484. return result;
  22485. }
  22486. /**
  22487. * Creates a clone of `arrayBuffer`.
  22488. *
  22489. * @private
  22490. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22491. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22492. */
  22493. function cloneArrayBuffer(arrayBuffer) {
  22494. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22495. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22496. return result;
  22497. }
  22498. /**
  22499. * Creates a clone of `dataView`.
  22500. *
  22501. * @private
  22502. * @param {Object} dataView The data view to clone.
  22503. * @param {boolean} [isDeep] Specify a deep clone.
  22504. * @returns {Object} Returns the cloned data view.
  22505. */
  22506. function cloneDataView(dataView, isDeep) {
  22507. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22508. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22509. }
  22510. /**
  22511. * Creates a clone of `regexp`.
  22512. *
  22513. * @private
  22514. * @param {Object} regexp The regexp to clone.
  22515. * @returns {Object} Returns the cloned regexp.
  22516. */
  22517. function cloneRegExp(regexp) {
  22518. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22519. result.lastIndex = regexp.lastIndex;
  22520. return result;
  22521. }
  22522. /**
  22523. * Creates a clone of the `symbol` object.
  22524. *
  22525. * @private
  22526. * @param {Object} symbol The symbol object to clone.
  22527. * @returns {Object} Returns the cloned symbol object.
  22528. */
  22529. function cloneSymbol(symbol) {
  22530. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22531. }
  22532. /**
  22533. * Creates a clone of `typedArray`.
  22534. *
  22535. * @private
  22536. * @param {Object} typedArray The typed array to clone.
  22537. * @param {boolean} [isDeep] Specify a deep clone.
  22538. * @returns {Object} Returns the cloned typed array.
  22539. */
  22540. function cloneTypedArray(typedArray, isDeep) {
  22541. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22542. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22543. }
  22544. /**
  22545. * Compares values to sort them in ascending order.
  22546. *
  22547. * @private
  22548. * @param {*} value The value to compare.
  22549. * @param {*} other The other value to compare.
  22550. * @returns {number} Returns the sort order indicator for `value`.
  22551. */
  22552. function compareAscending(value, other) {
  22553. if (value !== other) {
  22554. var valIsDefined = value !== undefined,
  22555. valIsNull = value === null,
  22556. valIsReflexive = value === value,
  22557. valIsSymbol = isSymbol(value);
  22558. var othIsDefined = other !== undefined,
  22559. othIsNull = other === null,
  22560. othIsReflexive = other === other,
  22561. othIsSymbol = isSymbol(other);
  22562. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22563. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22564. (valIsNull && othIsDefined && othIsReflexive) ||
  22565. (!valIsDefined && othIsReflexive) ||
  22566. !valIsReflexive) {
  22567. return 1;
  22568. }
  22569. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22570. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22571. (othIsNull && valIsDefined && valIsReflexive) ||
  22572. (!othIsDefined && valIsReflexive) ||
  22573. !othIsReflexive) {
  22574. return -1;
  22575. }
  22576. }
  22577. return 0;
  22578. }
  22579. /**
  22580. * Used by `_.orderBy` to compare multiple properties of a value to another
  22581. * and stable sort them.
  22582. *
  22583. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22584. * specify an order of "desc" for descending or "asc" for ascending sort order
  22585. * of corresponding values.
  22586. *
  22587. * @private
  22588. * @param {Object} object The object to compare.
  22589. * @param {Object} other The other object to compare.
  22590. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22591. * @returns {number} Returns the sort order indicator for `object`.
  22592. */
  22593. function compareMultiple(object, other, orders) {
  22594. var index = -1,
  22595. objCriteria = object.criteria,
  22596. othCriteria = other.criteria,
  22597. length = objCriteria.length,
  22598. ordersLength = orders.length;
  22599. while (++index < length) {
  22600. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22601. if (result) {
  22602. if (index >= ordersLength) {
  22603. return result;
  22604. }
  22605. var order = orders[index];
  22606. return result * (order == 'desc' ? -1 : 1);
  22607. }
  22608. }
  22609. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22610. // that causes it, under certain circumstances, to provide the same value for
  22611. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22612. // for more details.
  22613. //
  22614. // This also ensures a stable sort in V8 and other engines.
  22615. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22616. return object.index - other.index;
  22617. }
  22618. /**
  22619. * Creates an array that is the composition of partially applied arguments,
  22620. * placeholders, and provided arguments into a single array of arguments.
  22621. *
  22622. * @private
  22623. * @param {Array} args The provided arguments.
  22624. * @param {Array} partials The arguments to prepend to those provided.
  22625. * @param {Array} holders The `partials` placeholder indexes.
  22626. * @params {boolean} [isCurried] Specify composing for a curried function.
  22627. * @returns {Array} Returns the new array of composed arguments.
  22628. */
  22629. function composeArgs(args, partials, holders, isCurried) {
  22630. var argsIndex = -1,
  22631. argsLength = args.length,
  22632. holdersLength = holders.length,
  22633. leftIndex = -1,
  22634. leftLength = partials.length,
  22635. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22636. result = Array(leftLength + rangeLength),
  22637. isUncurried = !isCurried;
  22638. while (++leftIndex < leftLength) {
  22639. result[leftIndex] = partials[leftIndex];
  22640. }
  22641. while (++argsIndex < holdersLength) {
  22642. if (isUncurried || argsIndex < argsLength) {
  22643. result[holders[argsIndex]] = args[argsIndex];
  22644. }
  22645. }
  22646. while (rangeLength--) {
  22647. result[leftIndex++] = args[argsIndex++];
  22648. }
  22649. return result;
  22650. }
  22651. /**
  22652. * This function is like `composeArgs` except that the arguments composition
  22653. * is tailored for `_.partialRight`.
  22654. *
  22655. * @private
  22656. * @param {Array} args The provided arguments.
  22657. * @param {Array} partials The arguments to append to those provided.
  22658. * @param {Array} holders The `partials` placeholder indexes.
  22659. * @params {boolean} [isCurried] Specify composing for a curried function.
  22660. * @returns {Array} Returns the new array of composed arguments.
  22661. */
  22662. function composeArgsRight(args, partials, holders, isCurried) {
  22663. var argsIndex = -1,
  22664. argsLength = args.length,
  22665. holdersIndex = -1,
  22666. holdersLength = holders.length,
  22667. rightIndex = -1,
  22668. rightLength = partials.length,
  22669. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22670. result = Array(rangeLength + rightLength),
  22671. isUncurried = !isCurried;
  22672. while (++argsIndex < rangeLength) {
  22673. result[argsIndex] = args[argsIndex];
  22674. }
  22675. var offset = argsIndex;
  22676. while (++rightIndex < rightLength) {
  22677. result[offset + rightIndex] = partials[rightIndex];
  22678. }
  22679. while (++holdersIndex < holdersLength) {
  22680. if (isUncurried || argsIndex < argsLength) {
  22681. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22682. }
  22683. }
  22684. return result;
  22685. }
  22686. /**
  22687. * Copies the values of `source` to `array`.
  22688. *
  22689. * @private
  22690. * @param {Array} source The array to copy values from.
  22691. * @param {Array} [array=[]] The array to copy values to.
  22692. * @returns {Array} Returns `array`.
  22693. */
  22694. function copyArray(source, array) {
  22695. var index = -1,
  22696. length = source.length;
  22697. array || (array = Array(length));
  22698. while (++index < length) {
  22699. array[index] = source[index];
  22700. }
  22701. return array;
  22702. }
  22703. /**
  22704. * Copies properties of `source` to `object`.
  22705. *
  22706. * @private
  22707. * @param {Object} source The object to copy properties from.
  22708. * @param {Array} props The property identifiers to copy.
  22709. * @param {Object} [object={}] The object to copy properties to.
  22710. * @param {Function} [customizer] The function to customize copied values.
  22711. * @returns {Object} Returns `object`.
  22712. */
  22713. function copyObject(source, props, object, customizer) {
  22714. var isNew = !object;
  22715. object || (object = {});
  22716. var index = -1,
  22717. length = props.length;
  22718. while (++index < length) {
  22719. var key = props[index];
  22720. var newValue = customizer
  22721. ? customizer(object[key], source[key], key, object, source)
  22722. : undefined;
  22723. if (newValue === undefined) {
  22724. newValue = source[key];
  22725. }
  22726. if (isNew) {
  22727. baseAssignValue(object, key, newValue);
  22728. } else {
  22729. assignValue(object, key, newValue);
  22730. }
  22731. }
  22732. return object;
  22733. }
  22734. /**
  22735. * Copies own symbols of `source` to `object`.
  22736. *
  22737. * @private
  22738. * @param {Object} source The object to copy symbols from.
  22739. * @param {Object} [object={}] The object to copy symbols to.
  22740. * @returns {Object} Returns `object`.
  22741. */
  22742. function copySymbols(source, object) {
  22743. return copyObject(source, getSymbols(source), object);
  22744. }
  22745. /**
  22746. * Copies own and inherited symbols of `source` to `object`.
  22747. *
  22748. * @private
  22749. * @param {Object} source The object to copy symbols from.
  22750. * @param {Object} [object={}] The object to copy symbols to.
  22751. * @returns {Object} Returns `object`.
  22752. */
  22753. function copySymbolsIn(source, object) {
  22754. return copyObject(source, getSymbolsIn(source), object);
  22755. }
  22756. /**
  22757. * Creates a function like `_.groupBy`.
  22758. *
  22759. * @private
  22760. * @param {Function} setter The function to set accumulator values.
  22761. * @param {Function} [initializer] The accumulator object initializer.
  22762. * @returns {Function} Returns the new aggregator function.
  22763. */
  22764. function createAggregator(setter, initializer) {
  22765. return function(collection, iteratee) {
  22766. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22767. accumulator = initializer ? initializer() : {};
  22768. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22769. };
  22770. }
  22771. /**
  22772. * Creates a function like `_.assign`.
  22773. *
  22774. * @private
  22775. * @param {Function} assigner The function to assign values.
  22776. * @returns {Function} Returns the new assigner function.
  22777. */
  22778. function createAssigner(assigner) {
  22779. return baseRest(function(object, sources) {
  22780. var index = -1,
  22781. length = sources.length,
  22782. customizer = length > 1 ? sources[length - 1] : undefined,
  22783. guard = length > 2 ? sources[2] : undefined;
  22784. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22785. ? (length--, customizer)
  22786. : undefined;
  22787. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22788. customizer = length < 3 ? undefined : customizer;
  22789. length = 1;
  22790. }
  22791. object = Object(object);
  22792. while (++index < length) {
  22793. var source = sources[index];
  22794. if (source) {
  22795. assigner(object, source, index, customizer);
  22796. }
  22797. }
  22798. return object;
  22799. });
  22800. }
  22801. /**
  22802. * Creates a `baseEach` or `baseEachRight` function.
  22803. *
  22804. * @private
  22805. * @param {Function} eachFunc The function to iterate over a collection.
  22806. * @param {boolean} [fromRight] Specify iterating from right to left.
  22807. * @returns {Function} Returns the new base function.
  22808. */
  22809. function createBaseEach(eachFunc, fromRight) {
  22810. return function(collection, iteratee) {
  22811. if (collection == null) {
  22812. return collection;
  22813. }
  22814. if (!isArrayLike(collection)) {
  22815. return eachFunc(collection, iteratee);
  22816. }
  22817. var length = collection.length,
  22818. index = fromRight ? length : -1,
  22819. iterable = Object(collection);
  22820. while ((fromRight ? index-- : ++index < length)) {
  22821. if (iteratee(iterable[index], index, iterable) === false) {
  22822. break;
  22823. }
  22824. }
  22825. return collection;
  22826. };
  22827. }
  22828. /**
  22829. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22830. *
  22831. * @private
  22832. * @param {boolean} [fromRight] Specify iterating from right to left.
  22833. * @returns {Function} Returns the new base function.
  22834. */
  22835. function createBaseFor(fromRight) {
  22836. return function(object, iteratee, keysFunc) {
  22837. var index = -1,
  22838. iterable = Object(object),
  22839. props = keysFunc(object),
  22840. length = props.length;
  22841. while (length--) {
  22842. var key = props[fromRight ? length : ++index];
  22843. if (iteratee(iterable[key], key, iterable) === false) {
  22844. break;
  22845. }
  22846. }
  22847. return object;
  22848. };
  22849. }
  22850. /**
  22851. * Creates a function that wraps `func` to invoke it with the optional `this`
  22852. * binding of `thisArg`.
  22853. *
  22854. * @private
  22855. * @param {Function} func The function to wrap.
  22856. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22857. * @param {*} [thisArg] The `this` binding of `func`.
  22858. * @returns {Function} Returns the new wrapped function.
  22859. */
  22860. function createBind(func, bitmask, thisArg) {
  22861. var isBind = bitmask & WRAP_BIND_FLAG,
  22862. Ctor = createCtor(func);
  22863. function wrapper() {
  22864. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22865. return fn.apply(isBind ? thisArg : this, arguments);
  22866. }
  22867. return wrapper;
  22868. }
  22869. /**
  22870. * Creates a function like `_.lowerFirst`.
  22871. *
  22872. * @private
  22873. * @param {string} methodName The name of the `String` case method to use.
  22874. * @returns {Function} Returns the new case function.
  22875. */
  22876. function createCaseFirst(methodName) {
  22877. return function(string) {
  22878. string = toString(string);
  22879. var strSymbols = hasUnicode(string)
  22880. ? stringToArray(string)
  22881. : undefined;
  22882. var chr = strSymbols
  22883. ? strSymbols[0]
  22884. : string.charAt(0);
  22885. var trailing = strSymbols
  22886. ? castSlice(strSymbols, 1).join('')
  22887. : string.slice(1);
  22888. return chr[methodName]() + trailing;
  22889. };
  22890. }
  22891. /**
  22892. * Creates a function like `_.camelCase`.
  22893. *
  22894. * @private
  22895. * @param {Function} callback The function to combine each word.
  22896. * @returns {Function} Returns the new compounder function.
  22897. */
  22898. function createCompounder(callback) {
  22899. return function(string) {
  22900. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22901. };
  22902. }
  22903. /**
  22904. * Creates a function that produces an instance of `Ctor` regardless of
  22905. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22906. *
  22907. * @private
  22908. * @param {Function} Ctor The constructor to wrap.
  22909. * @returns {Function} Returns the new wrapped function.
  22910. */
  22911. function createCtor(Ctor) {
  22912. return function() {
  22913. // Use a `switch` statement to work with class constructors. See
  22914. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22915. // for more details.
  22916. var args = arguments;
  22917. switch (args.length) {
  22918. case 0: return new Ctor;
  22919. case 1: return new Ctor(args[0]);
  22920. case 2: return new Ctor(args[0], args[1]);
  22921. case 3: return new Ctor(args[0], args[1], args[2]);
  22922. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22923. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22924. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22925. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22926. }
  22927. var thisBinding = baseCreate(Ctor.prototype),
  22928. result = Ctor.apply(thisBinding, args);
  22929. // Mimic the constructor's `return` behavior.
  22930. // See https://es5.github.io/#x13.2.2 for more details.
  22931. return isObject(result) ? result : thisBinding;
  22932. };
  22933. }
  22934. /**
  22935. * Creates a function that wraps `func` to enable currying.
  22936. *
  22937. * @private
  22938. * @param {Function} func The function to wrap.
  22939. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22940. * @param {number} arity The arity of `func`.
  22941. * @returns {Function} Returns the new wrapped function.
  22942. */
  22943. function createCurry(func, bitmask, arity) {
  22944. var Ctor = createCtor(func);
  22945. function wrapper() {
  22946. var length = arguments.length,
  22947. args = Array(length),
  22948. index = length,
  22949. placeholder = getHolder(wrapper);
  22950. while (index--) {
  22951. args[index] = arguments[index];
  22952. }
  22953. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22954. ? []
  22955. : replaceHolders(args, placeholder);
  22956. length -= holders.length;
  22957. if (length < arity) {
  22958. return createRecurry(
  22959. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22960. args, holders, undefined, undefined, arity - length);
  22961. }
  22962. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22963. return apply(fn, this, args);
  22964. }
  22965. return wrapper;
  22966. }
  22967. /**
  22968. * Creates a `_.find` or `_.findLast` function.
  22969. *
  22970. * @private
  22971. * @param {Function} findIndexFunc The function to find the collection index.
  22972. * @returns {Function} Returns the new find function.
  22973. */
  22974. function createFind(findIndexFunc) {
  22975. return function(collection, predicate, fromIndex) {
  22976. var iterable = Object(collection);
  22977. if (!isArrayLike(collection)) {
  22978. var iteratee = getIteratee(predicate, 3);
  22979. collection = keys(collection);
  22980. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22981. }
  22982. var index = findIndexFunc(collection, predicate, fromIndex);
  22983. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22984. };
  22985. }
  22986. /**
  22987. * Creates a `_.flow` or `_.flowRight` function.
  22988. *
  22989. * @private
  22990. * @param {boolean} [fromRight] Specify iterating from right to left.
  22991. * @returns {Function} Returns the new flow function.
  22992. */
  22993. function createFlow(fromRight) {
  22994. return flatRest(function(funcs) {
  22995. var length = funcs.length,
  22996. index = length,
  22997. prereq = LodashWrapper.prototype.thru;
  22998. if (fromRight) {
  22999. funcs.reverse();
  23000. }
  23001. while (index--) {
  23002. var func = funcs[index];
  23003. if (typeof func != 'function') {
  23004. throw new TypeError(FUNC_ERROR_TEXT);
  23005. }
  23006. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23007. var wrapper = new LodashWrapper([], true);
  23008. }
  23009. }
  23010. index = wrapper ? index : length;
  23011. while (++index < length) {
  23012. func = funcs[index];
  23013. var funcName = getFuncName(func),
  23014. data = funcName == 'wrapper' ? getData(func) : undefined;
  23015. if (data && isLaziable(data[0]) &&
  23016. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23017. !data[4].length && data[9] == 1
  23018. ) {
  23019. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23020. } else {
  23021. wrapper = (func.length == 1 && isLaziable(func))
  23022. ? wrapper[funcName]()
  23023. : wrapper.thru(func);
  23024. }
  23025. }
  23026. return function() {
  23027. var args = arguments,
  23028. value = args[0];
  23029. if (wrapper && args.length == 1 && isArray(value)) {
  23030. return wrapper.plant(value).value();
  23031. }
  23032. var index = 0,
  23033. result = length ? funcs[index].apply(this, args) : value;
  23034. while (++index < length) {
  23035. result = funcs[index].call(this, result);
  23036. }
  23037. return result;
  23038. };
  23039. });
  23040. }
  23041. /**
  23042. * Creates a function that wraps `func` to invoke it with optional `this`
  23043. * binding of `thisArg`, partial application, and currying.
  23044. *
  23045. * @private
  23046. * @param {Function|string} func The function or method name to wrap.
  23047. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23048. * @param {*} [thisArg] The `this` binding of `func`.
  23049. * @param {Array} [partials] The arguments to prepend to those provided to
  23050. * the new function.
  23051. * @param {Array} [holders] The `partials` placeholder indexes.
  23052. * @param {Array} [partialsRight] The arguments to append to those provided
  23053. * to the new function.
  23054. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23055. * @param {Array} [argPos] The argument positions of the new function.
  23056. * @param {number} [ary] The arity cap of `func`.
  23057. * @param {number} [arity] The arity of `func`.
  23058. * @returns {Function} Returns the new wrapped function.
  23059. */
  23060. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23061. var isAry = bitmask & WRAP_ARY_FLAG,
  23062. isBind = bitmask & WRAP_BIND_FLAG,
  23063. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23064. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23065. isFlip = bitmask & WRAP_FLIP_FLAG,
  23066. Ctor = isBindKey ? undefined : createCtor(func);
  23067. function wrapper() {
  23068. var length = arguments.length,
  23069. args = Array(length),
  23070. index = length;
  23071. while (index--) {
  23072. args[index] = arguments[index];
  23073. }
  23074. if (isCurried) {
  23075. var placeholder = getHolder(wrapper),
  23076. holdersCount = countHolders(args, placeholder);
  23077. }
  23078. if (partials) {
  23079. args = composeArgs(args, partials, holders, isCurried);
  23080. }
  23081. if (partialsRight) {
  23082. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23083. }
  23084. length -= holdersCount;
  23085. if (isCurried && length < arity) {
  23086. var newHolders = replaceHolders(args, placeholder);
  23087. return createRecurry(
  23088. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23089. args, newHolders, argPos, ary, arity - length
  23090. );
  23091. }
  23092. var thisBinding = isBind ? thisArg : this,
  23093. fn = isBindKey ? thisBinding[func] : func;
  23094. length = args.length;
  23095. if (argPos) {
  23096. args = reorder(args, argPos);
  23097. } else if (isFlip && length > 1) {
  23098. args.reverse();
  23099. }
  23100. if (isAry && ary < length) {
  23101. args.length = ary;
  23102. }
  23103. if (this && this !== root && this instanceof wrapper) {
  23104. fn = Ctor || createCtor(fn);
  23105. }
  23106. return fn.apply(thisBinding, args);
  23107. }
  23108. return wrapper;
  23109. }
  23110. /**
  23111. * Creates a function like `_.invertBy`.
  23112. *
  23113. * @private
  23114. * @param {Function} setter The function to set accumulator values.
  23115. * @param {Function} toIteratee The function to resolve iteratees.
  23116. * @returns {Function} Returns the new inverter function.
  23117. */
  23118. function createInverter(setter, toIteratee) {
  23119. return function(object, iteratee) {
  23120. return baseInverter(object, setter, toIteratee(iteratee), {});
  23121. };
  23122. }
  23123. /**
  23124. * Creates a function that performs a mathematical operation on two values.
  23125. *
  23126. * @private
  23127. * @param {Function} operator The function to perform the operation.
  23128. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23129. * @returns {Function} Returns the new mathematical operation function.
  23130. */
  23131. function createMathOperation(operator, defaultValue) {
  23132. return function(value, other) {
  23133. var result;
  23134. if (value === undefined && other === undefined) {
  23135. return defaultValue;
  23136. }
  23137. if (value !== undefined) {
  23138. result = value;
  23139. }
  23140. if (other !== undefined) {
  23141. if (result === undefined) {
  23142. return other;
  23143. }
  23144. if (typeof value == 'string' || typeof other == 'string') {
  23145. value = baseToString(value);
  23146. other = baseToString(other);
  23147. } else {
  23148. value = baseToNumber(value);
  23149. other = baseToNumber(other);
  23150. }
  23151. result = operator(value, other);
  23152. }
  23153. return result;
  23154. };
  23155. }
  23156. /**
  23157. * Creates a function like `_.over`.
  23158. *
  23159. * @private
  23160. * @param {Function} arrayFunc The function to iterate over iteratees.
  23161. * @returns {Function} Returns the new over function.
  23162. */
  23163. function createOver(arrayFunc) {
  23164. return flatRest(function(iteratees) {
  23165. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23166. return baseRest(function(args) {
  23167. var thisArg = this;
  23168. return arrayFunc(iteratees, function(iteratee) {
  23169. return apply(iteratee, thisArg, args);
  23170. });
  23171. });
  23172. });
  23173. }
  23174. /**
  23175. * Creates the padding for `string` based on `length`. The `chars` string
  23176. * is truncated if the number of characters exceeds `length`.
  23177. *
  23178. * @private
  23179. * @param {number} length The padding length.
  23180. * @param {string} [chars=' '] The string used as padding.
  23181. * @returns {string} Returns the padding for `string`.
  23182. */
  23183. function createPadding(length, chars) {
  23184. chars = chars === undefined ? ' ' : baseToString(chars);
  23185. var charsLength = chars.length;
  23186. if (charsLength < 2) {
  23187. return charsLength ? baseRepeat(chars, length) : chars;
  23188. }
  23189. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23190. return hasUnicode(chars)
  23191. ? castSlice(stringToArray(result), 0, length).join('')
  23192. : result.slice(0, length);
  23193. }
  23194. /**
  23195. * Creates a function that wraps `func` to invoke it with the `this` binding
  23196. * of `thisArg` and `partials` prepended to the arguments it receives.
  23197. *
  23198. * @private
  23199. * @param {Function} func The function to wrap.
  23200. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23201. * @param {*} thisArg The `this` binding of `func`.
  23202. * @param {Array} partials The arguments to prepend to those provided to
  23203. * the new function.
  23204. * @returns {Function} Returns the new wrapped function.
  23205. */
  23206. function createPartial(func, bitmask, thisArg, partials) {
  23207. var isBind = bitmask & WRAP_BIND_FLAG,
  23208. Ctor = createCtor(func);
  23209. function wrapper() {
  23210. var argsIndex = -1,
  23211. argsLength = arguments.length,
  23212. leftIndex = -1,
  23213. leftLength = partials.length,
  23214. args = Array(leftLength + argsLength),
  23215. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23216. while (++leftIndex < leftLength) {
  23217. args[leftIndex] = partials[leftIndex];
  23218. }
  23219. while (argsLength--) {
  23220. args[leftIndex++] = arguments[++argsIndex];
  23221. }
  23222. return apply(fn, isBind ? thisArg : this, args);
  23223. }
  23224. return wrapper;
  23225. }
  23226. /**
  23227. * Creates a `_.range` or `_.rangeRight` function.
  23228. *
  23229. * @private
  23230. * @param {boolean} [fromRight] Specify iterating from right to left.
  23231. * @returns {Function} Returns the new range function.
  23232. */
  23233. function createRange(fromRight) {
  23234. return function(start, end, step) {
  23235. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23236. end = step = undefined;
  23237. }
  23238. // Ensure the sign of `-0` is preserved.
  23239. start = toFinite(start);
  23240. if (end === undefined) {
  23241. end = start;
  23242. start = 0;
  23243. } else {
  23244. end = toFinite(end);
  23245. }
  23246. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23247. return baseRange(start, end, step, fromRight);
  23248. };
  23249. }
  23250. /**
  23251. * Creates a function that performs a relational operation on two values.
  23252. *
  23253. * @private
  23254. * @param {Function} operator The function to perform the operation.
  23255. * @returns {Function} Returns the new relational operation function.
  23256. */
  23257. function createRelationalOperation(operator) {
  23258. return function(value, other) {
  23259. if (!(typeof value == 'string' && typeof other == 'string')) {
  23260. value = toNumber(value);
  23261. other = toNumber(other);
  23262. }
  23263. return operator(value, other);
  23264. };
  23265. }
  23266. /**
  23267. * Creates a function that wraps `func` to continue currying.
  23268. *
  23269. * @private
  23270. * @param {Function} func The function to wrap.
  23271. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23272. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23273. * @param {*} placeholder The placeholder value.
  23274. * @param {*} [thisArg] The `this` binding of `func`.
  23275. * @param {Array} [partials] The arguments to prepend to those provided to
  23276. * the new function.
  23277. * @param {Array} [holders] The `partials` placeholder indexes.
  23278. * @param {Array} [argPos] The argument positions of the new function.
  23279. * @param {number} [ary] The arity cap of `func`.
  23280. * @param {number} [arity] The arity of `func`.
  23281. * @returns {Function} Returns the new wrapped function.
  23282. */
  23283. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23284. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23285. newHolders = isCurry ? holders : undefined,
  23286. newHoldersRight = isCurry ? undefined : holders,
  23287. newPartials = isCurry ? partials : undefined,
  23288. newPartialsRight = isCurry ? undefined : partials;
  23289. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23290. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23291. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23292. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23293. }
  23294. var newData = [
  23295. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23296. newHoldersRight, argPos, ary, arity
  23297. ];
  23298. var result = wrapFunc.apply(undefined, newData);
  23299. if (isLaziable(func)) {
  23300. setData(result, newData);
  23301. }
  23302. result.placeholder = placeholder;
  23303. return setWrapToString(result, func, bitmask);
  23304. }
  23305. /**
  23306. * Creates a function like `_.round`.
  23307. *
  23308. * @private
  23309. * @param {string} methodName The name of the `Math` method to use when rounding.
  23310. * @returns {Function} Returns the new round function.
  23311. */
  23312. function createRound(methodName) {
  23313. var func = Math[methodName];
  23314. return function(number, precision) {
  23315. number = toNumber(number);
  23316. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23317. if (precision && nativeIsFinite(number)) {
  23318. // Shift with exponential notation to avoid floating-point issues.
  23319. // See [MDN](https://mdn.io/round#Examples) for more details.
  23320. var pair = (toString(number) + 'e').split('e'),
  23321. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23322. pair = (toString(value) + 'e').split('e');
  23323. return +(pair[0] + 'e' + (+pair[1] - precision));
  23324. }
  23325. return func(number);
  23326. };
  23327. }
  23328. /**
  23329. * Creates a set object of `values`.
  23330. *
  23331. * @private
  23332. * @param {Array} values The values to add to the set.
  23333. * @returns {Object} Returns the new set.
  23334. */
  23335. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23336. return new Set(values);
  23337. };
  23338. /**
  23339. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23340. *
  23341. * @private
  23342. * @param {Function} keysFunc The function to get the keys of a given object.
  23343. * @returns {Function} Returns the new pairs function.
  23344. */
  23345. function createToPairs(keysFunc) {
  23346. return function(object) {
  23347. var tag = getTag(object);
  23348. if (tag == mapTag) {
  23349. return mapToArray(object);
  23350. }
  23351. if (tag == setTag) {
  23352. return setToPairs(object);
  23353. }
  23354. return baseToPairs(object, keysFunc(object));
  23355. };
  23356. }
  23357. /**
  23358. * Creates a function that either curries or invokes `func` with optional
  23359. * `this` binding and partially applied arguments.
  23360. *
  23361. * @private
  23362. * @param {Function|string} func The function or method name to wrap.
  23363. * @param {number} bitmask The bitmask flags.
  23364. * 1 - `_.bind`
  23365. * 2 - `_.bindKey`
  23366. * 4 - `_.curry` or `_.curryRight` of a bound function
  23367. * 8 - `_.curry`
  23368. * 16 - `_.curryRight`
  23369. * 32 - `_.partial`
  23370. * 64 - `_.partialRight`
  23371. * 128 - `_.rearg`
  23372. * 256 - `_.ary`
  23373. * 512 - `_.flip`
  23374. * @param {*} [thisArg] The `this` binding of `func`.
  23375. * @param {Array} [partials] The arguments to be partially applied.
  23376. * @param {Array} [holders] The `partials` placeholder indexes.
  23377. * @param {Array} [argPos] The argument positions of the new function.
  23378. * @param {number} [ary] The arity cap of `func`.
  23379. * @param {number} [arity] The arity of `func`.
  23380. * @returns {Function} Returns the new wrapped function.
  23381. */
  23382. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23383. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23384. if (!isBindKey && typeof func != 'function') {
  23385. throw new TypeError(FUNC_ERROR_TEXT);
  23386. }
  23387. var length = partials ? partials.length : 0;
  23388. if (!length) {
  23389. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23390. partials = holders = undefined;
  23391. }
  23392. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23393. arity = arity === undefined ? arity : toInteger(arity);
  23394. length -= holders ? holders.length : 0;
  23395. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23396. var partialsRight = partials,
  23397. holdersRight = holders;
  23398. partials = holders = undefined;
  23399. }
  23400. var data = isBindKey ? undefined : getData(func);
  23401. var newData = [
  23402. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23403. argPos, ary, arity
  23404. ];
  23405. if (data) {
  23406. mergeData(newData, data);
  23407. }
  23408. func = newData[0];
  23409. bitmask = newData[1];
  23410. thisArg = newData[2];
  23411. partials = newData[3];
  23412. holders = newData[4];
  23413. arity = newData[9] = newData[9] === undefined
  23414. ? (isBindKey ? 0 : func.length)
  23415. : nativeMax(newData[9] - length, 0);
  23416. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23417. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23418. }
  23419. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23420. var result = createBind(func, bitmask, thisArg);
  23421. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23422. result = createCurry(func, bitmask, arity);
  23423. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23424. result = createPartial(func, bitmask, thisArg, partials);
  23425. } else {
  23426. result = createHybrid.apply(undefined, newData);
  23427. }
  23428. var setter = data ? baseSetData : setData;
  23429. return setWrapToString(setter(result, newData), func, bitmask);
  23430. }
  23431. /**
  23432. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23433. * of source objects to the destination object for all destination properties
  23434. * that resolve to `undefined`.
  23435. *
  23436. * @private
  23437. * @param {*} objValue The destination value.
  23438. * @param {*} srcValue The source value.
  23439. * @param {string} key The key of the property to assign.
  23440. * @param {Object} object The parent object of `objValue`.
  23441. * @returns {*} Returns the value to assign.
  23442. */
  23443. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23444. if (objValue === undefined ||
  23445. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23446. return srcValue;
  23447. }
  23448. return objValue;
  23449. }
  23450. /**
  23451. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23452. * objects into destination objects that are passed thru.
  23453. *
  23454. * @private
  23455. * @param {*} objValue The destination value.
  23456. * @param {*} srcValue The source value.
  23457. * @param {string} key The key of the property to merge.
  23458. * @param {Object} object The parent object of `objValue`.
  23459. * @param {Object} source The parent object of `srcValue`.
  23460. * @param {Object} [stack] Tracks traversed source values and their merged
  23461. * counterparts.
  23462. * @returns {*} Returns the value to assign.
  23463. */
  23464. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23465. if (isObject(objValue) && isObject(srcValue)) {
  23466. // Recursively merge objects and arrays (susceptible to call stack limits).
  23467. stack.set(srcValue, objValue);
  23468. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23469. stack['delete'](srcValue);
  23470. }
  23471. return objValue;
  23472. }
  23473. /**
  23474. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23475. * objects.
  23476. *
  23477. * @private
  23478. * @param {*} value The value to inspect.
  23479. * @param {string} key The key of the property to inspect.
  23480. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23481. */
  23482. function customOmitClone(value) {
  23483. return isPlainObject(value) ? undefined : value;
  23484. }
  23485. /**
  23486. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23487. * partial deep comparisons.
  23488. *
  23489. * @private
  23490. * @param {Array} array The array to compare.
  23491. * @param {Array} other The other array to compare.
  23492. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23493. * @param {Function} customizer The function to customize comparisons.
  23494. * @param {Function} equalFunc The function to determine equivalents of values.
  23495. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23496. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23497. */
  23498. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23499. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23500. arrLength = array.length,
  23501. othLength = other.length;
  23502. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23503. return false;
  23504. }
  23505. // Assume cyclic values are equal.
  23506. var stacked = stack.get(array);
  23507. if (stacked && stack.get(other)) {
  23508. return stacked == other;
  23509. }
  23510. var index = -1,
  23511. result = true,
  23512. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23513. stack.set(array, other);
  23514. stack.set(other, array);
  23515. // Ignore non-index properties.
  23516. while (++index < arrLength) {
  23517. var arrValue = array[index],
  23518. othValue = other[index];
  23519. if (customizer) {
  23520. var compared = isPartial
  23521. ? customizer(othValue, arrValue, index, other, array, stack)
  23522. : customizer(arrValue, othValue, index, array, other, stack);
  23523. }
  23524. if (compared !== undefined) {
  23525. if (compared) {
  23526. continue;
  23527. }
  23528. result = false;
  23529. break;
  23530. }
  23531. // Recursively compare arrays (susceptible to call stack limits).
  23532. if (seen) {
  23533. if (!arraySome(other, function(othValue, othIndex) {
  23534. if (!cacheHas(seen, othIndex) &&
  23535. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23536. return seen.push(othIndex);
  23537. }
  23538. })) {
  23539. result = false;
  23540. break;
  23541. }
  23542. } else if (!(
  23543. arrValue === othValue ||
  23544. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23545. )) {
  23546. result = false;
  23547. break;
  23548. }
  23549. }
  23550. stack['delete'](array);
  23551. stack['delete'](other);
  23552. return result;
  23553. }
  23554. /**
  23555. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23556. * the same `toStringTag`.
  23557. *
  23558. * **Note:** This function only supports comparing values with tags of
  23559. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23560. *
  23561. * @private
  23562. * @param {Object} object The object to compare.
  23563. * @param {Object} other The other object to compare.
  23564. * @param {string} tag The `toStringTag` of the objects to compare.
  23565. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23566. * @param {Function} customizer The function to customize comparisons.
  23567. * @param {Function} equalFunc The function to determine equivalents of values.
  23568. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23569. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23570. */
  23571. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23572. switch (tag) {
  23573. case dataViewTag:
  23574. if ((object.byteLength != other.byteLength) ||
  23575. (object.byteOffset != other.byteOffset)) {
  23576. return false;
  23577. }
  23578. object = object.buffer;
  23579. other = other.buffer;
  23580. case arrayBufferTag:
  23581. if ((object.byteLength != other.byteLength) ||
  23582. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23583. return false;
  23584. }
  23585. return true;
  23586. case boolTag:
  23587. case dateTag:
  23588. case numberTag:
  23589. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23590. // Invalid dates are coerced to `NaN`.
  23591. return eq(+object, +other);
  23592. case errorTag:
  23593. return object.name == other.name && object.message == other.message;
  23594. case regexpTag:
  23595. case stringTag:
  23596. // Coerce regexes to strings and treat strings, primitives and objects,
  23597. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23598. // for more details.
  23599. return object == (other + '');
  23600. case mapTag:
  23601. var convert = mapToArray;
  23602. case setTag:
  23603. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23604. convert || (convert = setToArray);
  23605. if (object.size != other.size && !isPartial) {
  23606. return false;
  23607. }
  23608. // Assume cyclic values are equal.
  23609. var stacked = stack.get(object);
  23610. if (stacked) {
  23611. return stacked == other;
  23612. }
  23613. bitmask |= COMPARE_UNORDERED_FLAG;
  23614. // Recursively compare objects (susceptible to call stack limits).
  23615. stack.set(object, other);
  23616. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23617. stack['delete'](object);
  23618. return result;
  23619. case symbolTag:
  23620. if (symbolValueOf) {
  23621. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23622. }
  23623. }
  23624. return false;
  23625. }
  23626. /**
  23627. * A specialized version of `baseIsEqualDeep` for objects with support for
  23628. * partial deep comparisons.
  23629. *
  23630. * @private
  23631. * @param {Object} object The object to compare.
  23632. * @param {Object} other The other object to compare.
  23633. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23634. * @param {Function} customizer The function to customize comparisons.
  23635. * @param {Function} equalFunc The function to determine equivalents of values.
  23636. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23637. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23638. */
  23639. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23640. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23641. objProps = getAllKeys(object),
  23642. objLength = objProps.length,
  23643. othProps = getAllKeys(other),
  23644. othLength = othProps.length;
  23645. if (objLength != othLength && !isPartial) {
  23646. return false;
  23647. }
  23648. var index = objLength;
  23649. while (index--) {
  23650. var key = objProps[index];
  23651. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23652. return false;
  23653. }
  23654. }
  23655. // Assume cyclic values are equal.
  23656. var stacked = stack.get(object);
  23657. if (stacked && stack.get(other)) {
  23658. return stacked == other;
  23659. }
  23660. var result = true;
  23661. stack.set(object, other);
  23662. stack.set(other, object);
  23663. var skipCtor = isPartial;
  23664. while (++index < objLength) {
  23665. key = objProps[index];
  23666. var objValue = object[key],
  23667. othValue = other[key];
  23668. if (customizer) {
  23669. var compared = isPartial
  23670. ? customizer(othValue, objValue, key, other, object, stack)
  23671. : customizer(objValue, othValue, key, object, other, stack);
  23672. }
  23673. // Recursively compare objects (susceptible to call stack limits).
  23674. if (!(compared === undefined
  23675. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23676. : compared
  23677. )) {
  23678. result = false;
  23679. break;
  23680. }
  23681. skipCtor || (skipCtor = key == 'constructor');
  23682. }
  23683. if (result && !skipCtor) {
  23684. var objCtor = object.constructor,
  23685. othCtor = other.constructor;
  23686. // Non `Object` object instances with different constructors are not equal.
  23687. if (objCtor != othCtor &&
  23688. ('constructor' in object && 'constructor' in other) &&
  23689. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23690. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23691. result = false;
  23692. }
  23693. }
  23694. stack['delete'](object);
  23695. stack['delete'](other);
  23696. return result;
  23697. }
  23698. /**
  23699. * A specialized version of `baseRest` which flattens the rest array.
  23700. *
  23701. * @private
  23702. * @param {Function} func The function to apply a rest parameter to.
  23703. * @returns {Function} Returns the new function.
  23704. */
  23705. function flatRest(func) {
  23706. return setToString(overRest(func, undefined, flatten), func + '');
  23707. }
  23708. /**
  23709. * Creates an array of own enumerable property names and symbols of `object`.
  23710. *
  23711. * @private
  23712. * @param {Object} object The object to query.
  23713. * @returns {Array} Returns the array of property names and symbols.
  23714. */
  23715. function getAllKeys(object) {
  23716. return baseGetAllKeys(object, keys, getSymbols);
  23717. }
  23718. /**
  23719. * Creates an array of own and inherited enumerable property names and
  23720. * symbols of `object`.
  23721. *
  23722. * @private
  23723. * @param {Object} object The object to query.
  23724. * @returns {Array} Returns the array of property names and symbols.
  23725. */
  23726. function getAllKeysIn(object) {
  23727. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23728. }
  23729. /**
  23730. * Gets metadata for `func`.
  23731. *
  23732. * @private
  23733. * @param {Function} func The function to query.
  23734. * @returns {*} Returns the metadata for `func`.
  23735. */
  23736. var getData = !metaMap ? noop : function(func) {
  23737. return metaMap.get(func);
  23738. };
  23739. /**
  23740. * Gets the name of `func`.
  23741. *
  23742. * @private
  23743. * @param {Function} func The function to query.
  23744. * @returns {string} Returns the function name.
  23745. */
  23746. function getFuncName(func) {
  23747. var result = (func.name + ''),
  23748. array = realNames[result],
  23749. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23750. while (length--) {
  23751. var data = array[length],
  23752. otherFunc = data.func;
  23753. if (otherFunc == null || otherFunc == func) {
  23754. return data.name;
  23755. }
  23756. }
  23757. return result;
  23758. }
  23759. /**
  23760. * Gets the argument placeholder value for `func`.
  23761. *
  23762. * @private
  23763. * @param {Function} func The function to inspect.
  23764. * @returns {*} Returns the placeholder value.
  23765. */
  23766. function getHolder(func) {
  23767. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23768. return object.placeholder;
  23769. }
  23770. /**
  23771. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23772. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23773. * If arguments are provided, the chosen function is invoked with them and
  23774. * its result is returned.
  23775. *
  23776. * @private
  23777. * @param {*} [value] The value to convert to an iteratee.
  23778. * @param {number} [arity] The arity of the created iteratee.
  23779. * @returns {Function} Returns the chosen function or its result.
  23780. */
  23781. function getIteratee() {
  23782. var result = lodash.iteratee || iteratee;
  23783. result = result === iteratee ? baseIteratee : result;
  23784. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23785. }
  23786. /**
  23787. * Gets the data for `map`.
  23788. *
  23789. * @private
  23790. * @param {Object} map The map to query.
  23791. * @param {string} key The reference key.
  23792. * @returns {*} Returns the map data.
  23793. */
  23794. function getMapData(map, key) {
  23795. var data = map.__data__;
  23796. return isKeyable(key)
  23797. ? data[typeof key == 'string' ? 'string' : 'hash']
  23798. : data.map;
  23799. }
  23800. /**
  23801. * Gets the property names, values, and compare flags of `object`.
  23802. *
  23803. * @private
  23804. * @param {Object} object The object to query.
  23805. * @returns {Array} Returns the match data of `object`.
  23806. */
  23807. function getMatchData(object) {
  23808. var result = keys(object),
  23809. length = result.length;
  23810. while (length--) {
  23811. var key = result[length],
  23812. value = object[key];
  23813. result[length] = [key, value, isStrictComparable(value)];
  23814. }
  23815. return result;
  23816. }
  23817. /**
  23818. * Gets the native function at `key` of `object`.
  23819. *
  23820. * @private
  23821. * @param {Object} object The object to query.
  23822. * @param {string} key The key of the method to get.
  23823. * @returns {*} Returns the function if it's native, else `undefined`.
  23824. */
  23825. function getNative(object, key) {
  23826. var value = getValue(object, key);
  23827. return baseIsNative(value) ? value : undefined;
  23828. }
  23829. /**
  23830. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23831. *
  23832. * @private
  23833. * @param {*} value The value to query.
  23834. * @returns {string} Returns the raw `toStringTag`.
  23835. */
  23836. function getRawTag(value) {
  23837. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23838. tag = value[symToStringTag];
  23839. try {
  23840. value[symToStringTag] = undefined;
  23841. var unmasked = true;
  23842. } catch (e) {}
  23843. var result = nativeObjectToString.call(value);
  23844. if (unmasked) {
  23845. if (isOwn) {
  23846. value[symToStringTag] = tag;
  23847. } else {
  23848. delete value[symToStringTag];
  23849. }
  23850. }
  23851. return result;
  23852. }
  23853. /**
  23854. * Creates an array of the own enumerable symbols of `object`.
  23855. *
  23856. * @private
  23857. * @param {Object} object The object to query.
  23858. * @returns {Array} Returns the array of symbols.
  23859. */
  23860. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23861. if (object == null) {
  23862. return [];
  23863. }
  23864. object = Object(object);
  23865. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23866. return propertyIsEnumerable.call(object, symbol);
  23867. });
  23868. };
  23869. /**
  23870. * Creates an array of the own and inherited enumerable symbols of `object`.
  23871. *
  23872. * @private
  23873. * @param {Object} object The object to query.
  23874. * @returns {Array} Returns the array of symbols.
  23875. */
  23876. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23877. var result = [];
  23878. while (object) {
  23879. arrayPush(result, getSymbols(object));
  23880. object = getPrototype(object);
  23881. }
  23882. return result;
  23883. };
  23884. /**
  23885. * Gets the `toStringTag` of `value`.
  23886. *
  23887. * @private
  23888. * @param {*} value The value to query.
  23889. * @returns {string} Returns the `toStringTag`.
  23890. */
  23891. var getTag = baseGetTag;
  23892. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23893. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23894. (Map && getTag(new Map) != mapTag) ||
  23895. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23896. (Set && getTag(new Set) != setTag) ||
  23897. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23898. getTag = function(value) {
  23899. var result = baseGetTag(value),
  23900. Ctor = result == objectTag ? value.constructor : undefined,
  23901. ctorString = Ctor ? toSource(Ctor) : '';
  23902. if (ctorString) {
  23903. switch (ctorString) {
  23904. case dataViewCtorString: return dataViewTag;
  23905. case mapCtorString: return mapTag;
  23906. case promiseCtorString: return promiseTag;
  23907. case setCtorString: return setTag;
  23908. case weakMapCtorString: return weakMapTag;
  23909. }
  23910. }
  23911. return result;
  23912. };
  23913. }
  23914. /**
  23915. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23916. *
  23917. * @private
  23918. * @param {number} start The start of the view.
  23919. * @param {number} end The end of the view.
  23920. * @param {Array} transforms The transformations to apply to the view.
  23921. * @returns {Object} Returns an object containing the `start` and `end`
  23922. * positions of the view.
  23923. */
  23924. function getView(start, end, transforms) {
  23925. var index = -1,
  23926. length = transforms.length;
  23927. while (++index < length) {
  23928. var data = transforms[index],
  23929. size = data.size;
  23930. switch (data.type) {
  23931. case 'drop': start += size; break;
  23932. case 'dropRight': end -= size; break;
  23933. case 'take': end = nativeMin(end, start + size); break;
  23934. case 'takeRight': start = nativeMax(start, end - size); break;
  23935. }
  23936. }
  23937. return { 'start': start, 'end': end };
  23938. }
  23939. /**
  23940. * Extracts wrapper details from the `source` body comment.
  23941. *
  23942. * @private
  23943. * @param {string} source The source to inspect.
  23944. * @returns {Array} Returns the wrapper details.
  23945. */
  23946. function getWrapDetails(source) {
  23947. var match = source.match(reWrapDetails);
  23948. return match ? match[1].split(reSplitDetails) : [];
  23949. }
  23950. /**
  23951. * Checks if `path` exists on `object`.
  23952. *
  23953. * @private
  23954. * @param {Object} object The object to query.
  23955. * @param {Array|string} path The path to check.
  23956. * @param {Function} hasFunc The function to check properties.
  23957. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23958. */
  23959. function hasPath(object, path, hasFunc) {
  23960. path = castPath(path, object);
  23961. var index = -1,
  23962. length = path.length,
  23963. result = false;
  23964. while (++index < length) {
  23965. var key = toKey(path[index]);
  23966. if (!(result = object != null && hasFunc(object, key))) {
  23967. break;
  23968. }
  23969. object = object[key];
  23970. }
  23971. if (result || ++index != length) {
  23972. return result;
  23973. }
  23974. length = object == null ? 0 : object.length;
  23975. return !!length && isLength(length) && isIndex(key, length) &&
  23976. (isArray(object) || isArguments(object));
  23977. }
  23978. /**
  23979. * Initializes an array clone.
  23980. *
  23981. * @private
  23982. * @param {Array} array The array to clone.
  23983. * @returns {Array} Returns the initialized clone.
  23984. */
  23985. function initCloneArray(array) {
  23986. var length = array.length,
  23987. result = new array.constructor(length);
  23988. // Add properties assigned by `RegExp#exec`.
  23989. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23990. result.index = array.index;
  23991. result.input = array.input;
  23992. }
  23993. return result;
  23994. }
  23995. /**
  23996. * Initializes an object clone.
  23997. *
  23998. * @private
  23999. * @param {Object} object The object to clone.
  24000. * @returns {Object} Returns the initialized clone.
  24001. */
  24002. function initCloneObject(object) {
  24003. return (typeof object.constructor == 'function' && !isPrototype(object))
  24004. ? baseCreate(getPrototype(object))
  24005. : {};
  24006. }
  24007. /**
  24008. * Initializes an object clone based on its `toStringTag`.
  24009. *
  24010. * **Note:** This function only supports cloning values with tags of
  24011. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24012. *
  24013. * @private
  24014. * @param {Object} object The object to clone.
  24015. * @param {string} tag The `toStringTag` of the object to clone.
  24016. * @param {boolean} [isDeep] Specify a deep clone.
  24017. * @returns {Object} Returns the initialized clone.
  24018. */
  24019. function initCloneByTag(object, tag, isDeep) {
  24020. var Ctor = object.constructor;
  24021. switch (tag) {
  24022. case arrayBufferTag:
  24023. return cloneArrayBuffer(object);
  24024. case boolTag:
  24025. case dateTag:
  24026. return new Ctor(+object);
  24027. case dataViewTag:
  24028. return cloneDataView(object, isDeep);
  24029. case float32Tag: case float64Tag:
  24030. case int8Tag: case int16Tag: case int32Tag:
  24031. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24032. return cloneTypedArray(object, isDeep);
  24033. case mapTag:
  24034. return new Ctor;
  24035. case numberTag:
  24036. case stringTag:
  24037. return new Ctor(object);
  24038. case regexpTag:
  24039. return cloneRegExp(object);
  24040. case setTag:
  24041. return new Ctor;
  24042. case symbolTag:
  24043. return cloneSymbol(object);
  24044. }
  24045. }
  24046. /**
  24047. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24048. *
  24049. * @private
  24050. * @param {string} source The source to modify.
  24051. * @returns {Array} details The details to insert.
  24052. * @returns {string} Returns the modified source.
  24053. */
  24054. function insertWrapDetails(source, details) {
  24055. var length = details.length;
  24056. if (!length) {
  24057. return source;
  24058. }
  24059. var lastIndex = length - 1;
  24060. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24061. details = details.join(length > 2 ? ', ' : ' ');
  24062. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24063. }
  24064. /**
  24065. * Checks if `value` is a flattenable `arguments` object or array.
  24066. *
  24067. * @private
  24068. * @param {*} value The value to check.
  24069. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24070. */
  24071. function isFlattenable(value) {
  24072. return isArray(value) || isArguments(value) ||
  24073. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24074. }
  24075. /**
  24076. * Checks if `value` is a valid array-like index.
  24077. *
  24078. * @private
  24079. * @param {*} value The value to check.
  24080. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24081. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24082. */
  24083. function isIndex(value, length) {
  24084. var type = typeof value;
  24085. length = length == null ? MAX_SAFE_INTEGER : length;
  24086. return !!length &&
  24087. (type == 'number' ||
  24088. (type != 'symbol' && reIsUint.test(value))) &&
  24089. (value > -1 && value % 1 == 0 && value < length);
  24090. }
  24091. /**
  24092. * Checks if the given arguments are from an iteratee call.
  24093. *
  24094. * @private
  24095. * @param {*} value The potential iteratee value argument.
  24096. * @param {*} index The potential iteratee index or key argument.
  24097. * @param {*} object The potential iteratee object argument.
  24098. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24099. * else `false`.
  24100. */
  24101. function isIterateeCall(value, index, object) {
  24102. if (!isObject(object)) {
  24103. return false;
  24104. }
  24105. var type = typeof index;
  24106. if (type == 'number'
  24107. ? (isArrayLike(object) && isIndex(index, object.length))
  24108. : (type == 'string' && index in object)
  24109. ) {
  24110. return eq(object[index], value);
  24111. }
  24112. return false;
  24113. }
  24114. /**
  24115. * Checks if `value` is a property name and not a property path.
  24116. *
  24117. * @private
  24118. * @param {*} value The value to check.
  24119. * @param {Object} [object] The object to query keys on.
  24120. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24121. */
  24122. function isKey(value, object) {
  24123. if (isArray(value)) {
  24124. return false;
  24125. }
  24126. var type = typeof value;
  24127. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24128. value == null || isSymbol(value)) {
  24129. return true;
  24130. }
  24131. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24132. (object != null && value in Object(object));
  24133. }
  24134. /**
  24135. * Checks if `value` is suitable for use as unique object key.
  24136. *
  24137. * @private
  24138. * @param {*} value The value to check.
  24139. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24140. */
  24141. function isKeyable(value) {
  24142. var type = typeof value;
  24143. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24144. ? (value !== '__proto__')
  24145. : (value === null);
  24146. }
  24147. /**
  24148. * Checks if `func` has a lazy counterpart.
  24149. *
  24150. * @private
  24151. * @param {Function} func The function to check.
  24152. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24153. * else `false`.
  24154. */
  24155. function isLaziable(func) {
  24156. var funcName = getFuncName(func),
  24157. other = lodash[funcName];
  24158. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24159. return false;
  24160. }
  24161. if (func === other) {
  24162. return true;
  24163. }
  24164. var data = getData(other);
  24165. return !!data && func === data[0];
  24166. }
  24167. /**
  24168. * Checks if `func` has its source masked.
  24169. *
  24170. * @private
  24171. * @param {Function} func The function to check.
  24172. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24173. */
  24174. function isMasked(func) {
  24175. return !!maskSrcKey && (maskSrcKey in func);
  24176. }
  24177. /**
  24178. * Checks if `func` is capable of being masked.
  24179. *
  24180. * @private
  24181. * @param {*} value The value to check.
  24182. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24183. */
  24184. var isMaskable = coreJsData ? isFunction : stubFalse;
  24185. /**
  24186. * Checks if `value` is likely a prototype object.
  24187. *
  24188. * @private
  24189. * @param {*} value The value to check.
  24190. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24191. */
  24192. function isPrototype(value) {
  24193. var Ctor = value && value.constructor,
  24194. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24195. return value === proto;
  24196. }
  24197. /**
  24198. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24199. *
  24200. * @private
  24201. * @param {*} value The value to check.
  24202. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24203. * equality comparisons, else `false`.
  24204. */
  24205. function isStrictComparable(value) {
  24206. return value === value && !isObject(value);
  24207. }
  24208. /**
  24209. * A specialized version of `matchesProperty` for source values suitable
  24210. * for strict equality comparisons, i.e. `===`.
  24211. *
  24212. * @private
  24213. * @param {string} key The key of the property to get.
  24214. * @param {*} srcValue The value to match.
  24215. * @returns {Function} Returns the new spec function.
  24216. */
  24217. function matchesStrictComparable(key, srcValue) {
  24218. return function(object) {
  24219. if (object == null) {
  24220. return false;
  24221. }
  24222. return object[key] === srcValue &&
  24223. (srcValue !== undefined || (key in Object(object)));
  24224. };
  24225. }
  24226. /**
  24227. * A specialized version of `_.memoize` which clears the memoized function's
  24228. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24229. *
  24230. * @private
  24231. * @param {Function} func The function to have its output memoized.
  24232. * @returns {Function} Returns the new memoized function.
  24233. */
  24234. function memoizeCapped(func) {
  24235. var result = memoize(func, function(key) {
  24236. if (cache.size === MAX_MEMOIZE_SIZE) {
  24237. cache.clear();
  24238. }
  24239. return key;
  24240. });
  24241. var cache = result.cache;
  24242. return result;
  24243. }
  24244. /**
  24245. * Merges the function metadata of `source` into `data`.
  24246. *
  24247. * Merging metadata reduces the number of wrappers used to invoke a function.
  24248. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24249. * may be applied regardless of execution order. Methods like `_.ary` and
  24250. * `_.rearg` modify function arguments, making the order in which they are
  24251. * executed important, preventing the merging of metadata. However, we make
  24252. * an exception for a safe combined case where curried functions have `_.ary`
  24253. * and or `_.rearg` applied.
  24254. *
  24255. * @private
  24256. * @param {Array} data The destination metadata.
  24257. * @param {Array} source The source metadata.
  24258. * @returns {Array} Returns `data`.
  24259. */
  24260. function mergeData(data, source) {
  24261. var bitmask = data[1],
  24262. srcBitmask = source[1],
  24263. newBitmask = bitmask | srcBitmask,
  24264. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24265. var isCombo =
  24266. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24267. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24268. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24269. // Exit early if metadata can't be merged.
  24270. if (!(isCommon || isCombo)) {
  24271. return data;
  24272. }
  24273. // Use source `thisArg` if available.
  24274. if (srcBitmask & WRAP_BIND_FLAG) {
  24275. data[2] = source[2];
  24276. // Set when currying a bound function.
  24277. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24278. }
  24279. // Compose partial arguments.
  24280. var value = source[3];
  24281. if (value) {
  24282. var partials = data[3];
  24283. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24284. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24285. }
  24286. // Compose partial right arguments.
  24287. value = source[5];
  24288. if (value) {
  24289. partials = data[5];
  24290. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24291. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24292. }
  24293. // Use source `argPos` if available.
  24294. value = source[7];
  24295. if (value) {
  24296. data[7] = value;
  24297. }
  24298. // Use source `ary` if it's smaller.
  24299. if (srcBitmask & WRAP_ARY_FLAG) {
  24300. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24301. }
  24302. // Use source `arity` if one is not provided.
  24303. if (data[9] == null) {
  24304. data[9] = source[9];
  24305. }
  24306. // Use source `func` and merge bitmasks.
  24307. data[0] = source[0];
  24308. data[1] = newBitmask;
  24309. return data;
  24310. }
  24311. /**
  24312. * This function is like
  24313. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24314. * except that it includes inherited enumerable properties.
  24315. *
  24316. * @private
  24317. * @param {Object} object The object to query.
  24318. * @returns {Array} Returns the array of property names.
  24319. */
  24320. function nativeKeysIn(object) {
  24321. var result = [];
  24322. if (object != null) {
  24323. for (var key in Object(object)) {
  24324. result.push(key);
  24325. }
  24326. }
  24327. return result;
  24328. }
  24329. /**
  24330. * Converts `value` to a string using `Object.prototype.toString`.
  24331. *
  24332. * @private
  24333. * @param {*} value The value to convert.
  24334. * @returns {string} Returns the converted string.
  24335. */
  24336. function objectToString(value) {
  24337. return nativeObjectToString.call(value);
  24338. }
  24339. /**
  24340. * A specialized version of `baseRest` which transforms the rest array.
  24341. *
  24342. * @private
  24343. * @param {Function} func The function to apply a rest parameter to.
  24344. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24345. * @param {Function} transform The rest array transform.
  24346. * @returns {Function} Returns the new function.
  24347. */
  24348. function overRest(func, start, transform) {
  24349. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24350. return function() {
  24351. var args = arguments,
  24352. index = -1,
  24353. length = nativeMax(args.length - start, 0),
  24354. array = Array(length);
  24355. while (++index < length) {
  24356. array[index] = args[start + index];
  24357. }
  24358. index = -1;
  24359. var otherArgs = Array(start + 1);
  24360. while (++index < start) {
  24361. otherArgs[index] = args[index];
  24362. }
  24363. otherArgs[start] = transform(array);
  24364. return apply(func, this, otherArgs);
  24365. };
  24366. }
  24367. /**
  24368. * Gets the parent value at `path` of `object`.
  24369. *
  24370. * @private
  24371. * @param {Object} object The object to query.
  24372. * @param {Array} path The path to get the parent value of.
  24373. * @returns {*} Returns the parent value.
  24374. */
  24375. function parent(object, path) {
  24376. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24377. }
  24378. /**
  24379. * Reorder `array` according to the specified indexes where the element at
  24380. * the first index is assigned as the first element, the element at
  24381. * the second index is assigned as the second element, and so on.
  24382. *
  24383. * @private
  24384. * @param {Array} array The array to reorder.
  24385. * @param {Array} indexes The arranged array indexes.
  24386. * @returns {Array} Returns `array`.
  24387. */
  24388. function reorder(array, indexes) {
  24389. var arrLength = array.length,
  24390. length = nativeMin(indexes.length, arrLength),
  24391. oldArray = copyArray(array);
  24392. while (length--) {
  24393. var index = indexes[length];
  24394. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24395. }
  24396. return array;
  24397. }
  24398. /**
  24399. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24400. *
  24401. * @private
  24402. * @param {Object} object The object to query.
  24403. * @param {string} key The key of the property to get.
  24404. * @returns {*} Returns the property value.
  24405. */
  24406. function safeGet(object, key) {
  24407. if (key === 'constructor' && typeof object[key] === 'function') {
  24408. return;
  24409. }
  24410. if (key == '__proto__') {
  24411. return;
  24412. }
  24413. return object[key];
  24414. }
  24415. /**
  24416. * Sets metadata for `func`.
  24417. *
  24418. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24419. * period of time, it will trip its breaker and transition to an identity
  24420. * function to avoid garbage collection pauses in V8. See
  24421. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24422. * for more details.
  24423. *
  24424. * @private
  24425. * @param {Function} func The function to associate metadata with.
  24426. * @param {*} data The metadata.
  24427. * @returns {Function} Returns `func`.
  24428. */
  24429. var setData = shortOut(baseSetData);
  24430. /**
  24431. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24432. *
  24433. * @private
  24434. * @param {Function} func The function to delay.
  24435. * @param {number} wait The number of milliseconds to delay invocation.
  24436. * @returns {number|Object} Returns the timer id or timeout object.
  24437. */
  24438. var setTimeout = ctxSetTimeout || function(func, wait) {
  24439. return root.setTimeout(func, wait);
  24440. };
  24441. /**
  24442. * Sets the `toString` method of `func` to return `string`.
  24443. *
  24444. * @private
  24445. * @param {Function} func The function to modify.
  24446. * @param {Function} string The `toString` result.
  24447. * @returns {Function} Returns `func`.
  24448. */
  24449. var setToString = shortOut(baseSetToString);
  24450. /**
  24451. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24452. * with wrapper details in a comment at the top of the source body.
  24453. *
  24454. * @private
  24455. * @param {Function} wrapper The function to modify.
  24456. * @param {Function} reference The reference function.
  24457. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24458. * @returns {Function} Returns `wrapper`.
  24459. */
  24460. function setWrapToString(wrapper, reference, bitmask) {
  24461. var source = (reference + '');
  24462. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24463. }
  24464. /**
  24465. * Creates a function that'll short out and invoke `identity` instead
  24466. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24467. * milliseconds.
  24468. *
  24469. * @private
  24470. * @param {Function} func The function to restrict.
  24471. * @returns {Function} Returns the new shortable function.
  24472. */
  24473. function shortOut(func) {
  24474. var count = 0,
  24475. lastCalled = 0;
  24476. return function() {
  24477. var stamp = nativeNow(),
  24478. remaining = HOT_SPAN - (stamp - lastCalled);
  24479. lastCalled = stamp;
  24480. if (remaining > 0) {
  24481. if (++count >= HOT_COUNT) {
  24482. return arguments[0];
  24483. }
  24484. } else {
  24485. count = 0;
  24486. }
  24487. return func.apply(undefined, arguments);
  24488. };
  24489. }
  24490. /**
  24491. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24492. *
  24493. * @private
  24494. * @param {Array} array The array to shuffle.
  24495. * @param {number} [size=array.length] The size of `array`.
  24496. * @returns {Array} Returns `array`.
  24497. */
  24498. function shuffleSelf(array, size) {
  24499. var index = -1,
  24500. length = array.length,
  24501. lastIndex = length - 1;
  24502. size = size === undefined ? length : size;
  24503. while (++index < size) {
  24504. var rand = baseRandom(index, lastIndex),
  24505. value = array[rand];
  24506. array[rand] = array[index];
  24507. array[index] = value;
  24508. }
  24509. array.length = size;
  24510. return array;
  24511. }
  24512. /**
  24513. * Converts `string` to a property path array.
  24514. *
  24515. * @private
  24516. * @param {string} string The string to convert.
  24517. * @returns {Array} Returns the property path array.
  24518. */
  24519. var stringToPath = memoizeCapped(function(string) {
  24520. var result = [];
  24521. if (string.charCodeAt(0) === 46 /* . */) {
  24522. result.push('');
  24523. }
  24524. string.replace(rePropName, function(match, number, quote, subString) {
  24525. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24526. });
  24527. return result;
  24528. });
  24529. /**
  24530. * Converts `value` to a string key if it's not a string or symbol.
  24531. *
  24532. * @private
  24533. * @param {*} value The value to inspect.
  24534. * @returns {string|symbol} Returns the key.
  24535. */
  24536. function toKey(value) {
  24537. if (typeof value == 'string' || isSymbol(value)) {
  24538. return value;
  24539. }
  24540. var result = (value + '');
  24541. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24542. }
  24543. /**
  24544. * Converts `func` to its source code.
  24545. *
  24546. * @private
  24547. * @param {Function} func The function to convert.
  24548. * @returns {string} Returns the source code.
  24549. */
  24550. function toSource(func) {
  24551. if (func != null) {
  24552. try {
  24553. return funcToString.call(func);
  24554. } catch (e) {}
  24555. try {
  24556. return (func + '');
  24557. } catch (e) {}
  24558. }
  24559. return '';
  24560. }
  24561. /**
  24562. * Updates wrapper `details` based on `bitmask` flags.
  24563. *
  24564. * @private
  24565. * @returns {Array} details The details to modify.
  24566. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24567. * @returns {Array} Returns `details`.
  24568. */
  24569. function updateWrapDetails(details, bitmask) {
  24570. arrayEach(wrapFlags, function(pair) {
  24571. var value = '_.' + pair[0];
  24572. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24573. details.push(value);
  24574. }
  24575. });
  24576. return details.sort();
  24577. }
  24578. /**
  24579. * Creates a clone of `wrapper`.
  24580. *
  24581. * @private
  24582. * @param {Object} wrapper The wrapper to clone.
  24583. * @returns {Object} Returns the cloned wrapper.
  24584. */
  24585. function wrapperClone(wrapper) {
  24586. if (wrapper instanceof LazyWrapper) {
  24587. return wrapper.clone();
  24588. }
  24589. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24590. result.__actions__ = copyArray(wrapper.__actions__);
  24591. result.__index__ = wrapper.__index__;
  24592. result.__values__ = wrapper.__values__;
  24593. return result;
  24594. }
  24595. /*------------------------------------------------------------------------*/
  24596. /**
  24597. * Creates an array of elements split into groups the length of `size`.
  24598. * If `array` can't be split evenly, the final chunk will be the remaining
  24599. * elements.
  24600. *
  24601. * @static
  24602. * @memberOf _
  24603. * @since 3.0.0
  24604. * @category Array
  24605. * @param {Array} array The array to process.
  24606. * @param {number} [size=1] The length of each chunk
  24607. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24608. * @returns {Array} Returns the new array of chunks.
  24609. * @example
  24610. *
  24611. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24612. * // => [['a', 'b'], ['c', 'd']]
  24613. *
  24614. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24615. * // => [['a', 'b', 'c'], ['d']]
  24616. */
  24617. function chunk(array, size, guard) {
  24618. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24619. size = 1;
  24620. } else {
  24621. size = nativeMax(toInteger(size), 0);
  24622. }
  24623. var length = array == null ? 0 : array.length;
  24624. if (!length || size < 1) {
  24625. return [];
  24626. }
  24627. var index = 0,
  24628. resIndex = 0,
  24629. result = Array(nativeCeil(length / size));
  24630. while (index < length) {
  24631. result[resIndex++] = baseSlice(array, index, (index += size));
  24632. }
  24633. return result;
  24634. }
  24635. /**
  24636. * Creates an array with all falsey values removed. The values `false`, `null`,
  24637. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24638. *
  24639. * @static
  24640. * @memberOf _
  24641. * @since 0.1.0
  24642. * @category Array
  24643. * @param {Array} array The array to compact.
  24644. * @returns {Array} Returns the new array of filtered values.
  24645. * @example
  24646. *
  24647. * _.compact([0, 1, false, 2, '', 3]);
  24648. * // => [1, 2, 3]
  24649. */
  24650. function compact(array) {
  24651. var index = -1,
  24652. length = array == null ? 0 : array.length,
  24653. resIndex = 0,
  24654. result = [];
  24655. while (++index < length) {
  24656. var value = array[index];
  24657. if (value) {
  24658. result[resIndex++] = value;
  24659. }
  24660. }
  24661. return result;
  24662. }
  24663. /**
  24664. * Creates a new array concatenating `array` with any additional arrays
  24665. * and/or values.
  24666. *
  24667. * @static
  24668. * @memberOf _
  24669. * @since 4.0.0
  24670. * @category Array
  24671. * @param {Array} array The array to concatenate.
  24672. * @param {...*} [values] The values to concatenate.
  24673. * @returns {Array} Returns the new concatenated array.
  24674. * @example
  24675. *
  24676. * var array = [1];
  24677. * var other = _.concat(array, 2, [3], [[4]]);
  24678. *
  24679. * console.log(other);
  24680. * // => [1, 2, 3, [4]]
  24681. *
  24682. * console.log(array);
  24683. * // => [1]
  24684. */
  24685. function concat() {
  24686. var length = arguments.length;
  24687. if (!length) {
  24688. return [];
  24689. }
  24690. var args = Array(length - 1),
  24691. array = arguments[0],
  24692. index = length;
  24693. while (index--) {
  24694. args[index - 1] = arguments[index];
  24695. }
  24696. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24697. }
  24698. /**
  24699. * Creates an array of `array` values not included in the other given arrays
  24700. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24701. * for equality comparisons. The order and references of result values are
  24702. * determined by the first array.
  24703. *
  24704. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24705. *
  24706. * @static
  24707. * @memberOf _
  24708. * @since 0.1.0
  24709. * @category Array
  24710. * @param {Array} array The array to inspect.
  24711. * @param {...Array} [values] The values to exclude.
  24712. * @returns {Array} Returns the new array of filtered values.
  24713. * @see _.without, _.xor
  24714. * @example
  24715. *
  24716. * _.difference([2, 1], [2, 3]);
  24717. * // => [1]
  24718. */
  24719. var difference = baseRest(function(array, values) {
  24720. return isArrayLikeObject(array)
  24721. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24722. : [];
  24723. });
  24724. /**
  24725. * This method is like `_.difference` except that it accepts `iteratee` which
  24726. * is invoked for each element of `array` and `values` to generate the criterion
  24727. * by which they're compared. The order and references of result values are
  24728. * determined by the first array. The iteratee is invoked with one argument:
  24729. * (value).
  24730. *
  24731. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24732. *
  24733. * @static
  24734. * @memberOf _
  24735. * @since 4.0.0
  24736. * @category Array
  24737. * @param {Array} array The array to inspect.
  24738. * @param {...Array} [values] The values to exclude.
  24739. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24740. * @returns {Array} Returns the new array of filtered values.
  24741. * @example
  24742. *
  24743. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24744. * // => [1.2]
  24745. *
  24746. * // The `_.property` iteratee shorthand.
  24747. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24748. * // => [{ 'x': 2 }]
  24749. */
  24750. var differenceBy = baseRest(function(array, values) {
  24751. var iteratee = last(values);
  24752. if (isArrayLikeObject(iteratee)) {
  24753. iteratee = undefined;
  24754. }
  24755. return isArrayLikeObject(array)
  24756. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24757. : [];
  24758. });
  24759. /**
  24760. * This method is like `_.difference` except that it accepts `comparator`
  24761. * which is invoked to compare elements of `array` to `values`. The order and
  24762. * references of result values are determined by the first array. The comparator
  24763. * is invoked with two arguments: (arrVal, othVal).
  24764. *
  24765. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24766. *
  24767. * @static
  24768. * @memberOf _
  24769. * @since 4.0.0
  24770. * @category Array
  24771. * @param {Array} array The array to inspect.
  24772. * @param {...Array} [values] The values to exclude.
  24773. * @param {Function} [comparator] The comparator invoked per element.
  24774. * @returns {Array} Returns the new array of filtered values.
  24775. * @example
  24776. *
  24777. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24778. *
  24779. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24780. * // => [{ 'x': 2, 'y': 1 }]
  24781. */
  24782. var differenceWith = baseRest(function(array, values) {
  24783. var comparator = last(values);
  24784. if (isArrayLikeObject(comparator)) {
  24785. comparator = undefined;
  24786. }
  24787. return isArrayLikeObject(array)
  24788. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24789. : [];
  24790. });
  24791. /**
  24792. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24793. *
  24794. * @static
  24795. * @memberOf _
  24796. * @since 0.5.0
  24797. * @category Array
  24798. * @param {Array} array The array to query.
  24799. * @param {number} [n=1] The number of elements to drop.
  24800. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24801. * @returns {Array} Returns the slice of `array`.
  24802. * @example
  24803. *
  24804. * _.drop([1, 2, 3]);
  24805. * // => [2, 3]
  24806. *
  24807. * _.drop([1, 2, 3], 2);
  24808. * // => [3]
  24809. *
  24810. * _.drop([1, 2, 3], 5);
  24811. * // => []
  24812. *
  24813. * _.drop([1, 2, 3], 0);
  24814. * // => [1, 2, 3]
  24815. */
  24816. function drop(array, n, guard) {
  24817. var length = array == null ? 0 : array.length;
  24818. if (!length) {
  24819. return [];
  24820. }
  24821. n = (guard || n === undefined) ? 1 : toInteger(n);
  24822. return baseSlice(array, n < 0 ? 0 : n, length);
  24823. }
  24824. /**
  24825. * Creates a slice of `array` with `n` elements dropped from the end.
  24826. *
  24827. * @static
  24828. * @memberOf _
  24829. * @since 3.0.0
  24830. * @category Array
  24831. * @param {Array} array The array to query.
  24832. * @param {number} [n=1] The number of elements to drop.
  24833. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24834. * @returns {Array} Returns the slice of `array`.
  24835. * @example
  24836. *
  24837. * _.dropRight([1, 2, 3]);
  24838. * // => [1, 2]
  24839. *
  24840. * _.dropRight([1, 2, 3], 2);
  24841. * // => [1]
  24842. *
  24843. * _.dropRight([1, 2, 3], 5);
  24844. * // => []
  24845. *
  24846. * _.dropRight([1, 2, 3], 0);
  24847. * // => [1, 2, 3]
  24848. */
  24849. function dropRight(array, n, guard) {
  24850. var length = array == null ? 0 : array.length;
  24851. if (!length) {
  24852. return [];
  24853. }
  24854. n = (guard || n === undefined) ? 1 : toInteger(n);
  24855. n = length - n;
  24856. return baseSlice(array, 0, n < 0 ? 0 : n);
  24857. }
  24858. /**
  24859. * Creates a slice of `array` excluding elements dropped from the end.
  24860. * Elements are dropped until `predicate` returns falsey. The predicate is
  24861. * invoked with three arguments: (value, index, array).
  24862. *
  24863. * @static
  24864. * @memberOf _
  24865. * @since 3.0.0
  24866. * @category Array
  24867. * @param {Array} array The array to query.
  24868. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24869. * @returns {Array} Returns the slice of `array`.
  24870. * @example
  24871. *
  24872. * var users = [
  24873. * { 'user': 'barney', 'active': true },
  24874. * { 'user': 'fred', 'active': false },
  24875. * { 'user': 'pebbles', 'active': false }
  24876. * ];
  24877. *
  24878. * _.dropRightWhile(users, function(o) { return !o.active; });
  24879. * // => objects for ['barney']
  24880. *
  24881. * // The `_.matches` iteratee shorthand.
  24882. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24883. * // => objects for ['barney', 'fred']
  24884. *
  24885. * // The `_.matchesProperty` iteratee shorthand.
  24886. * _.dropRightWhile(users, ['active', false]);
  24887. * // => objects for ['barney']
  24888. *
  24889. * // The `_.property` iteratee shorthand.
  24890. * _.dropRightWhile(users, 'active');
  24891. * // => objects for ['barney', 'fred', 'pebbles']
  24892. */
  24893. function dropRightWhile(array, predicate) {
  24894. return (array && array.length)
  24895. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24896. : [];
  24897. }
  24898. /**
  24899. * Creates a slice of `array` excluding elements dropped from the beginning.
  24900. * Elements are dropped until `predicate` returns falsey. The predicate is
  24901. * invoked with three arguments: (value, index, array).
  24902. *
  24903. * @static
  24904. * @memberOf _
  24905. * @since 3.0.0
  24906. * @category Array
  24907. * @param {Array} array The array to query.
  24908. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24909. * @returns {Array} Returns the slice of `array`.
  24910. * @example
  24911. *
  24912. * var users = [
  24913. * { 'user': 'barney', 'active': false },
  24914. * { 'user': 'fred', 'active': false },
  24915. * { 'user': 'pebbles', 'active': true }
  24916. * ];
  24917. *
  24918. * _.dropWhile(users, function(o) { return !o.active; });
  24919. * // => objects for ['pebbles']
  24920. *
  24921. * // The `_.matches` iteratee shorthand.
  24922. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24923. * // => objects for ['fred', 'pebbles']
  24924. *
  24925. * // The `_.matchesProperty` iteratee shorthand.
  24926. * _.dropWhile(users, ['active', false]);
  24927. * // => objects for ['pebbles']
  24928. *
  24929. * // The `_.property` iteratee shorthand.
  24930. * _.dropWhile(users, 'active');
  24931. * // => objects for ['barney', 'fred', 'pebbles']
  24932. */
  24933. function dropWhile(array, predicate) {
  24934. return (array && array.length)
  24935. ? baseWhile(array, getIteratee(predicate, 3), true)
  24936. : [];
  24937. }
  24938. /**
  24939. * Fills elements of `array` with `value` from `start` up to, but not
  24940. * including, `end`.
  24941. *
  24942. * **Note:** This method mutates `array`.
  24943. *
  24944. * @static
  24945. * @memberOf _
  24946. * @since 3.2.0
  24947. * @category Array
  24948. * @param {Array} array The array to fill.
  24949. * @param {*} value The value to fill `array` with.
  24950. * @param {number} [start=0] The start position.
  24951. * @param {number} [end=array.length] The end position.
  24952. * @returns {Array} Returns `array`.
  24953. * @example
  24954. *
  24955. * var array = [1, 2, 3];
  24956. *
  24957. * _.fill(array, 'a');
  24958. * console.log(array);
  24959. * // => ['a', 'a', 'a']
  24960. *
  24961. * _.fill(Array(3), 2);
  24962. * // => [2, 2, 2]
  24963. *
  24964. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24965. * // => [4, '*', '*', 10]
  24966. */
  24967. function fill(array, value, start, end) {
  24968. var length = array == null ? 0 : array.length;
  24969. if (!length) {
  24970. return [];
  24971. }
  24972. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24973. start = 0;
  24974. end = length;
  24975. }
  24976. return baseFill(array, value, start, end);
  24977. }
  24978. /**
  24979. * This method is like `_.find` except that it returns the index of the first
  24980. * element `predicate` returns truthy for instead of the element itself.
  24981. *
  24982. * @static
  24983. * @memberOf _
  24984. * @since 1.1.0
  24985. * @category Array
  24986. * @param {Array} array The array to inspect.
  24987. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24988. * @param {number} [fromIndex=0] The index to search from.
  24989. * @returns {number} Returns the index of the found element, else `-1`.
  24990. * @example
  24991. *
  24992. * var users = [
  24993. * { 'user': 'barney', 'active': false },
  24994. * { 'user': 'fred', 'active': false },
  24995. * { 'user': 'pebbles', 'active': true }
  24996. * ];
  24997. *
  24998. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24999. * // => 0
  25000. *
  25001. * // The `_.matches` iteratee shorthand.
  25002. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25003. * // => 1
  25004. *
  25005. * // The `_.matchesProperty` iteratee shorthand.
  25006. * _.findIndex(users, ['active', false]);
  25007. * // => 0
  25008. *
  25009. * // The `_.property` iteratee shorthand.
  25010. * _.findIndex(users, 'active');
  25011. * // => 2
  25012. */
  25013. function findIndex(array, predicate, fromIndex) {
  25014. var length = array == null ? 0 : array.length;
  25015. if (!length) {
  25016. return -1;
  25017. }
  25018. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25019. if (index < 0) {
  25020. index = nativeMax(length + index, 0);
  25021. }
  25022. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25023. }
  25024. /**
  25025. * This method is like `_.findIndex` except that it iterates over elements
  25026. * of `collection` from right to left.
  25027. *
  25028. * @static
  25029. * @memberOf _
  25030. * @since 2.0.0
  25031. * @category Array
  25032. * @param {Array} array The array to inspect.
  25033. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25034. * @param {number} [fromIndex=array.length-1] The index to search from.
  25035. * @returns {number} Returns the index of the found element, else `-1`.
  25036. * @example
  25037. *
  25038. * var users = [
  25039. * { 'user': 'barney', 'active': true },
  25040. * { 'user': 'fred', 'active': false },
  25041. * { 'user': 'pebbles', 'active': false }
  25042. * ];
  25043. *
  25044. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25045. * // => 2
  25046. *
  25047. * // The `_.matches` iteratee shorthand.
  25048. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25049. * // => 0
  25050. *
  25051. * // The `_.matchesProperty` iteratee shorthand.
  25052. * _.findLastIndex(users, ['active', false]);
  25053. * // => 2
  25054. *
  25055. * // The `_.property` iteratee shorthand.
  25056. * _.findLastIndex(users, 'active');
  25057. * // => 0
  25058. */
  25059. function findLastIndex(array, predicate, fromIndex) {
  25060. var length = array == null ? 0 : array.length;
  25061. if (!length) {
  25062. return -1;
  25063. }
  25064. var index = length - 1;
  25065. if (fromIndex !== undefined) {
  25066. index = toInteger(fromIndex);
  25067. index = fromIndex < 0
  25068. ? nativeMax(length + index, 0)
  25069. : nativeMin(index, length - 1);
  25070. }
  25071. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25072. }
  25073. /**
  25074. * Flattens `array` a single level deep.
  25075. *
  25076. * @static
  25077. * @memberOf _
  25078. * @since 0.1.0
  25079. * @category Array
  25080. * @param {Array} array The array to flatten.
  25081. * @returns {Array} Returns the new flattened array.
  25082. * @example
  25083. *
  25084. * _.flatten([1, [2, [3, [4]], 5]]);
  25085. * // => [1, 2, [3, [4]], 5]
  25086. */
  25087. function flatten(array) {
  25088. var length = array == null ? 0 : array.length;
  25089. return length ? baseFlatten(array, 1) : [];
  25090. }
  25091. /**
  25092. * Recursively flattens `array`.
  25093. *
  25094. * @static
  25095. * @memberOf _
  25096. * @since 3.0.0
  25097. * @category Array
  25098. * @param {Array} array The array to flatten.
  25099. * @returns {Array} Returns the new flattened array.
  25100. * @example
  25101. *
  25102. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25103. * // => [1, 2, 3, 4, 5]
  25104. */
  25105. function flattenDeep(array) {
  25106. var length = array == null ? 0 : array.length;
  25107. return length ? baseFlatten(array, INFINITY) : [];
  25108. }
  25109. /**
  25110. * Recursively flatten `array` up to `depth` times.
  25111. *
  25112. * @static
  25113. * @memberOf _
  25114. * @since 4.4.0
  25115. * @category Array
  25116. * @param {Array} array The array to flatten.
  25117. * @param {number} [depth=1] The maximum recursion depth.
  25118. * @returns {Array} Returns the new flattened array.
  25119. * @example
  25120. *
  25121. * var array = [1, [2, [3, [4]], 5]];
  25122. *
  25123. * _.flattenDepth(array, 1);
  25124. * // => [1, 2, [3, [4]], 5]
  25125. *
  25126. * _.flattenDepth(array, 2);
  25127. * // => [1, 2, 3, [4], 5]
  25128. */
  25129. function flattenDepth(array, depth) {
  25130. var length = array == null ? 0 : array.length;
  25131. if (!length) {
  25132. return [];
  25133. }
  25134. depth = depth === undefined ? 1 : toInteger(depth);
  25135. return baseFlatten(array, depth);
  25136. }
  25137. /**
  25138. * The inverse of `_.toPairs`; this method returns an object composed
  25139. * from key-value `pairs`.
  25140. *
  25141. * @static
  25142. * @memberOf _
  25143. * @since 4.0.0
  25144. * @category Array
  25145. * @param {Array} pairs The key-value pairs.
  25146. * @returns {Object} Returns the new object.
  25147. * @example
  25148. *
  25149. * _.fromPairs([['a', 1], ['b', 2]]);
  25150. * // => { 'a': 1, 'b': 2 }
  25151. */
  25152. function fromPairs(pairs) {
  25153. var index = -1,
  25154. length = pairs == null ? 0 : pairs.length,
  25155. result = {};
  25156. while (++index < length) {
  25157. var pair = pairs[index];
  25158. result[pair[0]] = pair[1];
  25159. }
  25160. return result;
  25161. }
  25162. /**
  25163. * Gets the first element of `array`.
  25164. *
  25165. * @static
  25166. * @memberOf _
  25167. * @since 0.1.0
  25168. * @alias first
  25169. * @category Array
  25170. * @param {Array} array The array to query.
  25171. * @returns {*} Returns the first element of `array`.
  25172. * @example
  25173. *
  25174. * _.head([1, 2, 3]);
  25175. * // => 1
  25176. *
  25177. * _.head([]);
  25178. * // => undefined
  25179. */
  25180. function head(array) {
  25181. return (array && array.length) ? array[0] : undefined;
  25182. }
  25183. /**
  25184. * Gets the index at which the first occurrence of `value` is found in `array`
  25185. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25186. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25187. * offset from the end of `array`.
  25188. *
  25189. * @static
  25190. * @memberOf _
  25191. * @since 0.1.0
  25192. * @category Array
  25193. * @param {Array} array The array to inspect.
  25194. * @param {*} value The value to search for.
  25195. * @param {number} [fromIndex=0] The index to search from.
  25196. * @returns {number} Returns the index of the matched value, else `-1`.
  25197. * @example
  25198. *
  25199. * _.indexOf([1, 2, 1, 2], 2);
  25200. * // => 1
  25201. *
  25202. * // Search from the `fromIndex`.
  25203. * _.indexOf([1, 2, 1, 2], 2, 2);
  25204. * // => 3
  25205. */
  25206. function indexOf(array, value, fromIndex) {
  25207. var length = array == null ? 0 : array.length;
  25208. if (!length) {
  25209. return -1;
  25210. }
  25211. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25212. if (index < 0) {
  25213. index = nativeMax(length + index, 0);
  25214. }
  25215. return baseIndexOf(array, value, index);
  25216. }
  25217. /**
  25218. * Gets all but the last element of `array`.
  25219. *
  25220. * @static
  25221. * @memberOf _
  25222. * @since 0.1.0
  25223. * @category Array
  25224. * @param {Array} array The array to query.
  25225. * @returns {Array} Returns the slice of `array`.
  25226. * @example
  25227. *
  25228. * _.initial([1, 2, 3]);
  25229. * // => [1, 2]
  25230. */
  25231. function initial(array) {
  25232. var length = array == null ? 0 : array.length;
  25233. return length ? baseSlice(array, 0, -1) : [];
  25234. }
  25235. /**
  25236. * Creates an array of unique values that are included in all given arrays
  25237. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25238. * for equality comparisons. The order and references of result values are
  25239. * determined by the first array.
  25240. *
  25241. * @static
  25242. * @memberOf _
  25243. * @since 0.1.0
  25244. * @category Array
  25245. * @param {...Array} [arrays] The arrays to inspect.
  25246. * @returns {Array} Returns the new array of intersecting values.
  25247. * @example
  25248. *
  25249. * _.intersection([2, 1], [2, 3]);
  25250. * // => [2]
  25251. */
  25252. var intersection = baseRest(function(arrays) {
  25253. var mapped = arrayMap(arrays, castArrayLikeObject);
  25254. return (mapped.length && mapped[0] === arrays[0])
  25255. ? baseIntersection(mapped)
  25256. : [];
  25257. });
  25258. /**
  25259. * This method is like `_.intersection` except that it accepts `iteratee`
  25260. * which is invoked for each element of each `arrays` to generate the criterion
  25261. * by which they're compared. The order and references of result values are
  25262. * determined by the first array. The iteratee is invoked with one argument:
  25263. * (value).
  25264. *
  25265. * @static
  25266. * @memberOf _
  25267. * @since 4.0.0
  25268. * @category Array
  25269. * @param {...Array} [arrays] The arrays to inspect.
  25270. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25271. * @returns {Array} Returns the new array of intersecting values.
  25272. * @example
  25273. *
  25274. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25275. * // => [2.1]
  25276. *
  25277. * // The `_.property` iteratee shorthand.
  25278. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25279. * // => [{ 'x': 1 }]
  25280. */
  25281. var intersectionBy = baseRest(function(arrays) {
  25282. var iteratee = last(arrays),
  25283. mapped = arrayMap(arrays, castArrayLikeObject);
  25284. if (iteratee === last(mapped)) {
  25285. iteratee = undefined;
  25286. } else {
  25287. mapped.pop();
  25288. }
  25289. return (mapped.length && mapped[0] === arrays[0])
  25290. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25291. : [];
  25292. });
  25293. /**
  25294. * This method is like `_.intersection` except that it accepts `comparator`
  25295. * which is invoked to compare elements of `arrays`. The order and references
  25296. * of result values are determined by the first array. The comparator is
  25297. * invoked with two arguments: (arrVal, othVal).
  25298. *
  25299. * @static
  25300. * @memberOf _
  25301. * @since 4.0.0
  25302. * @category Array
  25303. * @param {...Array} [arrays] The arrays to inspect.
  25304. * @param {Function} [comparator] The comparator invoked per element.
  25305. * @returns {Array} Returns the new array of intersecting values.
  25306. * @example
  25307. *
  25308. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25309. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25310. *
  25311. * _.intersectionWith(objects, others, _.isEqual);
  25312. * // => [{ 'x': 1, 'y': 2 }]
  25313. */
  25314. var intersectionWith = baseRest(function(arrays) {
  25315. var comparator = last(arrays),
  25316. mapped = arrayMap(arrays, castArrayLikeObject);
  25317. comparator = typeof comparator == 'function' ? comparator : undefined;
  25318. if (comparator) {
  25319. mapped.pop();
  25320. }
  25321. return (mapped.length && mapped[0] === arrays[0])
  25322. ? baseIntersection(mapped, undefined, comparator)
  25323. : [];
  25324. });
  25325. /**
  25326. * Converts all elements in `array` into a string separated by `separator`.
  25327. *
  25328. * @static
  25329. * @memberOf _
  25330. * @since 4.0.0
  25331. * @category Array
  25332. * @param {Array} array The array to convert.
  25333. * @param {string} [separator=','] The element separator.
  25334. * @returns {string} Returns the joined string.
  25335. * @example
  25336. *
  25337. * _.join(['a', 'b', 'c'], '~');
  25338. * // => 'a~b~c'
  25339. */
  25340. function join(array, separator) {
  25341. return array == null ? '' : nativeJoin.call(array, separator);
  25342. }
  25343. /**
  25344. * Gets the last element of `array`.
  25345. *
  25346. * @static
  25347. * @memberOf _
  25348. * @since 0.1.0
  25349. * @category Array
  25350. * @param {Array} array The array to query.
  25351. * @returns {*} Returns the last element of `array`.
  25352. * @example
  25353. *
  25354. * _.last([1, 2, 3]);
  25355. * // => 3
  25356. */
  25357. function last(array) {
  25358. var length = array == null ? 0 : array.length;
  25359. return length ? array[length - 1] : undefined;
  25360. }
  25361. /**
  25362. * This method is like `_.indexOf` except that it iterates over elements of
  25363. * `array` from right to left.
  25364. *
  25365. * @static
  25366. * @memberOf _
  25367. * @since 0.1.0
  25368. * @category Array
  25369. * @param {Array} array The array to inspect.
  25370. * @param {*} value The value to search for.
  25371. * @param {number} [fromIndex=array.length-1] The index to search from.
  25372. * @returns {number} Returns the index of the matched value, else `-1`.
  25373. * @example
  25374. *
  25375. * _.lastIndexOf([1, 2, 1, 2], 2);
  25376. * // => 3
  25377. *
  25378. * // Search from the `fromIndex`.
  25379. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25380. * // => 1
  25381. */
  25382. function lastIndexOf(array, value, fromIndex) {
  25383. var length = array == null ? 0 : array.length;
  25384. if (!length) {
  25385. return -1;
  25386. }
  25387. var index = length;
  25388. if (fromIndex !== undefined) {
  25389. index = toInteger(fromIndex);
  25390. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25391. }
  25392. return value === value
  25393. ? strictLastIndexOf(array, value, index)
  25394. : baseFindIndex(array, baseIsNaN, index, true);
  25395. }
  25396. /**
  25397. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25398. * element from the end is returned.
  25399. *
  25400. * @static
  25401. * @memberOf _
  25402. * @since 4.11.0
  25403. * @category Array
  25404. * @param {Array} array The array to query.
  25405. * @param {number} [n=0] The index of the element to return.
  25406. * @returns {*} Returns the nth element of `array`.
  25407. * @example
  25408. *
  25409. * var array = ['a', 'b', 'c', 'd'];
  25410. *
  25411. * _.nth(array, 1);
  25412. * // => 'b'
  25413. *
  25414. * _.nth(array, -2);
  25415. * // => 'c';
  25416. */
  25417. function nth(array, n) {
  25418. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25419. }
  25420. /**
  25421. * Removes all given values from `array` using
  25422. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25423. * for equality comparisons.
  25424. *
  25425. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25426. * to remove elements from an array by predicate.
  25427. *
  25428. * @static
  25429. * @memberOf _
  25430. * @since 2.0.0
  25431. * @category Array
  25432. * @param {Array} array The array to modify.
  25433. * @param {...*} [values] The values to remove.
  25434. * @returns {Array} Returns `array`.
  25435. * @example
  25436. *
  25437. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25438. *
  25439. * _.pull(array, 'a', 'c');
  25440. * console.log(array);
  25441. * // => ['b', 'b']
  25442. */
  25443. var pull = baseRest(pullAll);
  25444. /**
  25445. * This method is like `_.pull` except that it accepts an array of values to remove.
  25446. *
  25447. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25448. *
  25449. * @static
  25450. * @memberOf _
  25451. * @since 4.0.0
  25452. * @category Array
  25453. * @param {Array} array The array to modify.
  25454. * @param {Array} values The values to remove.
  25455. * @returns {Array} Returns `array`.
  25456. * @example
  25457. *
  25458. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25459. *
  25460. * _.pullAll(array, ['a', 'c']);
  25461. * console.log(array);
  25462. * // => ['b', 'b']
  25463. */
  25464. function pullAll(array, values) {
  25465. return (array && array.length && values && values.length)
  25466. ? basePullAll(array, values)
  25467. : array;
  25468. }
  25469. /**
  25470. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25471. * invoked for each element of `array` and `values` to generate the criterion
  25472. * by which they're compared. The iteratee is invoked with one argument: (value).
  25473. *
  25474. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25475. *
  25476. * @static
  25477. * @memberOf _
  25478. * @since 4.0.0
  25479. * @category Array
  25480. * @param {Array} array The array to modify.
  25481. * @param {Array} values The values to remove.
  25482. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25483. * @returns {Array} Returns `array`.
  25484. * @example
  25485. *
  25486. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25487. *
  25488. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25489. * console.log(array);
  25490. * // => [{ 'x': 2 }]
  25491. */
  25492. function pullAllBy(array, values, iteratee) {
  25493. return (array && array.length && values && values.length)
  25494. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25495. : array;
  25496. }
  25497. /**
  25498. * This method is like `_.pullAll` except that it accepts `comparator` which
  25499. * is invoked to compare elements of `array` to `values`. The comparator is
  25500. * invoked with two arguments: (arrVal, othVal).
  25501. *
  25502. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25503. *
  25504. * @static
  25505. * @memberOf _
  25506. * @since 4.6.0
  25507. * @category Array
  25508. * @param {Array} array The array to modify.
  25509. * @param {Array} values The values to remove.
  25510. * @param {Function} [comparator] The comparator invoked per element.
  25511. * @returns {Array} Returns `array`.
  25512. * @example
  25513. *
  25514. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25515. *
  25516. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25517. * console.log(array);
  25518. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25519. */
  25520. function pullAllWith(array, values, comparator) {
  25521. return (array && array.length && values && values.length)
  25522. ? basePullAll(array, values, undefined, comparator)
  25523. : array;
  25524. }
  25525. /**
  25526. * Removes elements from `array` corresponding to `indexes` and returns an
  25527. * array of removed elements.
  25528. *
  25529. * **Note:** Unlike `_.at`, this method mutates `array`.
  25530. *
  25531. * @static
  25532. * @memberOf _
  25533. * @since 3.0.0
  25534. * @category Array
  25535. * @param {Array} array The array to modify.
  25536. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25537. * @returns {Array} Returns the new array of removed elements.
  25538. * @example
  25539. *
  25540. * var array = ['a', 'b', 'c', 'd'];
  25541. * var pulled = _.pullAt(array, [1, 3]);
  25542. *
  25543. * console.log(array);
  25544. * // => ['a', 'c']
  25545. *
  25546. * console.log(pulled);
  25547. * // => ['b', 'd']
  25548. */
  25549. var pullAt = flatRest(function(array, indexes) {
  25550. var length = array == null ? 0 : array.length,
  25551. result = baseAt(array, indexes);
  25552. basePullAt(array, arrayMap(indexes, function(index) {
  25553. return isIndex(index, length) ? +index : index;
  25554. }).sort(compareAscending));
  25555. return result;
  25556. });
  25557. /**
  25558. * Removes all elements from `array` that `predicate` returns truthy for
  25559. * and returns an array of the removed elements. The predicate is invoked
  25560. * with three arguments: (value, index, array).
  25561. *
  25562. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25563. * to pull elements from an array by value.
  25564. *
  25565. * @static
  25566. * @memberOf _
  25567. * @since 2.0.0
  25568. * @category Array
  25569. * @param {Array} array The array to modify.
  25570. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25571. * @returns {Array} Returns the new array of removed elements.
  25572. * @example
  25573. *
  25574. * var array = [1, 2, 3, 4];
  25575. * var evens = _.remove(array, function(n) {
  25576. * return n % 2 == 0;
  25577. * });
  25578. *
  25579. * console.log(array);
  25580. * // => [1, 3]
  25581. *
  25582. * console.log(evens);
  25583. * // => [2, 4]
  25584. */
  25585. function remove(array, predicate) {
  25586. var result = [];
  25587. if (!(array && array.length)) {
  25588. return result;
  25589. }
  25590. var index = -1,
  25591. indexes = [],
  25592. length = array.length;
  25593. predicate = getIteratee(predicate, 3);
  25594. while (++index < length) {
  25595. var value = array[index];
  25596. if (predicate(value, index, array)) {
  25597. result.push(value);
  25598. indexes.push(index);
  25599. }
  25600. }
  25601. basePullAt(array, indexes);
  25602. return result;
  25603. }
  25604. /**
  25605. * Reverses `array` so that the first element becomes the last, the second
  25606. * element becomes the second to last, and so on.
  25607. *
  25608. * **Note:** This method mutates `array` and is based on
  25609. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25610. *
  25611. * @static
  25612. * @memberOf _
  25613. * @since 4.0.0
  25614. * @category Array
  25615. * @param {Array} array The array to modify.
  25616. * @returns {Array} Returns `array`.
  25617. * @example
  25618. *
  25619. * var array = [1, 2, 3];
  25620. *
  25621. * _.reverse(array);
  25622. * // => [3, 2, 1]
  25623. *
  25624. * console.log(array);
  25625. * // => [3, 2, 1]
  25626. */
  25627. function reverse(array) {
  25628. return array == null ? array : nativeReverse.call(array);
  25629. }
  25630. /**
  25631. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25632. *
  25633. * **Note:** This method is used instead of
  25634. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25635. * returned.
  25636. *
  25637. * @static
  25638. * @memberOf _
  25639. * @since 3.0.0
  25640. * @category Array
  25641. * @param {Array} array The array to slice.
  25642. * @param {number} [start=0] The start position.
  25643. * @param {number} [end=array.length] The end position.
  25644. * @returns {Array} Returns the slice of `array`.
  25645. */
  25646. function slice(array, start, end) {
  25647. var length = array == null ? 0 : array.length;
  25648. if (!length) {
  25649. return [];
  25650. }
  25651. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25652. start = 0;
  25653. end = length;
  25654. }
  25655. else {
  25656. start = start == null ? 0 : toInteger(start);
  25657. end = end === undefined ? length : toInteger(end);
  25658. }
  25659. return baseSlice(array, start, end);
  25660. }
  25661. /**
  25662. * Uses a binary search to determine the lowest index at which `value`
  25663. * should be inserted into `array` in order to maintain its sort order.
  25664. *
  25665. * @static
  25666. * @memberOf _
  25667. * @since 0.1.0
  25668. * @category Array
  25669. * @param {Array} array The sorted array to inspect.
  25670. * @param {*} value The value to evaluate.
  25671. * @returns {number} Returns the index at which `value` should be inserted
  25672. * into `array`.
  25673. * @example
  25674. *
  25675. * _.sortedIndex([30, 50], 40);
  25676. * // => 1
  25677. */
  25678. function sortedIndex(array, value) {
  25679. return baseSortedIndex(array, value);
  25680. }
  25681. /**
  25682. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25683. * which is invoked for `value` and each element of `array` to compute their
  25684. * sort ranking. The iteratee is invoked with one argument: (value).
  25685. *
  25686. * @static
  25687. * @memberOf _
  25688. * @since 4.0.0
  25689. * @category Array
  25690. * @param {Array} array The sorted array to inspect.
  25691. * @param {*} value The value to evaluate.
  25692. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25693. * @returns {number} Returns the index at which `value` should be inserted
  25694. * into `array`.
  25695. * @example
  25696. *
  25697. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25698. *
  25699. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25700. * // => 0
  25701. *
  25702. * // The `_.property` iteratee shorthand.
  25703. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25704. * // => 0
  25705. */
  25706. function sortedIndexBy(array, value, iteratee) {
  25707. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25708. }
  25709. /**
  25710. * This method is like `_.indexOf` except that it performs a binary
  25711. * search on a sorted `array`.
  25712. *
  25713. * @static
  25714. * @memberOf _
  25715. * @since 4.0.0
  25716. * @category Array
  25717. * @param {Array} array The array to inspect.
  25718. * @param {*} value The value to search for.
  25719. * @returns {number} Returns the index of the matched value, else `-1`.
  25720. * @example
  25721. *
  25722. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25723. * // => 1
  25724. */
  25725. function sortedIndexOf(array, value) {
  25726. var length = array == null ? 0 : array.length;
  25727. if (length) {
  25728. var index = baseSortedIndex(array, value);
  25729. if (index < length && eq(array[index], value)) {
  25730. return index;
  25731. }
  25732. }
  25733. return -1;
  25734. }
  25735. /**
  25736. * This method is like `_.sortedIndex` except that it returns the highest
  25737. * index at which `value` should be inserted into `array` in order to
  25738. * maintain its sort order.
  25739. *
  25740. * @static
  25741. * @memberOf _
  25742. * @since 3.0.0
  25743. * @category Array
  25744. * @param {Array} array The sorted array to inspect.
  25745. * @param {*} value The value to evaluate.
  25746. * @returns {number} Returns the index at which `value` should be inserted
  25747. * into `array`.
  25748. * @example
  25749. *
  25750. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25751. * // => 4
  25752. */
  25753. function sortedLastIndex(array, value) {
  25754. return baseSortedIndex(array, value, true);
  25755. }
  25756. /**
  25757. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25758. * which is invoked for `value` and each element of `array` to compute their
  25759. * sort ranking. The iteratee is invoked with one argument: (value).
  25760. *
  25761. * @static
  25762. * @memberOf _
  25763. * @since 4.0.0
  25764. * @category Array
  25765. * @param {Array} array The sorted array to inspect.
  25766. * @param {*} value The value to evaluate.
  25767. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25768. * @returns {number} Returns the index at which `value` should be inserted
  25769. * into `array`.
  25770. * @example
  25771. *
  25772. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25773. *
  25774. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25775. * // => 1
  25776. *
  25777. * // The `_.property` iteratee shorthand.
  25778. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25779. * // => 1
  25780. */
  25781. function sortedLastIndexBy(array, value, iteratee) {
  25782. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25783. }
  25784. /**
  25785. * This method is like `_.lastIndexOf` except that it performs a binary
  25786. * search on a sorted `array`.
  25787. *
  25788. * @static
  25789. * @memberOf _
  25790. * @since 4.0.0
  25791. * @category Array
  25792. * @param {Array} array The array to inspect.
  25793. * @param {*} value The value to search for.
  25794. * @returns {number} Returns the index of the matched value, else `-1`.
  25795. * @example
  25796. *
  25797. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25798. * // => 3
  25799. */
  25800. function sortedLastIndexOf(array, value) {
  25801. var length = array == null ? 0 : array.length;
  25802. if (length) {
  25803. var index = baseSortedIndex(array, value, true) - 1;
  25804. if (eq(array[index], value)) {
  25805. return index;
  25806. }
  25807. }
  25808. return -1;
  25809. }
  25810. /**
  25811. * This method is like `_.uniq` except that it's designed and optimized
  25812. * for sorted arrays.
  25813. *
  25814. * @static
  25815. * @memberOf _
  25816. * @since 4.0.0
  25817. * @category Array
  25818. * @param {Array} array The array to inspect.
  25819. * @returns {Array} Returns the new duplicate free array.
  25820. * @example
  25821. *
  25822. * _.sortedUniq([1, 1, 2]);
  25823. * // => [1, 2]
  25824. */
  25825. function sortedUniq(array) {
  25826. return (array && array.length)
  25827. ? baseSortedUniq(array)
  25828. : [];
  25829. }
  25830. /**
  25831. * This method is like `_.uniqBy` except that it's designed and optimized
  25832. * for sorted arrays.
  25833. *
  25834. * @static
  25835. * @memberOf _
  25836. * @since 4.0.0
  25837. * @category Array
  25838. * @param {Array} array The array to inspect.
  25839. * @param {Function} [iteratee] The iteratee invoked per element.
  25840. * @returns {Array} Returns the new duplicate free array.
  25841. * @example
  25842. *
  25843. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25844. * // => [1.1, 2.3]
  25845. */
  25846. function sortedUniqBy(array, iteratee) {
  25847. return (array && array.length)
  25848. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25849. : [];
  25850. }
  25851. /**
  25852. * Gets all but the first element of `array`.
  25853. *
  25854. * @static
  25855. * @memberOf _
  25856. * @since 4.0.0
  25857. * @category Array
  25858. * @param {Array} array The array to query.
  25859. * @returns {Array} Returns the slice of `array`.
  25860. * @example
  25861. *
  25862. * _.tail([1, 2, 3]);
  25863. * // => [2, 3]
  25864. */
  25865. function tail(array) {
  25866. var length = array == null ? 0 : array.length;
  25867. return length ? baseSlice(array, 1, length) : [];
  25868. }
  25869. /**
  25870. * Creates a slice of `array` with `n` elements taken from the beginning.
  25871. *
  25872. * @static
  25873. * @memberOf _
  25874. * @since 0.1.0
  25875. * @category Array
  25876. * @param {Array} array The array to query.
  25877. * @param {number} [n=1] The number of elements to take.
  25878. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25879. * @returns {Array} Returns the slice of `array`.
  25880. * @example
  25881. *
  25882. * _.take([1, 2, 3]);
  25883. * // => [1]
  25884. *
  25885. * _.take([1, 2, 3], 2);
  25886. * // => [1, 2]
  25887. *
  25888. * _.take([1, 2, 3], 5);
  25889. * // => [1, 2, 3]
  25890. *
  25891. * _.take([1, 2, 3], 0);
  25892. * // => []
  25893. */
  25894. function take(array, n, guard) {
  25895. if (!(array && array.length)) {
  25896. return [];
  25897. }
  25898. n = (guard || n === undefined) ? 1 : toInteger(n);
  25899. return baseSlice(array, 0, n < 0 ? 0 : n);
  25900. }
  25901. /**
  25902. * Creates a slice of `array` with `n` elements taken from the end.
  25903. *
  25904. * @static
  25905. * @memberOf _
  25906. * @since 3.0.0
  25907. * @category Array
  25908. * @param {Array} array The array to query.
  25909. * @param {number} [n=1] The number of elements to take.
  25910. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25911. * @returns {Array} Returns the slice of `array`.
  25912. * @example
  25913. *
  25914. * _.takeRight([1, 2, 3]);
  25915. * // => [3]
  25916. *
  25917. * _.takeRight([1, 2, 3], 2);
  25918. * // => [2, 3]
  25919. *
  25920. * _.takeRight([1, 2, 3], 5);
  25921. * // => [1, 2, 3]
  25922. *
  25923. * _.takeRight([1, 2, 3], 0);
  25924. * // => []
  25925. */
  25926. function takeRight(array, n, guard) {
  25927. var length = array == null ? 0 : array.length;
  25928. if (!length) {
  25929. return [];
  25930. }
  25931. n = (guard || n === undefined) ? 1 : toInteger(n);
  25932. n = length - n;
  25933. return baseSlice(array, n < 0 ? 0 : n, length);
  25934. }
  25935. /**
  25936. * Creates a slice of `array` with elements taken from the end. Elements are
  25937. * taken until `predicate` returns falsey. The predicate is invoked with
  25938. * three arguments: (value, index, array).
  25939. *
  25940. * @static
  25941. * @memberOf _
  25942. * @since 3.0.0
  25943. * @category Array
  25944. * @param {Array} array The array to query.
  25945. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25946. * @returns {Array} Returns the slice of `array`.
  25947. * @example
  25948. *
  25949. * var users = [
  25950. * { 'user': 'barney', 'active': true },
  25951. * { 'user': 'fred', 'active': false },
  25952. * { 'user': 'pebbles', 'active': false }
  25953. * ];
  25954. *
  25955. * _.takeRightWhile(users, function(o) { return !o.active; });
  25956. * // => objects for ['fred', 'pebbles']
  25957. *
  25958. * // The `_.matches` iteratee shorthand.
  25959. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25960. * // => objects for ['pebbles']
  25961. *
  25962. * // The `_.matchesProperty` iteratee shorthand.
  25963. * _.takeRightWhile(users, ['active', false]);
  25964. * // => objects for ['fred', 'pebbles']
  25965. *
  25966. * // The `_.property` iteratee shorthand.
  25967. * _.takeRightWhile(users, 'active');
  25968. * // => []
  25969. */
  25970. function takeRightWhile(array, predicate) {
  25971. return (array && array.length)
  25972. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25973. : [];
  25974. }
  25975. /**
  25976. * Creates a slice of `array` with elements taken from the beginning. Elements
  25977. * are taken until `predicate` returns falsey. The predicate is invoked with
  25978. * three arguments: (value, index, array).
  25979. *
  25980. * @static
  25981. * @memberOf _
  25982. * @since 3.0.0
  25983. * @category Array
  25984. * @param {Array} array The array to query.
  25985. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25986. * @returns {Array} Returns the slice of `array`.
  25987. * @example
  25988. *
  25989. * var users = [
  25990. * { 'user': 'barney', 'active': false },
  25991. * { 'user': 'fred', 'active': false },
  25992. * { 'user': 'pebbles', 'active': true }
  25993. * ];
  25994. *
  25995. * _.takeWhile(users, function(o) { return !o.active; });
  25996. * // => objects for ['barney', 'fred']
  25997. *
  25998. * // The `_.matches` iteratee shorthand.
  25999. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26000. * // => objects for ['barney']
  26001. *
  26002. * // The `_.matchesProperty` iteratee shorthand.
  26003. * _.takeWhile(users, ['active', false]);
  26004. * // => objects for ['barney', 'fred']
  26005. *
  26006. * // The `_.property` iteratee shorthand.
  26007. * _.takeWhile(users, 'active');
  26008. * // => []
  26009. */
  26010. function takeWhile(array, predicate) {
  26011. return (array && array.length)
  26012. ? baseWhile(array, getIteratee(predicate, 3))
  26013. : [];
  26014. }
  26015. /**
  26016. * Creates an array of unique values, in order, from all given arrays using
  26017. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26018. * for equality comparisons.
  26019. *
  26020. * @static
  26021. * @memberOf _
  26022. * @since 0.1.0
  26023. * @category Array
  26024. * @param {...Array} [arrays] The arrays to inspect.
  26025. * @returns {Array} Returns the new array of combined values.
  26026. * @example
  26027. *
  26028. * _.union([2], [1, 2]);
  26029. * // => [2, 1]
  26030. */
  26031. var union = baseRest(function(arrays) {
  26032. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26033. });
  26034. /**
  26035. * This method is like `_.union` except that it accepts `iteratee` which is
  26036. * invoked for each element of each `arrays` to generate the criterion by
  26037. * which uniqueness is computed. Result values are chosen from the first
  26038. * array in which the value occurs. The iteratee is invoked with one argument:
  26039. * (value).
  26040. *
  26041. * @static
  26042. * @memberOf _
  26043. * @since 4.0.0
  26044. * @category Array
  26045. * @param {...Array} [arrays] The arrays to inspect.
  26046. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26047. * @returns {Array} Returns the new array of combined values.
  26048. * @example
  26049. *
  26050. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26051. * // => [2.1, 1.2]
  26052. *
  26053. * // The `_.property` iteratee shorthand.
  26054. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26055. * // => [{ 'x': 1 }, { 'x': 2 }]
  26056. */
  26057. var unionBy = baseRest(function(arrays) {
  26058. var iteratee = last(arrays);
  26059. if (isArrayLikeObject(iteratee)) {
  26060. iteratee = undefined;
  26061. }
  26062. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26063. });
  26064. /**
  26065. * This method is like `_.union` except that it accepts `comparator` which
  26066. * is invoked to compare elements of `arrays`. Result values are chosen from
  26067. * the first array in which the value occurs. The comparator is invoked
  26068. * with two arguments: (arrVal, othVal).
  26069. *
  26070. * @static
  26071. * @memberOf _
  26072. * @since 4.0.0
  26073. * @category Array
  26074. * @param {...Array} [arrays] The arrays to inspect.
  26075. * @param {Function} [comparator] The comparator invoked per element.
  26076. * @returns {Array} Returns the new array of combined values.
  26077. * @example
  26078. *
  26079. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26080. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26081. *
  26082. * _.unionWith(objects, others, _.isEqual);
  26083. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26084. */
  26085. var unionWith = baseRest(function(arrays) {
  26086. var comparator = last(arrays);
  26087. comparator = typeof comparator == 'function' ? comparator : undefined;
  26088. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26089. });
  26090. /**
  26091. * Creates a duplicate-free version of an array, using
  26092. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26093. * for equality comparisons, in which only the first occurrence of each element
  26094. * is kept. The order of result values is determined by the order they occur
  26095. * in the array.
  26096. *
  26097. * @static
  26098. * @memberOf _
  26099. * @since 0.1.0
  26100. * @category Array
  26101. * @param {Array} array The array to inspect.
  26102. * @returns {Array} Returns the new duplicate free array.
  26103. * @example
  26104. *
  26105. * _.uniq([2, 1, 2]);
  26106. * // => [2, 1]
  26107. */
  26108. function uniq(array) {
  26109. return (array && array.length) ? baseUniq(array) : [];
  26110. }
  26111. /**
  26112. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26113. * invoked for each element in `array` to generate the criterion by which
  26114. * uniqueness is computed. The order of result values is determined by the
  26115. * order they occur in the array. The iteratee is invoked with one argument:
  26116. * (value).
  26117. *
  26118. * @static
  26119. * @memberOf _
  26120. * @since 4.0.0
  26121. * @category Array
  26122. * @param {Array} array The array to inspect.
  26123. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26124. * @returns {Array} Returns the new duplicate free array.
  26125. * @example
  26126. *
  26127. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26128. * // => [2.1, 1.2]
  26129. *
  26130. * // The `_.property` iteratee shorthand.
  26131. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26132. * // => [{ 'x': 1 }, { 'x': 2 }]
  26133. */
  26134. function uniqBy(array, iteratee) {
  26135. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26136. }
  26137. /**
  26138. * This method is like `_.uniq` except that it accepts `comparator` which
  26139. * is invoked to compare elements of `array`. The order of result values is
  26140. * determined by the order they occur in the array.The comparator is invoked
  26141. * with two arguments: (arrVal, othVal).
  26142. *
  26143. * @static
  26144. * @memberOf _
  26145. * @since 4.0.0
  26146. * @category Array
  26147. * @param {Array} array The array to inspect.
  26148. * @param {Function} [comparator] The comparator invoked per element.
  26149. * @returns {Array} Returns the new duplicate free array.
  26150. * @example
  26151. *
  26152. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26153. *
  26154. * _.uniqWith(objects, _.isEqual);
  26155. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26156. */
  26157. function uniqWith(array, comparator) {
  26158. comparator = typeof comparator == 'function' ? comparator : undefined;
  26159. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26160. }
  26161. /**
  26162. * This method is like `_.zip` except that it accepts an array of grouped
  26163. * elements and creates an array regrouping the elements to their pre-zip
  26164. * configuration.
  26165. *
  26166. * @static
  26167. * @memberOf _
  26168. * @since 1.2.0
  26169. * @category Array
  26170. * @param {Array} array The array of grouped elements to process.
  26171. * @returns {Array} Returns the new array of regrouped elements.
  26172. * @example
  26173. *
  26174. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26175. * // => [['a', 1, true], ['b', 2, false]]
  26176. *
  26177. * _.unzip(zipped);
  26178. * // => [['a', 'b'], [1, 2], [true, false]]
  26179. */
  26180. function unzip(array) {
  26181. if (!(array && array.length)) {
  26182. return [];
  26183. }
  26184. var length = 0;
  26185. array = arrayFilter(array, function(group) {
  26186. if (isArrayLikeObject(group)) {
  26187. length = nativeMax(group.length, length);
  26188. return true;
  26189. }
  26190. });
  26191. return baseTimes(length, function(index) {
  26192. return arrayMap(array, baseProperty(index));
  26193. });
  26194. }
  26195. /**
  26196. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26197. * how regrouped values should be combined. The iteratee is invoked with the
  26198. * elements of each group: (...group).
  26199. *
  26200. * @static
  26201. * @memberOf _
  26202. * @since 3.8.0
  26203. * @category Array
  26204. * @param {Array} array The array of grouped elements to process.
  26205. * @param {Function} [iteratee=_.identity] The function to combine
  26206. * regrouped values.
  26207. * @returns {Array} Returns the new array of regrouped elements.
  26208. * @example
  26209. *
  26210. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26211. * // => [[1, 10, 100], [2, 20, 200]]
  26212. *
  26213. * _.unzipWith(zipped, _.add);
  26214. * // => [3, 30, 300]
  26215. */
  26216. function unzipWith(array, iteratee) {
  26217. if (!(array && array.length)) {
  26218. return [];
  26219. }
  26220. var result = unzip(array);
  26221. if (iteratee == null) {
  26222. return result;
  26223. }
  26224. return arrayMap(result, function(group) {
  26225. return apply(iteratee, undefined, group);
  26226. });
  26227. }
  26228. /**
  26229. * Creates an array excluding all given values using
  26230. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26231. * for equality comparisons.
  26232. *
  26233. * **Note:** Unlike `_.pull`, this method returns a new array.
  26234. *
  26235. * @static
  26236. * @memberOf _
  26237. * @since 0.1.0
  26238. * @category Array
  26239. * @param {Array} array The array to inspect.
  26240. * @param {...*} [values] The values to exclude.
  26241. * @returns {Array} Returns the new array of filtered values.
  26242. * @see _.difference, _.xor
  26243. * @example
  26244. *
  26245. * _.without([2, 1, 2, 3], 1, 2);
  26246. * // => [3]
  26247. */
  26248. var without = baseRest(function(array, values) {
  26249. return isArrayLikeObject(array)
  26250. ? baseDifference(array, values)
  26251. : [];
  26252. });
  26253. /**
  26254. * Creates an array of unique values that is the
  26255. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26256. * of the given arrays. The order of result values is determined by the order
  26257. * they occur in the arrays.
  26258. *
  26259. * @static
  26260. * @memberOf _
  26261. * @since 2.4.0
  26262. * @category Array
  26263. * @param {...Array} [arrays] The arrays to inspect.
  26264. * @returns {Array} Returns the new array of filtered values.
  26265. * @see _.difference, _.without
  26266. * @example
  26267. *
  26268. * _.xor([2, 1], [2, 3]);
  26269. * // => [1, 3]
  26270. */
  26271. var xor = baseRest(function(arrays) {
  26272. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26273. });
  26274. /**
  26275. * This method is like `_.xor` except that it accepts `iteratee` which is
  26276. * invoked for each element of each `arrays` to generate the criterion by
  26277. * which by which they're compared. The order of result values is determined
  26278. * by the order they occur in the arrays. The iteratee is invoked with one
  26279. * argument: (value).
  26280. *
  26281. * @static
  26282. * @memberOf _
  26283. * @since 4.0.0
  26284. * @category Array
  26285. * @param {...Array} [arrays] The arrays to inspect.
  26286. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26287. * @returns {Array} Returns the new array of filtered values.
  26288. * @example
  26289. *
  26290. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26291. * // => [1.2, 3.4]
  26292. *
  26293. * // The `_.property` iteratee shorthand.
  26294. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26295. * // => [{ 'x': 2 }]
  26296. */
  26297. var xorBy = baseRest(function(arrays) {
  26298. var iteratee = last(arrays);
  26299. if (isArrayLikeObject(iteratee)) {
  26300. iteratee = undefined;
  26301. }
  26302. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26303. });
  26304. /**
  26305. * This method is like `_.xor` except that it accepts `comparator` which is
  26306. * invoked to compare elements of `arrays`. The order of result values is
  26307. * determined by the order they occur in the arrays. The comparator is invoked
  26308. * with two arguments: (arrVal, othVal).
  26309. *
  26310. * @static
  26311. * @memberOf _
  26312. * @since 4.0.0
  26313. * @category Array
  26314. * @param {...Array} [arrays] The arrays to inspect.
  26315. * @param {Function} [comparator] The comparator invoked per element.
  26316. * @returns {Array} Returns the new array of filtered values.
  26317. * @example
  26318. *
  26319. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26320. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26321. *
  26322. * _.xorWith(objects, others, _.isEqual);
  26323. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26324. */
  26325. var xorWith = baseRest(function(arrays) {
  26326. var comparator = last(arrays);
  26327. comparator = typeof comparator == 'function' ? comparator : undefined;
  26328. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26329. });
  26330. /**
  26331. * Creates an array of grouped elements, the first of which contains the
  26332. * first elements of the given arrays, the second of which contains the
  26333. * second elements of the given arrays, and so on.
  26334. *
  26335. * @static
  26336. * @memberOf _
  26337. * @since 0.1.0
  26338. * @category Array
  26339. * @param {...Array} [arrays] The arrays to process.
  26340. * @returns {Array} Returns the new array of grouped elements.
  26341. * @example
  26342. *
  26343. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26344. * // => [['a', 1, true], ['b', 2, false]]
  26345. */
  26346. var zip = baseRest(unzip);
  26347. /**
  26348. * This method is like `_.fromPairs` except that it accepts two arrays,
  26349. * one of property identifiers and one of corresponding values.
  26350. *
  26351. * @static
  26352. * @memberOf _
  26353. * @since 0.4.0
  26354. * @category Array
  26355. * @param {Array} [props=[]] The property identifiers.
  26356. * @param {Array} [values=[]] The property values.
  26357. * @returns {Object} Returns the new object.
  26358. * @example
  26359. *
  26360. * _.zipObject(['a', 'b'], [1, 2]);
  26361. * // => { 'a': 1, 'b': 2 }
  26362. */
  26363. function zipObject(props, values) {
  26364. return baseZipObject(props || [], values || [], assignValue);
  26365. }
  26366. /**
  26367. * This method is like `_.zipObject` except that it supports property paths.
  26368. *
  26369. * @static
  26370. * @memberOf _
  26371. * @since 4.1.0
  26372. * @category Array
  26373. * @param {Array} [props=[]] The property identifiers.
  26374. * @param {Array} [values=[]] The property values.
  26375. * @returns {Object} Returns the new object.
  26376. * @example
  26377. *
  26378. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26379. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26380. */
  26381. function zipObjectDeep(props, values) {
  26382. return baseZipObject(props || [], values || [], baseSet);
  26383. }
  26384. /**
  26385. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26386. * how grouped values should be combined. The iteratee is invoked with the
  26387. * elements of each group: (...group).
  26388. *
  26389. * @static
  26390. * @memberOf _
  26391. * @since 3.8.0
  26392. * @category Array
  26393. * @param {...Array} [arrays] The arrays to process.
  26394. * @param {Function} [iteratee=_.identity] The function to combine
  26395. * grouped values.
  26396. * @returns {Array} Returns the new array of grouped elements.
  26397. * @example
  26398. *
  26399. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26400. * return a + b + c;
  26401. * });
  26402. * // => [111, 222]
  26403. */
  26404. var zipWith = baseRest(function(arrays) {
  26405. var length = arrays.length,
  26406. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26407. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26408. return unzipWith(arrays, iteratee);
  26409. });
  26410. /*------------------------------------------------------------------------*/
  26411. /**
  26412. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26413. * chain sequences enabled. The result of such sequences must be unwrapped
  26414. * with `_#value`.
  26415. *
  26416. * @static
  26417. * @memberOf _
  26418. * @since 1.3.0
  26419. * @category Seq
  26420. * @param {*} value The value to wrap.
  26421. * @returns {Object} Returns the new `lodash` wrapper instance.
  26422. * @example
  26423. *
  26424. * var users = [
  26425. * { 'user': 'barney', 'age': 36 },
  26426. * { 'user': 'fred', 'age': 40 },
  26427. * { 'user': 'pebbles', 'age': 1 }
  26428. * ];
  26429. *
  26430. * var youngest = _
  26431. * .chain(users)
  26432. * .sortBy('age')
  26433. * .map(function(o) {
  26434. * return o.user + ' is ' + o.age;
  26435. * })
  26436. * .head()
  26437. * .value();
  26438. * // => 'pebbles is 1'
  26439. */
  26440. function chain(value) {
  26441. var result = lodash(value);
  26442. result.__chain__ = true;
  26443. return result;
  26444. }
  26445. /**
  26446. * This method invokes `interceptor` and returns `value`. The interceptor
  26447. * is invoked with one argument; (value). The purpose of this method is to
  26448. * "tap into" a method chain sequence in order to modify intermediate results.
  26449. *
  26450. * @static
  26451. * @memberOf _
  26452. * @since 0.1.0
  26453. * @category Seq
  26454. * @param {*} value The value to provide to `interceptor`.
  26455. * @param {Function} interceptor The function to invoke.
  26456. * @returns {*} Returns `value`.
  26457. * @example
  26458. *
  26459. * _([1, 2, 3])
  26460. * .tap(function(array) {
  26461. * // Mutate input array.
  26462. * array.pop();
  26463. * })
  26464. * .reverse()
  26465. * .value();
  26466. * // => [2, 1]
  26467. */
  26468. function tap(value, interceptor) {
  26469. interceptor(value);
  26470. return value;
  26471. }
  26472. /**
  26473. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26474. * The purpose of this method is to "pass thru" values replacing intermediate
  26475. * results in a method chain sequence.
  26476. *
  26477. * @static
  26478. * @memberOf _
  26479. * @since 3.0.0
  26480. * @category Seq
  26481. * @param {*} value The value to provide to `interceptor`.
  26482. * @param {Function} interceptor The function to invoke.
  26483. * @returns {*} Returns the result of `interceptor`.
  26484. * @example
  26485. *
  26486. * _(' abc ')
  26487. * .chain()
  26488. * .trim()
  26489. * .thru(function(value) {
  26490. * return [value];
  26491. * })
  26492. * .value();
  26493. * // => ['abc']
  26494. */
  26495. function thru(value, interceptor) {
  26496. return interceptor(value);
  26497. }
  26498. /**
  26499. * This method is the wrapper version of `_.at`.
  26500. *
  26501. * @name at
  26502. * @memberOf _
  26503. * @since 1.0.0
  26504. * @category Seq
  26505. * @param {...(string|string[])} [paths] The property paths to pick.
  26506. * @returns {Object} Returns the new `lodash` wrapper instance.
  26507. * @example
  26508. *
  26509. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26510. *
  26511. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26512. * // => [3, 4]
  26513. */
  26514. var wrapperAt = flatRest(function(paths) {
  26515. var length = paths.length,
  26516. start = length ? paths[0] : 0,
  26517. value = this.__wrapped__,
  26518. interceptor = function(object) { return baseAt(object, paths); };
  26519. if (length > 1 || this.__actions__.length ||
  26520. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26521. return this.thru(interceptor);
  26522. }
  26523. value = value.slice(start, +start + (length ? 1 : 0));
  26524. value.__actions__.push({
  26525. 'func': thru,
  26526. 'args': [interceptor],
  26527. 'thisArg': undefined
  26528. });
  26529. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26530. if (length && !array.length) {
  26531. array.push(undefined);
  26532. }
  26533. return array;
  26534. });
  26535. });
  26536. /**
  26537. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26538. *
  26539. * @name chain
  26540. * @memberOf _
  26541. * @since 0.1.0
  26542. * @category Seq
  26543. * @returns {Object} Returns the new `lodash` wrapper instance.
  26544. * @example
  26545. *
  26546. * var users = [
  26547. * { 'user': 'barney', 'age': 36 },
  26548. * { 'user': 'fred', 'age': 40 }
  26549. * ];
  26550. *
  26551. * // A sequence without explicit chaining.
  26552. * _(users).head();
  26553. * // => { 'user': 'barney', 'age': 36 }
  26554. *
  26555. * // A sequence with explicit chaining.
  26556. * _(users)
  26557. * .chain()
  26558. * .head()
  26559. * .pick('user')
  26560. * .value();
  26561. * // => { 'user': 'barney' }
  26562. */
  26563. function wrapperChain() {
  26564. return chain(this);
  26565. }
  26566. /**
  26567. * Executes the chain sequence and returns the wrapped result.
  26568. *
  26569. * @name commit
  26570. * @memberOf _
  26571. * @since 3.2.0
  26572. * @category Seq
  26573. * @returns {Object} Returns the new `lodash` wrapper instance.
  26574. * @example
  26575. *
  26576. * var array = [1, 2];
  26577. * var wrapped = _(array).push(3);
  26578. *
  26579. * console.log(array);
  26580. * // => [1, 2]
  26581. *
  26582. * wrapped = wrapped.commit();
  26583. * console.log(array);
  26584. * // => [1, 2, 3]
  26585. *
  26586. * wrapped.last();
  26587. * // => 3
  26588. *
  26589. * console.log(array);
  26590. * // => [1, 2, 3]
  26591. */
  26592. function wrapperCommit() {
  26593. return new LodashWrapper(this.value(), this.__chain__);
  26594. }
  26595. /**
  26596. * Gets the next value on a wrapped object following the
  26597. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26598. *
  26599. * @name next
  26600. * @memberOf _
  26601. * @since 4.0.0
  26602. * @category Seq
  26603. * @returns {Object} Returns the next iterator value.
  26604. * @example
  26605. *
  26606. * var wrapped = _([1, 2]);
  26607. *
  26608. * wrapped.next();
  26609. * // => { 'done': false, 'value': 1 }
  26610. *
  26611. * wrapped.next();
  26612. * // => { 'done': false, 'value': 2 }
  26613. *
  26614. * wrapped.next();
  26615. * // => { 'done': true, 'value': undefined }
  26616. */
  26617. function wrapperNext() {
  26618. if (this.__values__ === undefined) {
  26619. this.__values__ = toArray(this.value());
  26620. }
  26621. var done = this.__index__ >= this.__values__.length,
  26622. value = done ? undefined : this.__values__[this.__index__++];
  26623. return { 'done': done, 'value': value };
  26624. }
  26625. /**
  26626. * Enables the wrapper to be iterable.
  26627. *
  26628. * @name Symbol.iterator
  26629. * @memberOf _
  26630. * @since 4.0.0
  26631. * @category Seq
  26632. * @returns {Object} Returns the wrapper object.
  26633. * @example
  26634. *
  26635. * var wrapped = _([1, 2]);
  26636. *
  26637. * wrapped[Symbol.iterator]() === wrapped;
  26638. * // => true
  26639. *
  26640. * Array.from(wrapped);
  26641. * // => [1, 2]
  26642. */
  26643. function wrapperToIterator() {
  26644. return this;
  26645. }
  26646. /**
  26647. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26648. *
  26649. * @name plant
  26650. * @memberOf _
  26651. * @since 3.2.0
  26652. * @category Seq
  26653. * @param {*} value The value to plant.
  26654. * @returns {Object} Returns the new `lodash` wrapper instance.
  26655. * @example
  26656. *
  26657. * function square(n) {
  26658. * return n * n;
  26659. * }
  26660. *
  26661. * var wrapped = _([1, 2]).map(square);
  26662. * var other = wrapped.plant([3, 4]);
  26663. *
  26664. * other.value();
  26665. * // => [9, 16]
  26666. *
  26667. * wrapped.value();
  26668. * // => [1, 4]
  26669. */
  26670. function wrapperPlant(value) {
  26671. var result,
  26672. parent = this;
  26673. while (parent instanceof baseLodash) {
  26674. var clone = wrapperClone(parent);
  26675. clone.__index__ = 0;
  26676. clone.__values__ = undefined;
  26677. if (result) {
  26678. previous.__wrapped__ = clone;
  26679. } else {
  26680. result = clone;
  26681. }
  26682. var previous = clone;
  26683. parent = parent.__wrapped__;
  26684. }
  26685. previous.__wrapped__ = value;
  26686. return result;
  26687. }
  26688. /**
  26689. * This method is the wrapper version of `_.reverse`.
  26690. *
  26691. * **Note:** This method mutates the wrapped array.
  26692. *
  26693. * @name reverse
  26694. * @memberOf _
  26695. * @since 0.1.0
  26696. * @category Seq
  26697. * @returns {Object} Returns the new `lodash` wrapper instance.
  26698. * @example
  26699. *
  26700. * var array = [1, 2, 3];
  26701. *
  26702. * _(array).reverse().value()
  26703. * // => [3, 2, 1]
  26704. *
  26705. * console.log(array);
  26706. * // => [3, 2, 1]
  26707. */
  26708. function wrapperReverse() {
  26709. var value = this.__wrapped__;
  26710. if (value instanceof LazyWrapper) {
  26711. var wrapped = value;
  26712. if (this.__actions__.length) {
  26713. wrapped = new LazyWrapper(this);
  26714. }
  26715. wrapped = wrapped.reverse();
  26716. wrapped.__actions__.push({
  26717. 'func': thru,
  26718. 'args': [reverse],
  26719. 'thisArg': undefined
  26720. });
  26721. return new LodashWrapper(wrapped, this.__chain__);
  26722. }
  26723. return this.thru(reverse);
  26724. }
  26725. /**
  26726. * Executes the chain sequence to resolve the unwrapped value.
  26727. *
  26728. * @name value
  26729. * @memberOf _
  26730. * @since 0.1.0
  26731. * @alias toJSON, valueOf
  26732. * @category Seq
  26733. * @returns {*} Returns the resolved unwrapped value.
  26734. * @example
  26735. *
  26736. * _([1, 2, 3]).value();
  26737. * // => [1, 2, 3]
  26738. */
  26739. function wrapperValue() {
  26740. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26741. }
  26742. /*------------------------------------------------------------------------*/
  26743. /**
  26744. * Creates an object composed of keys generated from the results of running
  26745. * each element of `collection` thru `iteratee`. The corresponding value of
  26746. * each key is the number of times the key was returned by `iteratee`. The
  26747. * iteratee is invoked with one argument: (value).
  26748. *
  26749. * @static
  26750. * @memberOf _
  26751. * @since 0.5.0
  26752. * @category Collection
  26753. * @param {Array|Object} collection The collection to iterate over.
  26754. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26755. * @returns {Object} Returns the composed aggregate object.
  26756. * @example
  26757. *
  26758. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26759. * // => { '4': 1, '6': 2 }
  26760. *
  26761. * // The `_.property` iteratee shorthand.
  26762. * _.countBy(['one', 'two', 'three'], 'length');
  26763. * // => { '3': 2, '5': 1 }
  26764. */
  26765. var countBy = createAggregator(function(result, value, key) {
  26766. if (hasOwnProperty.call(result, key)) {
  26767. ++result[key];
  26768. } else {
  26769. baseAssignValue(result, key, 1);
  26770. }
  26771. });
  26772. /**
  26773. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26774. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26775. * invoked with three arguments: (value, index|key, collection).
  26776. *
  26777. * **Note:** This method returns `true` for
  26778. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26779. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26780. * elements of empty collections.
  26781. *
  26782. * @static
  26783. * @memberOf _
  26784. * @since 0.1.0
  26785. * @category Collection
  26786. * @param {Array|Object} collection The collection to iterate over.
  26787. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26788. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26789. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26790. * else `false`.
  26791. * @example
  26792. *
  26793. * _.every([true, 1, null, 'yes'], Boolean);
  26794. * // => false
  26795. *
  26796. * var users = [
  26797. * { 'user': 'barney', 'age': 36, 'active': false },
  26798. * { 'user': 'fred', 'age': 40, 'active': false }
  26799. * ];
  26800. *
  26801. * // The `_.matches` iteratee shorthand.
  26802. * _.every(users, { 'user': 'barney', 'active': false });
  26803. * // => false
  26804. *
  26805. * // The `_.matchesProperty` iteratee shorthand.
  26806. * _.every(users, ['active', false]);
  26807. * // => true
  26808. *
  26809. * // The `_.property` iteratee shorthand.
  26810. * _.every(users, 'active');
  26811. * // => false
  26812. */
  26813. function every(collection, predicate, guard) {
  26814. var func = isArray(collection) ? arrayEvery : baseEvery;
  26815. if (guard && isIterateeCall(collection, predicate, guard)) {
  26816. predicate = undefined;
  26817. }
  26818. return func(collection, getIteratee(predicate, 3));
  26819. }
  26820. /**
  26821. * Iterates over elements of `collection`, returning an array of all elements
  26822. * `predicate` returns truthy for. The predicate is invoked with three
  26823. * arguments: (value, index|key, collection).
  26824. *
  26825. * **Note:** Unlike `_.remove`, this method returns a new array.
  26826. *
  26827. * @static
  26828. * @memberOf _
  26829. * @since 0.1.0
  26830. * @category Collection
  26831. * @param {Array|Object} collection The collection to iterate over.
  26832. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26833. * @returns {Array} Returns the new filtered array.
  26834. * @see _.reject
  26835. * @example
  26836. *
  26837. * var users = [
  26838. * { 'user': 'barney', 'age': 36, 'active': true },
  26839. * { 'user': 'fred', 'age': 40, 'active': false }
  26840. * ];
  26841. *
  26842. * _.filter(users, function(o) { return !o.active; });
  26843. * // => objects for ['fred']
  26844. *
  26845. * // The `_.matches` iteratee shorthand.
  26846. * _.filter(users, { 'age': 36, 'active': true });
  26847. * // => objects for ['barney']
  26848. *
  26849. * // The `_.matchesProperty` iteratee shorthand.
  26850. * _.filter(users, ['active', false]);
  26851. * // => objects for ['fred']
  26852. *
  26853. * // The `_.property` iteratee shorthand.
  26854. * _.filter(users, 'active');
  26855. * // => objects for ['barney']
  26856. */
  26857. function filter(collection, predicate) {
  26858. var func = isArray(collection) ? arrayFilter : baseFilter;
  26859. return func(collection, getIteratee(predicate, 3));
  26860. }
  26861. /**
  26862. * Iterates over elements of `collection`, returning the first element
  26863. * `predicate` returns truthy for. The predicate is invoked with three
  26864. * arguments: (value, index|key, collection).
  26865. *
  26866. * @static
  26867. * @memberOf _
  26868. * @since 0.1.0
  26869. * @category Collection
  26870. * @param {Array|Object} collection The collection to inspect.
  26871. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26872. * @param {number} [fromIndex=0] The index to search from.
  26873. * @returns {*} Returns the matched element, else `undefined`.
  26874. * @example
  26875. *
  26876. * var users = [
  26877. * { 'user': 'barney', 'age': 36, 'active': true },
  26878. * { 'user': 'fred', 'age': 40, 'active': false },
  26879. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26880. * ];
  26881. *
  26882. * _.find(users, function(o) { return o.age < 40; });
  26883. * // => object for 'barney'
  26884. *
  26885. * // The `_.matches` iteratee shorthand.
  26886. * _.find(users, { 'age': 1, 'active': true });
  26887. * // => object for 'pebbles'
  26888. *
  26889. * // The `_.matchesProperty` iteratee shorthand.
  26890. * _.find(users, ['active', false]);
  26891. * // => object for 'fred'
  26892. *
  26893. * // The `_.property` iteratee shorthand.
  26894. * _.find(users, 'active');
  26895. * // => object for 'barney'
  26896. */
  26897. var find = createFind(findIndex);
  26898. /**
  26899. * This method is like `_.find` except that it iterates over elements of
  26900. * `collection` from right to left.
  26901. *
  26902. * @static
  26903. * @memberOf _
  26904. * @since 2.0.0
  26905. * @category Collection
  26906. * @param {Array|Object} collection The collection to inspect.
  26907. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26908. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26909. * @returns {*} Returns the matched element, else `undefined`.
  26910. * @example
  26911. *
  26912. * _.findLast([1, 2, 3, 4], function(n) {
  26913. * return n % 2 == 1;
  26914. * });
  26915. * // => 3
  26916. */
  26917. var findLast = createFind(findLastIndex);
  26918. /**
  26919. * Creates a flattened array of values by running each element in `collection`
  26920. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26921. * with three arguments: (value, index|key, collection).
  26922. *
  26923. * @static
  26924. * @memberOf _
  26925. * @since 4.0.0
  26926. * @category Collection
  26927. * @param {Array|Object} collection The collection to iterate over.
  26928. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26929. * @returns {Array} Returns the new flattened array.
  26930. * @example
  26931. *
  26932. * function duplicate(n) {
  26933. * return [n, n];
  26934. * }
  26935. *
  26936. * _.flatMap([1, 2], duplicate);
  26937. * // => [1, 1, 2, 2]
  26938. */
  26939. function flatMap(collection, iteratee) {
  26940. return baseFlatten(map(collection, iteratee), 1);
  26941. }
  26942. /**
  26943. * This method is like `_.flatMap` except that it recursively flattens the
  26944. * mapped results.
  26945. *
  26946. * @static
  26947. * @memberOf _
  26948. * @since 4.7.0
  26949. * @category Collection
  26950. * @param {Array|Object} collection The collection to iterate over.
  26951. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26952. * @returns {Array} Returns the new flattened array.
  26953. * @example
  26954. *
  26955. * function duplicate(n) {
  26956. * return [[[n, n]]];
  26957. * }
  26958. *
  26959. * _.flatMapDeep([1, 2], duplicate);
  26960. * // => [1, 1, 2, 2]
  26961. */
  26962. function flatMapDeep(collection, iteratee) {
  26963. return baseFlatten(map(collection, iteratee), INFINITY);
  26964. }
  26965. /**
  26966. * This method is like `_.flatMap` except that it recursively flattens the
  26967. * mapped results up to `depth` times.
  26968. *
  26969. * @static
  26970. * @memberOf _
  26971. * @since 4.7.0
  26972. * @category Collection
  26973. * @param {Array|Object} collection The collection to iterate over.
  26974. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26975. * @param {number} [depth=1] The maximum recursion depth.
  26976. * @returns {Array} Returns the new flattened array.
  26977. * @example
  26978. *
  26979. * function duplicate(n) {
  26980. * return [[[n, n]]];
  26981. * }
  26982. *
  26983. * _.flatMapDepth([1, 2], duplicate, 2);
  26984. * // => [[1, 1], [2, 2]]
  26985. */
  26986. function flatMapDepth(collection, iteratee, depth) {
  26987. depth = depth === undefined ? 1 : toInteger(depth);
  26988. return baseFlatten(map(collection, iteratee), depth);
  26989. }
  26990. /**
  26991. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26992. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26993. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26994. *
  26995. * **Note:** As with other "Collections" methods, objects with a "length"
  26996. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26997. * or `_.forOwn` for object iteration.
  26998. *
  26999. * @static
  27000. * @memberOf _
  27001. * @since 0.1.0
  27002. * @alias each
  27003. * @category Collection
  27004. * @param {Array|Object} collection The collection to iterate over.
  27005. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27006. * @returns {Array|Object} Returns `collection`.
  27007. * @see _.forEachRight
  27008. * @example
  27009. *
  27010. * _.forEach([1, 2], function(value) {
  27011. * console.log(value);
  27012. * });
  27013. * // => Logs `1` then `2`.
  27014. *
  27015. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27016. * console.log(key);
  27017. * });
  27018. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27019. */
  27020. function forEach(collection, iteratee) {
  27021. var func = isArray(collection) ? arrayEach : baseEach;
  27022. return func(collection, getIteratee(iteratee, 3));
  27023. }
  27024. /**
  27025. * This method is like `_.forEach` except that it iterates over elements of
  27026. * `collection` from right to left.
  27027. *
  27028. * @static
  27029. * @memberOf _
  27030. * @since 2.0.0
  27031. * @alias eachRight
  27032. * @category Collection
  27033. * @param {Array|Object} collection The collection to iterate over.
  27034. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27035. * @returns {Array|Object} Returns `collection`.
  27036. * @see _.forEach
  27037. * @example
  27038. *
  27039. * _.forEachRight([1, 2], function(value) {
  27040. * console.log(value);
  27041. * });
  27042. * // => Logs `2` then `1`.
  27043. */
  27044. function forEachRight(collection, iteratee) {
  27045. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27046. return func(collection, getIteratee(iteratee, 3));
  27047. }
  27048. /**
  27049. * Creates an object composed of keys generated from the results of running
  27050. * each element of `collection` thru `iteratee`. The order of grouped values
  27051. * is determined by the order they occur in `collection`. The corresponding
  27052. * value of each key is an array of elements responsible for generating the
  27053. * key. The iteratee is invoked with one argument: (value).
  27054. *
  27055. * @static
  27056. * @memberOf _
  27057. * @since 0.1.0
  27058. * @category Collection
  27059. * @param {Array|Object} collection The collection to iterate over.
  27060. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27061. * @returns {Object} Returns the composed aggregate object.
  27062. * @example
  27063. *
  27064. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27065. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27066. *
  27067. * // The `_.property` iteratee shorthand.
  27068. * _.groupBy(['one', 'two', 'three'], 'length');
  27069. * // => { '3': ['one', 'two'], '5': ['three'] }
  27070. */
  27071. var groupBy = createAggregator(function(result, value, key) {
  27072. if (hasOwnProperty.call(result, key)) {
  27073. result[key].push(value);
  27074. } else {
  27075. baseAssignValue(result, key, [value]);
  27076. }
  27077. });
  27078. /**
  27079. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27080. * checked for a substring of `value`, otherwise
  27081. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27082. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27083. * the offset from the end of `collection`.
  27084. *
  27085. * @static
  27086. * @memberOf _
  27087. * @since 0.1.0
  27088. * @category Collection
  27089. * @param {Array|Object|string} collection The collection to inspect.
  27090. * @param {*} value The value to search for.
  27091. * @param {number} [fromIndex=0] The index to search from.
  27092. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27093. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27094. * @example
  27095. *
  27096. * _.includes([1, 2, 3], 1);
  27097. * // => true
  27098. *
  27099. * _.includes([1, 2, 3], 1, 2);
  27100. * // => false
  27101. *
  27102. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27103. * // => true
  27104. *
  27105. * _.includes('abcd', 'bc');
  27106. * // => true
  27107. */
  27108. function includes(collection, value, fromIndex, guard) {
  27109. collection = isArrayLike(collection) ? collection : values(collection);
  27110. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27111. var length = collection.length;
  27112. if (fromIndex < 0) {
  27113. fromIndex = nativeMax(length + fromIndex, 0);
  27114. }
  27115. return isString(collection)
  27116. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27117. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27118. }
  27119. /**
  27120. * Invokes the method at `path` of each element in `collection`, returning
  27121. * an array of the results of each invoked method. Any additional arguments
  27122. * are provided to each invoked method. If `path` is a function, it's invoked
  27123. * for, and `this` bound to, each element in `collection`.
  27124. *
  27125. * @static
  27126. * @memberOf _
  27127. * @since 4.0.0
  27128. * @category Collection
  27129. * @param {Array|Object} collection The collection to iterate over.
  27130. * @param {Array|Function|string} path The path of the method to invoke or
  27131. * the function invoked per iteration.
  27132. * @param {...*} [args] The arguments to invoke each method with.
  27133. * @returns {Array} Returns the array of results.
  27134. * @example
  27135. *
  27136. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27137. * // => [[1, 5, 7], [1, 2, 3]]
  27138. *
  27139. * _.invokeMap([123, 456], String.prototype.split, '');
  27140. * // => [['1', '2', '3'], ['4', '5', '6']]
  27141. */
  27142. var invokeMap = baseRest(function(collection, path, args) {
  27143. var index = -1,
  27144. isFunc = typeof path == 'function',
  27145. result = isArrayLike(collection) ? Array(collection.length) : [];
  27146. baseEach(collection, function(value) {
  27147. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27148. });
  27149. return result;
  27150. });
  27151. /**
  27152. * Creates an object composed of keys generated from the results of running
  27153. * each element of `collection` thru `iteratee`. The corresponding value of
  27154. * each key is the last element responsible for generating the key. The
  27155. * iteratee is invoked with one argument: (value).
  27156. *
  27157. * @static
  27158. * @memberOf _
  27159. * @since 4.0.0
  27160. * @category Collection
  27161. * @param {Array|Object} collection The collection to iterate over.
  27162. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27163. * @returns {Object} Returns the composed aggregate object.
  27164. * @example
  27165. *
  27166. * var array = [
  27167. * { 'dir': 'left', 'code': 97 },
  27168. * { 'dir': 'right', 'code': 100 }
  27169. * ];
  27170. *
  27171. * _.keyBy(array, function(o) {
  27172. * return String.fromCharCode(o.code);
  27173. * });
  27174. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27175. *
  27176. * _.keyBy(array, 'dir');
  27177. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27178. */
  27179. var keyBy = createAggregator(function(result, value, key) {
  27180. baseAssignValue(result, key, value);
  27181. });
  27182. /**
  27183. * Creates an array of values by running each element in `collection` thru
  27184. * `iteratee`. The iteratee is invoked with three arguments:
  27185. * (value, index|key, collection).
  27186. *
  27187. * Many lodash methods are guarded to work as iteratees for methods like
  27188. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27189. *
  27190. * The guarded methods are:
  27191. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27192. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27193. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27194. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27195. *
  27196. * @static
  27197. * @memberOf _
  27198. * @since 0.1.0
  27199. * @category Collection
  27200. * @param {Array|Object} collection The collection to iterate over.
  27201. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27202. * @returns {Array} Returns the new mapped array.
  27203. * @example
  27204. *
  27205. * function square(n) {
  27206. * return n * n;
  27207. * }
  27208. *
  27209. * _.map([4, 8], square);
  27210. * // => [16, 64]
  27211. *
  27212. * _.map({ 'a': 4, 'b': 8 }, square);
  27213. * // => [16, 64] (iteration order is not guaranteed)
  27214. *
  27215. * var users = [
  27216. * { 'user': 'barney' },
  27217. * { 'user': 'fred' }
  27218. * ];
  27219. *
  27220. * // The `_.property` iteratee shorthand.
  27221. * _.map(users, 'user');
  27222. * // => ['barney', 'fred']
  27223. */
  27224. function map(collection, iteratee) {
  27225. var func = isArray(collection) ? arrayMap : baseMap;
  27226. return func(collection, getIteratee(iteratee, 3));
  27227. }
  27228. /**
  27229. * This method is like `_.sortBy` except that it allows specifying the sort
  27230. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27231. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27232. * descending or "asc" for ascending sort order of corresponding values.
  27233. *
  27234. * @static
  27235. * @memberOf _
  27236. * @since 4.0.0
  27237. * @category Collection
  27238. * @param {Array|Object} collection The collection to iterate over.
  27239. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27240. * The iteratees to sort by.
  27241. * @param {string[]} [orders] The sort orders of `iteratees`.
  27242. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27243. * @returns {Array} Returns the new sorted array.
  27244. * @example
  27245. *
  27246. * var users = [
  27247. * { 'user': 'fred', 'age': 48 },
  27248. * { 'user': 'barney', 'age': 34 },
  27249. * { 'user': 'fred', 'age': 40 },
  27250. * { 'user': 'barney', 'age': 36 }
  27251. * ];
  27252. *
  27253. * // Sort by `user` in ascending order and by `age` in descending order.
  27254. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27255. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27256. */
  27257. function orderBy(collection, iteratees, orders, guard) {
  27258. if (collection == null) {
  27259. return [];
  27260. }
  27261. if (!isArray(iteratees)) {
  27262. iteratees = iteratees == null ? [] : [iteratees];
  27263. }
  27264. orders = guard ? undefined : orders;
  27265. if (!isArray(orders)) {
  27266. orders = orders == null ? [] : [orders];
  27267. }
  27268. return baseOrderBy(collection, iteratees, orders);
  27269. }
  27270. /**
  27271. * Creates an array of elements split into two groups, the first of which
  27272. * contains elements `predicate` returns truthy for, the second of which
  27273. * contains elements `predicate` returns falsey for. The predicate is
  27274. * invoked with one argument: (value).
  27275. *
  27276. * @static
  27277. * @memberOf _
  27278. * @since 3.0.0
  27279. * @category Collection
  27280. * @param {Array|Object} collection The collection to iterate over.
  27281. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27282. * @returns {Array} Returns the array of grouped elements.
  27283. * @example
  27284. *
  27285. * var users = [
  27286. * { 'user': 'barney', 'age': 36, 'active': false },
  27287. * { 'user': 'fred', 'age': 40, 'active': true },
  27288. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27289. * ];
  27290. *
  27291. * _.partition(users, function(o) { return o.active; });
  27292. * // => objects for [['fred'], ['barney', 'pebbles']]
  27293. *
  27294. * // The `_.matches` iteratee shorthand.
  27295. * _.partition(users, { 'age': 1, 'active': false });
  27296. * // => objects for [['pebbles'], ['barney', 'fred']]
  27297. *
  27298. * // The `_.matchesProperty` iteratee shorthand.
  27299. * _.partition(users, ['active', false]);
  27300. * // => objects for [['barney', 'pebbles'], ['fred']]
  27301. *
  27302. * // The `_.property` iteratee shorthand.
  27303. * _.partition(users, 'active');
  27304. * // => objects for [['fred'], ['barney', 'pebbles']]
  27305. */
  27306. var partition = createAggregator(function(result, value, key) {
  27307. result[key ? 0 : 1].push(value);
  27308. }, function() { return [[], []]; });
  27309. /**
  27310. * Reduces `collection` to a value which is the accumulated result of running
  27311. * each element in `collection` thru `iteratee`, where each successive
  27312. * invocation is supplied the return value of the previous. If `accumulator`
  27313. * is not given, the first element of `collection` is used as the initial
  27314. * value. The iteratee is invoked with four arguments:
  27315. * (accumulator, value, index|key, collection).
  27316. *
  27317. * Many lodash methods are guarded to work as iteratees for methods like
  27318. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27319. *
  27320. * The guarded methods are:
  27321. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27322. * and `sortBy`
  27323. *
  27324. * @static
  27325. * @memberOf _
  27326. * @since 0.1.0
  27327. * @category Collection
  27328. * @param {Array|Object} collection The collection to iterate over.
  27329. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27330. * @param {*} [accumulator] The initial value.
  27331. * @returns {*} Returns the accumulated value.
  27332. * @see _.reduceRight
  27333. * @example
  27334. *
  27335. * _.reduce([1, 2], function(sum, n) {
  27336. * return sum + n;
  27337. * }, 0);
  27338. * // => 3
  27339. *
  27340. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27341. * (result[value] || (result[value] = [])).push(key);
  27342. * return result;
  27343. * }, {});
  27344. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27345. */
  27346. function reduce(collection, iteratee, accumulator) {
  27347. var func = isArray(collection) ? arrayReduce : baseReduce,
  27348. initAccum = arguments.length < 3;
  27349. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27350. }
  27351. /**
  27352. * This method is like `_.reduce` except that it iterates over elements of
  27353. * `collection` from right to left.
  27354. *
  27355. * @static
  27356. * @memberOf _
  27357. * @since 0.1.0
  27358. * @category Collection
  27359. * @param {Array|Object} collection The collection to iterate over.
  27360. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27361. * @param {*} [accumulator] The initial value.
  27362. * @returns {*} Returns the accumulated value.
  27363. * @see _.reduce
  27364. * @example
  27365. *
  27366. * var array = [[0, 1], [2, 3], [4, 5]];
  27367. *
  27368. * _.reduceRight(array, function(flattened, other) {
  27369. * return flattened.concat(other);
  27370. * }, []);
  27371. * // => [4, 5, 2, 3, 0, 1]
  27372. */
  27373. function reduceRight(collection, iteratee, accumulator) {
  27374. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27375. initAccum = arguments.length < 3;
  27376. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27377. }
  27378. /**
  27379. * The opposite of `_.filter`; this method returns the elements of `collection`
  27380. * that `predicate` does **not** return truthy for.
  27381. *
  27382. * @static
  27383. * @memberOf _
  27384. * @since 0.1.0
  27385. * @category Collection
  27386. * @param {Array|Object} collection The collection to iterate over.
  27387. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27388. * @returns {Array} Returns the new filtered array.
  27389. * @see _.filter
  27390. * @example
  27391. *
  27392. * var users = [
  27393. * { 'user': 'barney', 'age': 36, 'active': false },
  27394. * { 'user': 'fred', 'age': 40, 'active': true }
  27395. * ];
  27396. *
  27397. * _.reject(users, function(o) { return !o.active; });
  27398. * // => objects for ['fred']
  27399. *
  27400. * // The `_.matches` iteratee shorthand.
  27401. * _.reject(users, { 'age': 40, 'active': true });
  27402. * // => objects for ['barney']
  27403. *
  27404. * // The `_.matchesProperty` iteratee shorthand.
  27405. * _.reject(users, ['active', false]);
  27406. * // => objects for ['fred']
  27407. *
  27408. * // The `_.property` iteratee shorthand.
  27409. * _.reject(users, 'active');
  27410. * // => objects for ['barney']
  27411. */
  27412. function reject(collection, predicate) {
  27413. var func = isArray(collection) ? arrayFilter : baseFilter;
  27414. return func(collection, negate(getIteratee(predicate, 3)));
  27415. }
  27416. /**
  27417. * Gets a random element from `collection`.
  27418. *
  27419. * @static
  27420. * @memberOf _
  27421. * @since 2.0.0
  27422. * @category Collection
  27423. * @param {Array|Object} collection The collection to sample.
  27424. * @returns {*} Returns the random element.
  27425. * @example
  27426. *
  27427. * _.sample([1, 2, 3, 4]);
  27428. * // => 2
  27429. */
  27430. function sample(collection) {
  27431. var func = isArray(collection) ? arraySample : baseSample;
  27432. return func(collection);
  27433. }
  27434. /**
  27435. * Gets `n` random elements at unique keys from `collection` up to the
  27436. * size of `collection`.
  27437. *
  27438. * @static
  27439. * @memberOf _
  27440. * @since 4.0.0
  27441. * @category Collection
  27442. * @param {Array|Object} collection The collection to sample.
  27443. * @param {number} [n=1] The number of elements to sample.
  27444. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27445. * @returns {Array} Returns the random elements.
  27446. * @example
  27447. *
  27448. * _.sampleSize([1, 2, 3], 2);
  27449. * // => [3, 1]
  27450. *
  27451. * _.sampleSize([1, 2, 3], 4);
  27452. * // => [2, 3, 1]
  27453. */
  27454. function sampleSize(collection, n, guard) {
  27455. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27456. n = 1;
  27457. } else {
  27458. n = toInteger(n);
  27459. }
  27460. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27461. return func(collection, n);
  27462. }
  27463. /**
  27464. * Creates an array of shuffled values, using a version of the
  27465. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27466. *
  27467. * @static
  27468. * @memberOf _
  27469. * @since 0.1.0
  27470. * @category Collection
  27471. * @param {Array|Object} collection The collection to shuffle.
  27472. * @returns {Array} Returns the new shuffled array.
  27473. * @example
  27474. *
  27475. * _.shuffle([1, 2, 3, 4]);
  27476. * // => [4, 1, 3, 2]
  27477. */
  27478. function shuffle(collection) {
  27479. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27480. return func(collection);
  27481. }
  27482. /**
  27483. * Gets the size of `collection` by returning its length for array-like
  27484. * values or the number of own enumerable string keyed properties for objects.
  27485. *
  27486. * @static
  27487. * @memberOf _
  27488. * @since 0.1.0
  27489. * @category Collection
  27490. * @param {Array|Object|string} collection The collection to inspect.
  27491. * @returns {number} Returns the collection size.
  27492. * @example
  27493. *
  27494. * _.size([1, 2, 3]);
  27495. * // => 3
  27496. *
  27497. * _.size({ 'a': 1, 'b': 2 });
  27498. * // => 2
  27499. *
  27500. * _.size('pebbles');
  27501. * // => 7
  27502. */
  27503. function size(collection) {
  27504. if (collection == null) {
  27505. return 0;
  27506. }
  27507. if (isArrayLike(collection)) {
  27508. return isString(collection) ? stringSize(collection) : collection.length;
  27509. }
  27510. var tag = getTag(collection);
  27511. if (tag == mapTag || tag == setTag) {
  27512. return collection.size;
  27513. }
  27514. return baseKeys(collection).length;
  27515. }
  27516. /**
  27517. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27518. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27519. * invoked with three arguments: (value, index|key, collection).
  27520. *
  27521. * @static
  27522. * @memberOf _
  27523. * @since 0.1.0
  27524. * @category Collection
  27525. * @param {Array|Object} collection The collection to iterate over.
  27526. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27527. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27528. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27529. * else `false`.
  27530. * @example
  27531. *
  27532. * _.some([null, 0, 'yes', false], Boolean);
  27533. * // => true
  27534. *
  27535. * var users = [
  27536. * { 'user': 'barney', 'active': true },
  27537. * { 'user': 'fred', 'active': false }
  27538. * ];
  27539. *
  27540. * // The `_.matches` iteratee shorthand.
  27541. * _.some(users, { 'user': 'barney', 'active': false });
  27542. * // => false
  27543. *
  27544. * // The `_.matchesProperty` iteratee shorthand.
  27545. * _.some(users, ['active', false]);
  27546. * // => true
  27547. *
  27548. * // The `_.property` iteratee shorthand.
  27549. * _.some(users, 'active');
  27550. * // => true
  27551. */
  27552. function some(collection, predicate, guard) {
  27553. var func = isArray(collection) ? arraySome : baseSome;
  27554. if (guard && isIterateeCall(collection, predicate, guard)) {
  27555. predicate = undefined;
  27556. }
  27557. return func(collection, getIteratee(predicate, 3));
  27558. }
  27559. /**
  27560. * Creates an array of elements, sorted in ascending order by the results of
  27561. * running each element in a collection thru each iteratee. This method
  27562. * performs a stable sort, that is, it preserves the original sort order of
  27563. * equal elements. The iteratees are invoked with one argument: (value).
  27564. *
  27565. * @static
  27566. * @memberOf _
  27567. * @since 0.1.0
  27568. * @category Collection
  27569. * @param {Array|Object} collection The collection to iterate over.
  27570. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27571. * The iteratees to sort by.
  27572. * @returns {Array} Returns the new sorted array.
  27573. * @example
  27574. *
  27575. * var users = [
  27576. * { 'user': 'fred', 'age': 48 },
  27577. * { 'user': 'barney', 'age': 36 },
  27578. * { 'user': 'fred', 'age': 40 },
  27579. * { 'user': 'barney', 'age': 34 }
  27580. * ];
  27581. *
  27582. * _.sortBy(users, [function(o) { return o.user; }]);
  27583. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27584. *
  27585. * _.sortBy(users, ['user', 'age']);
  27586. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27587. */
  27588. var sortBy = baseRest(function(collection, iteratees) {
  27589. if (collection == null) {
  27590. return [];
  27591. }
  27592. var length = iteratees.length;
  27593. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27594. iteratees = [];
  27595. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27596. iteratees = [iteratees[0]];
  27597. }
  27598. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27599. });
  27600. /*------------------------------------------------------------------------*/
  27601. /**
  27602. * Gets the timestamp of the number of milliseconds that have elapsed since
  27603. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27604. *
  27605. * @static
  27606. * @memberOf _
  27607. * @since 2.4.0
  27608. * @category Date
  27609. * @returns {number} Returns the timestamp.
  27610. * @example
  27611. *
  27612. * _.defer(function(stamp) {
  27613. * console.log(_.now() - stamp);
  27614. * }, _.now());
  27615. * // => Logs the number of milliseconds it took for the deferred invocation.
  27616. */
  27617. var now = ctxNow || function() {
  27618. return root.Date.now();
  27619. };
  27620. /*------------------------------------------------------------------------*/
  27621. /**
  27622. * The opposite of `_.before`; this method creates a function that invokes
  27623. * `func` once it's called `n` or more times.
  27624. *
  27625. * @static
  27626. * @memberOf _
  27627. * @since 0.1.0
  27628. * @category Function
  27629. * @param {number} n The number of calls before `func` is invoked.
  27630. * @param {Function} func The function to restrict.
  27631. * @returns {Function} Returns the new restricted function.
  27632. * @example
  27633. *
  27634. * var saves = ['profile', 'settings'];
  27635. *
  27636. * var done = _.after(saves.length, function() {
  27637. * console.log('done saving!');
  27638. * });
  27639. *
  27640. * _.forEach(saves, function(type) {
  27641. * asyncSave({ 'type': type, 'complete': done });
  27642. * });
  27643. * // => Logs 'done saving!' after the two async saves have completed.
  27644. */
  27645. function after(n, func) {
  27646. if (typeof func != 'function') {
  27647. throw new TypeError(FUNC_ERROR_TEXT);
  27648. }
  27649. n = toInteger(n);
  27650. return function() {
  27651. if (--n < 1) {
  27652. return func.apply(this, arguments);
  27653. }
  27654. };
  27655. }
  27656. /**
  27657. * Creates a function that invokes `func`, with up to `n` arguments,
  27658. * ignoring any additional arguments.
  27659. *
  27660. * @static
  27661. * @memberOf _
  27662. * @since 3.0.0
  27663. * @category Function
  27664. * @param {Function} func The function to cap arguments for.
  27665. * @param {number} [n=func.length] The arity cap.
  27666. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27667. * @returns {Function} Returns the new capped function.
  27668. * @example
  27669. *
  27670. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27671. * // => [6, 8, 10]
  27672. */
  27673. function ary(func, n, guard) {
  27674. n = guard ? undefined : n;
  27675. n = (func && n == null) ? func.length : n;
  27676. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27677. }
  27678. /**
  27679. * Creates a function that invokes `func`, with the `this` binding and arguments
  27680. * of the created function, while it's called less than `n` times. Subsequent
  27681. * calls to the created function return the result of the last `func` invocation.
  27682. *
  27683. * @static
  27684. * @memberOf _
  27685. * @since 3.0.0
  27686. * @category Function
  27687. * @param {number} n The number of calls at which `func` is no longer invoked.
  27688. * @param {Function} func The function to restrict.
  27689. * @returns {Function} Returns the new restricted function.
  27690. * @example
  27691. *
  27692. * jQuery(element).on('click', _.before(5, addContactToList));
  27693. * // => Allows adding up to 4 contacts to the list.
  27694. */
  27695. function before(n, func) {
  27696. var result;
  27697. if (typeof func != 'function') {
  27698. throw new TypeError(FUNC_ERROR_TEXT);
  27699. }
  27700. n = toInteger(n);
  27701. return function() {
  27702. if (--n > 0) {
  27703. result = func.apply(this, arguments);
  27704. }
  27705. if (n <= 1) {
  27706. func = undefined;
  27707. }
  27708. return result;
  27709. };
  27710. }
  27711. /**
  27712. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27713. * and `partials` prepended to the arguments it receives.
  27714. *
  27715. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27716. * may be used as a placeholder for partially applied arguments.
  27717. *
  27718. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27719. * property of bound functions.
  27720. *
  27721. * @static
  27722. * @memberOf _
  27723. * @since 0.1.0
  27724. * @category Function
  27725. * @param {Function} func The function to bind.
  27726. * @param {*} thisArg The `this` binding of `func`.
  27727. * @param {...*} [partials] The arguments to be partially applied.
  27728. * @returns {Function} Returns the new bound function.
  27729. * @example
  27730. *
  27731. * function greet(greeting, punctuation) {
  27732. * return greeting + ' ' + this.user + punctuation;
  27733. * }
  27734. *
  27735. * var object = { 'user': 'fred' };
  27736. *
  27737. * var bound = _.bind(greet, object, 'hi');
  27738. * bound('!');
  27739. * // => 'hi fred!'
  27740. *
  27741. * // Bound with placeholders.
  27742. * var bound = _.bind(greet, object, _, '!');
  27743. * bound('hi');
  27744. * // => 'hi fred!'
  27745. */
  27746. var bind = baseRest(function(func, thisArg, partials) {
  27747. var bitmask = WRAP_BIND_FLAG;
  27748. if (partials.length) {
  27749. var holders = replaceHolders(partials, getHolder(bind));
  27750. bitmask |= WRAP_PARTIAL_FLAG;
  27751. }
  27752. return createWrap(func, bitmask, thisArg, partials, holders);
  27753. });
  27754. /**
  27755. * Creates a function that invokes the method at `object[key]` with `partials`
  27756. * prepended to the arguments it receives.
  27757. *
  27758. * This method differs from `_.bind` by allowing bound functions to reference
  27759. * methods that may be redefined or don't yet exist. See
  27760. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27761. * for more details.
  27762. *
  27763. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27764. * builds, may be used as a placeholder for partially applied arguments.
  27765. *
  27766. * @static
  27767. * @memberOf _
  27768. * @since 0.10.0
  27769. * @category Function
  27770. * @param {Object} object The object to invoke the method on.
  27771. * @param {string} key The key of the method.
  27772. * @param {...*} [partials] The arguments to be partially applied.
  27773. * @returns {Function} Returns the new bound function.
  27774. * @example
  27775. *
  27776. * var object = {
  27777. * 'user': 'fred',
  27778. * 'greet': function(greeting, punctuation) {
  27779. * return greeting + ' ' + this.user + punctuation;
  27780. * }
  27781. * };
  27782. *
  27783. * var bound = _.bindKey(object, 'greet', 'hi');
  27784. * bound('!');
  27785. * // => 'hi fred!'
  27786. *
  27787. * object.greet = function(greeting, punctuation) {
  27788. * return greeting + 'ya ' + this.user + punctuation;
  27789. * };
  27790. *
  27791. * bound('!');
  27792. * // => 'hiya fred!'
  27793. *
  27794. * // Bound with placeholders.
  27795. * var bound = _.bindKey(object, 'greet', _, '!');
  27796. * bound('hi');
  27797. * // => 'hiya fred!'
  27798. */
  27799. var bindKey = baseRest(function(object, key, partials) {
  27800. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27801. if (partials.length) {
  27802. var holders = replaceHolders(partials, getHolder(bindKey));
  27803. bitmask |= WRAP_PARTIAL_FLAG;
  27804. }
  27805. return createWrap(key, bitmask, object, partials, holders);
  27806. });
  27807. /**
  27808. * Creates a function that accepts arguments of `func` and either invokes
  27809. * `func` returning its result, if at least `arity` number of arguments have
  27810. * been provided, or returns a function that accepts the remaining `func`
  27811. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27812. * is not sufficient.
  27813. *
  27814. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27815. * may be used as a placeholder for provided arguments.
  27816. *
  27817. * **Note:** This method doesn't set the "length" property of curried functions.
  27818. *
  27819. * @static
  27820. * @memberOf _
  27821. * @since 2.0.0
  27822. * @category Function
  27823. * @param {Function} func The function to curry.
  27824. * @param {number} [arity=func.length] The arity of `func`.
  27825. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27826. * @returns {Function} Returns the new curried function.
  27827. * @example
  27828. *
  27829. * var abc = function(a, b, c) {
  27830. * return [a, b, c];
  27831. * };
  27832. *
  27833. * var curried = _.curry(abc);
  27834. *
  27835. * curried(1)(2)(3);
  27836. * // => [1, 2, 3]
  27837. *
  27838. * curried(1, 2)(3);
  27839. * // => [1, 2, 3]
  27840. *
  27841. * curried(1, 2, 3);
  27842. * // => [1, 2, 3]
  27843. *
  27844. * // Curried with placeholders.
  27845. * curried(1)(_, 3)(2);
  27846. * // => [1, 2, 3]
  27847. */
  27848. function curry(func, arity, guard) {
  27849. arity = guard ? undefined : arity;
  27850. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27851. result.placeholder = curry.placeholder;
  27852. return result;
  27853. }
  27854. /**
  27855. * This method is like `_.curry` except that arguments are applied to `func`
  27856. * in the manner of `_.partialRight` instead of `_.partial`.
  27857. *
  27858. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27859. * builds, may be used as a placeholder for provided arguments.
  27860. *
  27861. * **Note:** This method doesn't set the "length" property of curried functions.
  27862. *
  27863. * @static
  27864. * @memberOf _
  27865. * @since 3.0.0
  27866. * @category Function
  27867. * @param {Function} func The function to curry.
  27868. * @param {number} [arity=func.length] The arity of `func`.
  27869. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27870. * @returns {Function} Returns the new curried function.
  27871. * @example
  27872. *
  27873. * var abc = function(a, b, c) {
  27874. * return [a, b, c];
  27875. * };
  27876. *
  27877. * var curried = _.curryRight(abc);
  27878. *
  27879. * curried(3)(2)(1);
  27880. * // => [1, 2, 3]
  27881. *
  27882. * curried(2, 3)(1);
  27883. * // => [1, 2, 3]
  27884. *
  27885. * curried(1, 2, 3);
  27886. * // => [1, 2, 3]
  27887. *
  27888. * // Curried with placeholders.
  27889. * curried(3)(1, _)(2);
  27890. * // => [1, 2, 3]
  27891. */
  27892. function curryRight(func, arity, guard) {
  27893. arity = guard ? undefined : arity;
  27894. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27895. result.placeholder = curryRight.placeholder;
  27896. return result;
  27897. }
  27898. /**
  27899. * Creates a debounced function that delays invoking `func` until after `wait`
  27900. * milliseconds have elapsed since the last time the debounced function was
  27901. * invoked. The debounced function comes with a `cancel` method to cancel
  27902. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27903. * Provide `options` to indicate whether `func` should be invoked on the
  27904. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27905. * with the last arguments provided to the debounced function. Subsequent
  27906. * calls to the debounced function return the result of the last `func`
  27907. * invocation.
  27908. *
  27909. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27910. * invoked on the trailing edge of the timeout only if the debounced function
  27911. * is invoked more than once during the `wait` timeout.
  27912. *
  27913. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27914. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27915. *
  27916. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27917. * for details over the differences between `_.debounce` and `_.throttle`.
  27918. *
  27919. * @static
  27920. * @memberOf _
  27921. * @since 0.1.0
  27922. * @category Function
  27923. * @param {Function} func The function to debounce.
  27924. * @param {number} [wait=0] The number of milliseconds to delay.
  27925. * @param {Object} [options={}] The options object.
  27926. * @param {boolean} [options.leading=false]
  27927. * Specify invoking on the leading edge of the timeout.
  27928. * @param {number} [options.maxWait]
  27929. * The maximum time `func` is allowed to be delayed before it's invoked.
  27930. * @param {boolean} [options.trailing=true]
  27931. * Specify invoking on the trailing edge of the timeout.
  27932. * @returns {Function} Returns the new debounced function.
  27933. * @example
  27934. *
  27935. * // Avoid costly calculations while the window size is in flux.
  27936. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27937. *
  27938. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27939. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27940. * 'leading': true,
  27941. * 'trailing': false
  27942. * }));
  27943. *
  27944. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27945. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27946. * var source = new EventSource('/stream');
  27947. * jQuery(source).on('message', debounced);
  27948. *
  27949. * // Cancel the trailing debounced invocation.
  27950. * jQuery(window).on('popstate', debounced.cancel);
  27951. */
  27952. function debounce(func, wait, options) {
  27953. var lastArgs,
  27954. lastThis,
  27955. maxWait,
  27956. result,
  27957. timerId,
  27958. lastCallTime,
  27959. lastInvokeTime = 0,
  27960. leading = false,
  27961. maxing = false,
  27962. trailing = true;
  27963. if (typeof func != 'function') {
  27964. throw new TypeError(FUNC_ERROR_TEXT);
  27965. }
  27966. wait = toNumber(wait) || 0;
  27967. if (isObject(options)) {
  27968. leading = !!options.leading;
  27969. maxing = 'maxWait' in options;
  27970. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27971. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27972. }
  27973. function invokeFunc(time) {
  27974. var args = lastArgs,
  27975. thisArg = lastThis;
  27976. lastArgs = lastThis = undefined;
  27977. lastInvokeTime = time;
  27978. result = func.apply(thisArg, args);
  27979. return result;
  27980. }
  27981. function leadingEdge(time) {
  27982. // Reset any `maxWait` timer.
  27983. lastInvokeTime = time;
  27984. // Start the timer for the trailing edge.
  27985. timerId = setTimeout(timerExpired, wait);
  27986. // Invoke the leading edge.
  27987. return leading ? invokeFunc(time) : result;
  27988. }
  27989. function remainingWait(time) {
  27990. var timeSinceLastCall = time - lastCallTime,
  27991. timeSinceLastInvoke = time - lastInvokeTime,
  27992. timeWaiting = wait - timeSinceLastCall;
  27993. return maxing
  27994. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27995. : timeWaiting;
  27996. }
  27997. function shouldInvoke(time) {
  27998. var timeSinceLastCall = time - lastCallTime,
  27999. timeSinceLastInvoke = time - lastInvokeTime;
  28000. // Either this is the first call, activity has stopped and we're at the
  28001. // trailing edge, the system time has gone backwards and we're treating
  28002. // it as the trailing edge, or we've hit the `maxWait` limit.
  28003. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28004. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28005. }
  28006. function timerExpired() {
  28007. var time = now();
  28008. if (shouldInvoke(time)) {
  28009. return trailingEdge(time);
  28010. }
  28011. // Restart the timer.
  28012. timerId = setTimeout(timerExpired, remainingWait(time));
  28013. }
  28014. function trailingEdge(time) {
  28015. timerId = undefined;
  28016. // Only invoke if we have `lastArgs` which means `func` has been
  28017. // debounced at least once.
  28018. if (trailing && lastArgs) {
  28019. return invokeFunc(time);
  28020. }
  28021. lastArgs = lastThis = undefined;
  28022. return result;
  28023. }
  28024. function cancel() {
  28025. if (timerId !== undefined) {
  28026. clearTimeout(timerId);
  28027. }
  28028. lastInvokeTime = 0;
  28029. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28030. }
  28031. function flush() {
  28032. return timerId === undefined ? result : trailingEdge(now());
  28033. }
  28034. function debounced() {
  28035. var time = now(),
  28036. isInvoking = shouldInvoke(time);
  28037. lastArgs = arguments;
  28038. lastThis = this;
  28039. lastCallTime = time;
  28040. if (isInvoking) {
  28041. if (timerId === undefined) {
  28042. return leadingEdge(lastCallTime);
  28043. }
  28044. if (maxing) {
  28045. // Handle invocations in a tight loop.
  28046. clearTimeout(timerId);
  28047. timerId = setTimeout(timerExpired, wait);
  28048. return invokeFunc(lastCallTime);
  28049. }
  28050. }
  28051. if (timerId === undefined) {
  28052. timerId = setTimeout(timerExpired, wait);
  28053. }
  28054. return result;
  28055. }
  28056. debounced.cancel = cancel;
  28057. debounced.flush = flush;
  28058. return debounced;
  28059. }
  28060. /**
  28061. * Defers invoking the `func` until the current call stack has cleared. Any
  28062. * additional arguments are provided to `func` when it's invoked.
  28063. *
  28064. * @static
  28065. * @memberOf _
  28066. * @since 0.1.0
  28067. * @category Function
  28068. * @param {Function} func The function to defer.
  28069. * @param {...*} [args] The arguments to invoke `func` with.
  28070. * @returns {number} Returns the timer id.
  28071. * @example
  28072. *
  28073. * _.defer(function(text) {
  28074. * console.log(text);
  28075. * }, 'deferred');
  28076. * // => Logs 'deferred' after one millisecond.
  28077. */
  28078. var defer = baseRest(function(func, args) {
  28079. return baseDelay(func, 1, args);
  28080. });
  28081. /**
  28082. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28083. * provided to `func` when it's invoked.
  28084. *
  28085. * @static
  28086. * @memberOf _
  28087. * @since 0.1.0
  28088. * @category Function
  28089. * @param {Function} func The function to delay.
  28090. * @param {number} wait The number of milliseconds to delay invocation.
  28091. * @param {...*} [args] The arguments to invoke `func` with.
  28092. * @returns {number} Returns the timer id.
  28093. * @example
  28094. *
  28095. * _.delay(function(text) {
  28096. * console.log(text);
  28097. * }, 1000, 'later');
  28098. * // => Logs 'later' after one second.
  28099. */
  28100. var delay = baseRest(function(func, wait, args) {
  28101. return baseDelay(func, toNumber(wait) || 0, args);
  28102. });
  28103. /**
  28104. * Creates a function that invokes `func` with arguments reversed.
  28105. *
  28106. * @static
  28107. * @memberOf _
  28108. * @since 4.0.0
  28109. * @category Function
  28110. * @param {Function} func The function to flip arguments for.
  28111. * @returns {Function} Returns the new flipped function.
  28112. * @example
  28113. *
  28114. * var flipped = _.flip(function() {
  28115. * return _.toArray(arguments);
  28116. * });
  28117. *
  28118. * flipped('a', 'b', 'c', 'd');
  28119. * // => ['d', 'c', 'b', 'a']
  28120. */
  28121. function flip(func) {
  28122. return createWrap(func, WRAP_FLIP_FLAG);
  28123. }
  28124. /**
  28125. * Creates a function that memoizes the result of `func`. If `resolver` is
  28126. * provided, it determines the cache key for storing the result based on the
  28127. * arguments provided to the memoized function. By default, the first argument
  28128. * provided to the memoized function is used as the map cache key. The `func`
  28129. * is invoked with the `this` binding of the memoized function.
  28130. *
  28131. * **Note:** The cache is exposed as the `cache` property on the memoized
  28132. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28133. * constructor with one whose instances implement the
  28134. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28135. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28136. *
  28137. * @static
  28138. * @memberOf _
  28139. * @since 0.1.0
  28140. * @category Function
  28141. * @param {Function} func The function to have its output memoized.
  28142. * @param {Function} [resolver] The function to resolve the cache key.
  28143. * @returns {Function} Returns the new memoized function.
  28144. * @example
  28145. *
  28146. * var object = { 'a': 1, 'b': 2 };
  28147. * var other = { 'c': 3, 'd': 4 };
  28148. *
  28149. * var values = _.memoize(_.values);
  28150. * values(object);
  28151. * // => [1, 2]
  28152. *
  28153. * values(other);
  28154. * // => [3, 4]
  28155. *
  28156. * object.a = 2;
  28157. * values(object);
  28158. * // => [1, 2]
  28159. *
  28160. * // Modify the result cache.
  28161. * values.cache.set(object, ['a', 'b']);
  28162. * values(object);
  28163. * // => ['a', 'b']
  28164. *
  28165. * // Replace `_.memoize.Cache`.
  28166. * _.memoize.Cache = WeakMap;
  28167. */
  28168. function memoize(func, resolver) {
  28169. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28170. throw new TypeError(FUNC_ERROR_TEXT);
  28171. }
  28172. var memoized = function() {
  28173. var args = arguments,
  28174. key = resolver ? resolver.apply(this, args) : args[0],
  28175. cache = memoized.cache;
  28176. if (cache.has(key)) {
  28177. return cache.get(key);
  28178. }
  28179. var result = func.apply(this, args);
  28180. memoized.cache = cache.set(key, result) || cache;
  28181. return result;
  28182. };
  28183. memoized.cache = new (memoize.Cache || MapCache);
  28184. return memoized;
  28185. }
  28186. // Expose `MapCache`.
  28187. memoize.Cache = MapCache;
  28188. /**
  28189. * Creates a function that negates the result of the predicate `func`. The
  28190. * `func` predicate is invoked with the `this` binding and arguments of the
  28191. * created function.
  28192. *
  28193. * @static
  28194. * @memberOf _
  28195. * @since 3.0.0
  28196. * @category Function
  28197. * @param {Function} predicate The predicate to negate.
  28198. * @returns {Function} Returns the new negated function.
  28199. * @example
  28200. *
  28201. * function isEven(n) {
  28202. * return n % 2 == 0;
  28203. * }
  28204. *
  28205. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28206. * // => [1, 3, 5]
  28207. */
  28208. function negate(predicate) {
  28209. if (typeof predicate != 'function') {
  28210. throw new TypeError(FUNC_ERROR_TEXT);
  28211. }
  28212. return function() {
  28213. var args = arguments;
  28214. switch (args.length) {
  28215. case 0: return !predicate.call(this);
  28216. case 1: return !predicate.call(this, args[0]);
  28217. case 2: return !predicate.call(this, args[0], args[1]);
  28218. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28219. }
  28220. return !predicate.apply(this, args);
  28221. };
  28222. }
  28223. /**
  28224. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28225. * to the function return the value of the first invocation. The `func` is
  28226. * invoked with the `this` binding and arguments of the created function.
  28227. *
  28228. * @static
  28229. * @memberOf _
  28230. * @since 0.1.0
  28231. * @category Function
  28232. * @param {Function} func The function to restrict.
  28233. * @returns {Function} Returns the new restricted function.
  28234. * @example
  28235. *
  28236. * var initialize = _.once(createApplication);
  28237. * initialize();
  28238. * initialize();
  28239. * // => `createApplication` is invoked once
  28240. */
  28241. function once(func) {
  28242. return before(2, func);
  28243. }
  28244. /**
  28245. * Creates a function that invokes `func` with its arguments transformed.
  28246. *
  28247. * @static
  28248. * @since 4.0.0
  28249. * @memberOf _
  28250. * @category Function
  28251. * @param {Function} func The function to wrap.
  28252. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28253. * The argument transforms.
  28254. * @returns {Function} Returns the new function.
  28255. * @example
  28256. *
  28257. * function doubled(n) {
  28258. * return n * 2;
  28259. * }
  28260. *
  28261. * function square(n) {
  28262. * return n * n;
  28263. * }
  28264. *
  28265. * var func = _.overArgs(function(x, y) {
  28266. * return [x, y];
  28267. * }, [square, doubled]);
  28268. *
  28269. * func(9, 3);
  28270. * // => [81, 6]
  28271. *
  28272. * func(10, 5);
  28273. * // => [100, 10]
  28274. */
  28275. var overArgs = castRest(function(func, transforms) {
  28276. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28277. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28278. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28279. var funcsLength = transforms.length;
  28280. return baseRest(function(args) {
  28281. var index = -1,
  28282. length = nativeMin(args.length, funcsLength);
  28283. while (++index < length) {
  28284. args[index] = transforms[index].call(this, args[index]);
  28285. }
  28286. return apply(func, this, args);
  28287. });
  28288. });
  28289. /**
  28290. * Creates a function that invokes `func` with `partials` prepended to the
  28291. * arguments it receives. This method is like `_.bind` except it does **not**
  28292. * alter the `this` binding.
  28293. *
  28294. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28295. * builds, may be used as a placeholder for partially applied arguments.
  28296. *
  28297. * **Note:** This method doesn't set the "length" property of partially
  28298. * applied functions.
  28299. *
  28300. * @static
  28301. * @memberOf _
  28302. * @since 0.2.0
  28303. * @category Function
  28304. * @param {Function} func The function to partially apply arguments to.
  28305. * @param {...*} [partials] The arguments to be partially applied.
  28306. * @returns {Function} Returns the new partially applied function.
  28307. * @example
  28308. *
  28309. * function greet(greeting, name) {
  28310. * return greeting + ' ' + name;
  28311. * }
  28312. *
  28313. * var sayHelloTo = _.partial(greet, 'hello');
  28314. * sayHelloTo('fred');
  28315. * // => 'hello fred'
  28316. *
  28317. * // Partially applied with placeholders.
  28318. * var greetFred = _.partial(greet, _, 'fred');
  28319. * greetFred('hi');
  28320. * // => 'hi fred'
  28321. */
  28322. var partial = baseRest(function(func, partials) {
  28323. var holders = replaceHolders(partials, getHolder(partial));
  28324. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28325. });
  28326. /**
  28327. * This method is like `_.partial` except that partially applied arguments
  28328. * are appended to the arguments it receives.
  28329. *
  28330. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28331. * builds, may be used as a placeholder for partially applied arguments.
  28332. *
  28333. * **Note:** This method doesn't set the "length" property of partially
  28334. * applied functions.
  28335. *
  28336. * @static
  28337. * @memberOf _
  28338. * @since 1.0.0
  28339. * @category Function
  28340. * @param {Function} func The function to partially apply arguments to.
  28341. * @param {...*} [partials] The arguments to be partially applied.
  28342. * @returns {Function} Returns the new partially applied function.
  28343. * @example
  28344. *
  28345. * function greet(greeting, name) {
  28346. * return greeting + ' ' + name;
  28347. * }
  28348. *
  28349. * var greetFred = _.partialRight(greet, 'fred');
  28350. * greetFred('hi');
  28351. * // => 'hi fred'
  28352. *
  28353. * // Partially applied with placeholders.
  28354. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28355. * sayHelloTo('fred');
  28356. * // => 'hello fred'
  28357. */
  28358. var partialRight = baseRest(function(func, partials) {
  28359. var holders = replaceHolders(partials, getHolder(partialRight));
  28360. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28361. });
  28362. /**
  28363. * Creates a function that invokes `func` with arguments arranged according
  28364. * to the specified `indexes` where the argument value at the first index is
  28365. * provided as the first argument, the argument value at the second index is
  28366. * provided as the second argument, and so on.
  28367. *
  28368. * @static
  28369. * @memberOf _
  28370. * @since 3.0.0
  28371. * @category Function
  28372. * @param {Function} func The function to rearrange arguments for.
  28373. * @param {...(number|number[])} indexes The arranged argument indexes.
  28374. * @returns {Function} Returns the new function.
  28375. * @example
  28376. *
  28377. * var rearged = _.rearg(function(a, b, c) {
  28378. * return [a, b, c];
  28379. * }, [2, 0, 1]);
  28380. *
  28381. * rearged('b', 'c', 'a')
  28382. * // => ['a', 'b', 'c']
  28383. */
  28384. var rearg = flatRest(function(func, indexes) {
  28385. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28386. });
  28387. /**
  28388. * Creates a function that invokes `func` with the `this` binding of the
  28389. * created function and arguments from `start` and beyond provided as
  28390. * an array.
  28391. *
  28392. * **Note:** This method is based on the
  28393. * [rest parameter](https://mdn.io/rest_parameters).
  28394. *
  28395. * @static
  28396. * @memberOf _
  28397. * @since 4.0.0
  28398. * @category Function
  28399. * @param {Function} func The function to apply a rest parameter to.
  28400. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28401. * @returns {Function} Returns the new function.
  28402. * @example
  28403. *
  28404. * var say = _.rest(function(what, names) {
  28405. * return what + ' ' + _.initial(names).join(', ') +
  28406. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28407. * });
  28408. *
  28409. * say('hello', 'fred', 'barney', 'pebbles');
  28410. * // => 'hello fred, barney, & pebbles'
  28411. */
  28412. function rest(func, start) {
  28413. if (typeof func != 'function') {
  28414. throw new TypeError(FUNC_ERROR_TEXT);
  28415. }
  28416. start = start === undefined ? start : toInteger(start);
  28417. return baseRest(func, start);
  28418. }
  28419. /**
  28420. * Creates a function that invokes `func` with the `this` binding of the
  28421. * create function and an array of arguments much like
  28422. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28423. *
  28424. * **Note:** This method is based on the
  28425. * [spread operator](https://mdn.io/spread_operator).
  28426. *
  28427. * @static
  28428. * @memberOf _
  28429. * @since 3.2.0
  28430. * @category Function
  28431. * @param {Function} func The function to spread arguments over.
  28432. * @param {number} [start=0] The start position of the spread.
  28433. * @returns {Function} Returns the new function.
  28434. * @example
  28435. *
  28436. * var say = _.spread(function(who, what) {
  28437. * return who + ' says ' + what;
  28438. * });
  28439. *
  28440. * say(['fred', 'hello']);
  28441. * // => 'fred says hello'
  28442. *
  28443. * var numbers = Promise.all([
  28444. * Promise.resolve(40),
  28445. * Promise.resolve(36)
  28446. * ]);
  28447. *
  28448. * numbers.then(_.spread(function(x, y) {
  28449. * return x + y;
  28450. * }));
  28451. * // => a Promise of 76
  28452. */
  28453. function spread(func, start) {
  28454. if (typeof func != 'function') {
  28455. throw new TypeError(FUNC_ERROR_TEXT);
  28456. }
  28457. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28458. return baseRest(function(args) {
  28459. var array = args[start],
  28460. otherArgs = castSlice(args, 0, start);
  28461. if (array) {
  28462. arrayPush(otherArgs, array);
  28463. }
  28464. return apply(func, this, otherArgs);
  28465. });
  28466. }
  28467. /**
  28468. * Creates a throttled function that only invokes `func` at most once per
  28469. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28470. * method to cancel delayed `func` invocations and a `flush` method to
  28471. * immediately invoke them. Provide `options` to indicate whether `func`
  28472. * should be invoked on the leading and/or trailing edge of the `wait`
  28473. * timeout. The `func` is invoked with the last arguments provided to the
  28474. * throttled function. Subsequent calls to the throttled function return the
  28475. * result of the last `func` invocation.
  28476. *
  28477. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28478. * invoked on the trailing edge of the timeout only if the throttled function
  28479. * is invoked more than once during the `wait` timeout.
  28480. *
  28481. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28482. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28483. *
  28484. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28485. * for details over the differences between `_.throttle` and `_.debounce`.
  28486. *
  28487. * @static
  28488. * @memberOf _
  28489. * @since 0.1.0
  28490. * @category Function
  28491. * @param {Function} func The function to throttle.
  28492. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28493. * @param {Object} [options={}] The options object.
  28494. * @param {boolean} [options.leading=true]
  28495. * Specify invoking on the leading edge of the timeout.
  28496. * @param {boolean} [options.trailing=true]
  28497. * Specify invoking on the trailing edge of the timeout.
  28498. * @returns {Function} Returns the new throttled function.
  28499. * @example
  28500. *
  28501. * // Avoid excessively updating the position while scrolling.
  28502. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28503. *
  28504. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28505. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28506. * jQuery(element).on('click', throttled);
  28507. *
  28508. * // Cancel the trailing throttled invocation.
  28509. * jQuery(window).on('popstate', throttled.cancel);
  28510. */
  28511. function throttle(func, wait, options) {
  28512. var leading = true,
  28513. trailing = true;
  28514. if (typeof func != 'function') {
  28515. throw new TypeError(FUNC_ERROR_TEXT);
  28516. }
  28517. if (isObject(options)) {
  28518. leading = 'leading' in options ? !!options.leading : leading;
  28519. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28520. }
  28521. return debounce(func, wait, {
  28522. 'leading': leading,
  28523. 'maxWait': wait,
  28524. 'trailing': trailing
  28525. });
  28526. }
  28527. /**
  28528. * Creates a function that accepts up to one argument, ignoring any
  28529. * additional arguments.
  28530. *
  28531. * @static
  28532. * @memberOf _
  28533. * @since 4.0.0
  28534. * @category Function
  28535. * @param {Function} func The function to cap arguments for.
  28536. * @returns {Function} Returns the new capped function.
  28537. * @example
  28538. *
  28539. * _.map(['6', '8', '10'], _.unary(parseInt));
  28540. * // => [6, 8, 10]
  28541. */
  28542. function unary(func) {
  28543. return ary(func, 1);
  28544. }
  28545. /**
  28546. * Creates a function that provides `value` to `wrapper` as its first
  28547. * argument. Any additional arguments provided to the function are appended
  28548. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28549. * binding of the created function.
  28550. *
  28551. * @static
  28552. * @memberOf _
  28553. * @since 0.1.0
  28554. * @category Function
  28555. * @param {*} value The value to wrap.
  28556. * @param {Function} [wrapper=identity] The wrapper function.
  28557. * @returns {Function} Returns the new function.
  28558. * @example
  28559. *
  28560. * var p = _.wrap(_.escape, function(func, text) {
  28561. * return '<p>' + func(text) + '</p>';
  28562. * });
  28563. *
  28564. * p('fred, barney, & pebbles');
  28565. * // => '<p>fred, barney, &amp; pebbles</p>'
  28566. */
  28567. function wrap(value, wrapper) {
  28568. return partial(castFunction(wrapper), value);
  28569. }
  28570. /*------------------------------------------------------------------------*/
  28571. /**
  28572. * Casts `value` as an array if it's not one.
  28573. *
  28574. * @static
  28575. * @memberOf _
  28576. * @since 4.4.0
  28577. * @category Lang
  28578. * @param {*} value The value to inspect.
  28579. * @returns {Array} Returns the cast array.
  28580. * @example
  28581. *
  28582. * _.castArray(1);
  28583. * // => [1]
  28584. *
  28585. * _.castArray({ 'a': 1 });
  28586. * // => [{ 'a': 1 }]
  28587. *
  28588. * _.castArray('abc');
  28589. * // => ['abc']
  28590. *
  28591. * _.castArray(null);
  28592. * // => [null]
  28593. *
  28594. * _.castArray(undefined);
  28595. * // => [undefined]
  28596. *
  28597. * _.castArray();
  28598. * // => []
  28599. *
  28600. * var array = [1, 2, 3];
  28601. * console.log(_.castArray(array) === array);
  28602. * // => true
  28603. */
  28604. function castArray() {
  28605. if (!arguments.length) {
  28606. return [];
  28607. }
  28608. var value = arguments[0];
  28609. return isArray(value) ? value : [value];
  28610. }
  28611. /**
  28612. * Creates a shallow clone of `value`.
  28613. *
  28614. * **Note:** This method is loosely based on the
  28615. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28616. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28617. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28618. * arrays. The own enumerable properties of `arguments` objects are cloned
  28619. * as plain objects. An empty object is returned for uncloneable values such
  28620. * as error objects, functions, DOM nodes, and WeakMaps.
  28621. *
  28622. * @static
  28623. * @memberOf _
  28624. * @since 0.1.0
  28625. * @category Lang
  28626. * @param {*} value The value to clone.
  28627. * @returns {*} Returns the cloned value.
  28628. * @see _.cloneDeep
  28629. * @example
  28630. *
  28631. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28632. *
  28633. * var shallow = _.clone(objects);
  28634. * console.log(shallow[0] === objects[0]);
  28635. * // => true
  28636. */
  28637. function clone(value) {
  28638. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28639. }
  28640. /**
  28641. * This method is like `_.clone` except that it accepts `customizer` which
  28642. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28643. * cloning is handled by the method instead. The `customizer` is invoked with
  28644. * up to four arguments; (value [, index|key, object, stack]).
  28645. *
  28646. * @static
  28647. * @memberOf _
  28648. * @since 4.0.0
  28649. * @category Lang
  28650. * @param {*} value The value to clone.
  28651. * @param {Function} [customizer] The function to customize cloning.
  28652. * @returns {*} Returns the cloned value.
  28653. * @see _.cloneDeepWith
  28654. * @example
  28655. *
  28656. * function customizer(value) {
  28657. * if (_.isElement(value)) {
  28658. * return value.cloneNode(false);
  28659. * }
  28660. * }
  28661. *
  28662. * var el = _.cloneWith(document.body, customizer);
  28663. *
  28664. * console.log(el === document.body);
  28665. * // => false
  28666. * console.log(el.nodeName);
  28667. * // => 'BODY'
  28668. * console.log(el.childNodes.length);
  28669. * // => 0
  28670. */
  28671. function cloneWith(value, customizer) {
  28672. customizer = typeof customizer == 'function' ? customizer : undefined;
  28673. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28674. }
  28675. /**
  28676. * This method is like `_.clone` except that it recursively clones `value`.
  28677. *
  28678. * @static
  28679. * @memberOf _
  28680. * @since 1.0.0
  28681. * @category Lang
  28682. * @param {*} value The value to recursively clone.
  28683. * @returns {*} Returns the deep cloned value.
  28684. * @see _.clone
  28685. * @example
  28686. *
  28687. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28688. *
  28689. * var deep = _.cloneDeep(objects);
  28690. * console.log(deep[0] === objects[0]);
  28691. * // => false
  28692. */
  28693. function cloneDeep(value) {
  28694. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28695. }
  28696. /**
  28697. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28698. *
  28699. * @static
  28700. * @memberOf _
  28701. * @since 4.0.0
  28702. * @category Lang
  28703. * @param {*} value The value to recursively clone.
  28704. * @param {Function} [customizer] The function to customize cloning.
  28705. * @returns {*} Returns the deep cloned value.
  28706. * @see _.cloneWith
  28707. * @example
  28708. *
  28709. * function customizer(value) {
  28710. * if (_.isElement(value)) {
  28711. * return value.cloneNode(true);
  28712. * }
  28713. * }
  28714. *
  28715. * var el = _.cloneDeepWith(document.body, customizer);
  28716. *
  28717. * console.log(el === document.body);
  28718. * // => false
  28719. * console.log(el.nodeName);
  28720. * // => 'BODY'
  28721. * console.log(el.childNodes.length);
  28722. * // => 20
  28723. */
  28724. function cloneDeepWith(value, customizer) {
  28725. customizer = typeof customizer == 'function' ? customizer : undefined;
  28726. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28727. }
  28728. /**
  28729. * Checks if `object` conforms to `source` by invoking the predicate
  28730. * properties of `source` with the corresponding property values of `object`.
  28731. *
  28732. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28733. * partially applied.
  28734. *
  28735. * @static
  28736. * @memberOf _
  28737. * @since 4.14.0
  28738. * @category Lang
  28739. * @param {Object} object The object to inspect.
  28740. * @param {Object} source The object of property predicates to conform to.
  28741. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28742. * @example
  28743. *
  28744. * var object = { 'a': 1, 'b': 2 };
  28745. *
  28746. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28747. * // => true
  28748. *
  28749. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28750. * // => false
  28751. */
  28752. function conformsTo(object, source) {
  28753. return source == null || baseConformsTo(object, source, keys(source));
  28754. }
  28755. /**
  28756. * Performs a
  28757. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28758. * comparison between two values to determine if they are equivalent.
  28759. *
  28760. * @static
  28761. * @memberOf _
  28762. * @since 4.0.0
  28763. * @category Lang
  28764. * @param {*} value The value to compare.
  28765. * @param {*} other The other value to compare.
  28766. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28767. * @example
  28768. *
  28769. * var object = { 'a': 1 };
  28770. * var other = { 'a': 1 };
  28771. *
  28772. * _.eq(object, object);
  28773. * // => true
  28774. *
  28775. * _.eq(object, other);
  28776. * // => false
  28777. *
  28778. * _.eq('a', 'a');
  28779. * // => true
  28780. *
  28781. * _.eq('a', Object('a'));
  28782. * // => false
  28783. *
  28784. * _.eq(NaN, NaN);
  28785. * // => true
  28786. */
  28787. function eq(value, other) {
  28788. return value === other || (value !== value && other !== other);
  28789. }
  28790. /**
  28791. * Checks if `value` is greater than `other`.
  28792. *
  28793. * @static
  28794. * @memberOf _
  28795. * @since 3.9.0
  28796. * @category Lang
  28797. * @param {*} value The value to compare.
  28798. * @param {*} other The other value to compare.
  28799. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28800. * else `false`.
  28801. * @see _.lt
  28802. * @example
  28803. *
  28804. * _.gt(3, 1);
  28805. * // => true
  28806. *
  28807. * _.gt(3, 3);
  28808. * // => false
  28809. *
  28810. * _.gt(1, 3);
  28811. * // => false
  28812. */
  28813. var gt = createRelationalOperation(baseGt);
  28814. /**
  28815. * Checks if `value` is greater than or equal to `other`.
  28816. *
  28817. * @static
  28818. * @memberOf _
  28819. * @since 3.9.0
  28820. * @category Lang
  28821. * @param {*} value The value to compare.
  28822. * @param {*} other The other value to compare.
  28823. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28824. * `other`, else `false`.
  28825. * @see _.lte
  28826. * @example
  28827. *
  28828. * _.gte(3, 1);
  28829. * // => true
  28830. *
  28831. * _.gte(3, 3);
  28832. * // => true
  28833. *
  28834. * _.gte(1, 3);
  28835. * // => false
  28836. */
  28837. var gte = createRelationalOperation(function(value, other) {
  28838. return value >= other;
  28839. });
  28840. /**
  28841. * Checks if `value` is likely an `arguments` object.
  28842. *
  28843. * @static
  28844. * @memberOf _
  28845. * @since 0.1.0
  28846. * @category Lang
  28847. * @param {*} value The value to check.
  28848. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28849. * else `false`.
  28850. * @example
  28851. *
  28852. * _.isArguments(function() { return arguments; }());
  28853. * // => true
  28854. *
  28855. * _.isArguments([1, 2, 3]);
  28856. * // => false
  28857. */
  28858. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28859. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28860. !propertyIsEnumerable.call(value, 'callee');
  28861. };
  28862. /**
  28863. * Checks if `value` is classified as an `Array` object.
  28864. *
  28865. * @static
  28866. * @memberOf _
  28867. * @since 0.1.0
  28868. * @category Lang
  28869. * @param {*} value The value to check.
  28870. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28871. * @example
  28872. *
  28873. * _.isArray([1, 2, 3]);
  28874. * // => true
  28875. *
  28876. * _.isArray(document.body.children);
  28877. * // => false
  28878. *
  28879. * _.isArray('abc');
  28880. * // => false
  28881. *
  28882. * _.isArray(_.noop);
  28883. * // => false
  28884. */
  28885. var isArray = Array.isArray;
  28886. /**
  28887. * Checks if `value` is classified as an `ArrayBuffer` object.
  28888. *
  28889. * @static
  28890. * @memberOf _
  28891. * @since 4.3.0
  28892. * @category Lang
  28893. * @param {*} value The value to check.
  28894. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28895. * @example
  28896. *
  28897. * _.isArrayBuffer(new ArrayBuffer(2));
  28898. * // => true
  28899. *
  28900. * _.isArrayBuffer(new Array(2));
  28901. * // => false
  28902. */
  28903. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28904. /**
  28905. * Checks if `value` is array-like. A value is considered array-like if it's
  28906. * not a function and has a `value.length` that's an integer greater than or
  28907. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28908. *
  28909. * @static
  28910. * @memberOf _
  28911. * @since 4.0.0
  28912. * @category Lang
  28913. * @param {*} value The value to check.
  28914. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28915. * @example
  28916. *
  28917. * _.isArrayLike([1, 2, 3]);
  28918. * // => true
  28919. *
  28920. * _.isArrayLike(document.body.children);
  28921. * // => true
  28922. *
  28923. * _.isArrayLike('abc');
  28924. * // => true
  28925. *
  28926. * _.isArrayLike(_.noop);
  28927. * // => false
  28928. */
  28929. function isArrayLike(value) {
  28930. return value != null && isLength(value.length) && !isFunction(value);
  28931. }
  28932. /**
  28933. * This method is like `_.isArrayLike` except that it also checks if `value`
  28934. * is an object.
  28935. *
  28936. * @static
  28937. * @memberOf _
  28938. * @since 4.0.0
  28939. * @category Lang
  28940. * @param {*} value The value to check.
  28941. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28942. * else `false`.
  28943. * @example
  28944. *
  28945. * _.isArrayLikeObject([1, 2, 3]);
  28946. * // => true
  28947. *
  28948. * _.isArrayLikeObject(document.body.children);
  28949. * // => true
  28950. *
  28951. * _.isArrayLikeObject('abc');
  28952. * // => false
  28953. *
  28954. * _.isArrayLikeObject(_.noop);
  28955. * // => false
  28956. */
  28957. function isArrayLikeObject(value) {
  28958. return isObjectLike(value) && isArrayLike(value);
  28959. }
  28960. /**
  28961. * Checks if `value` is classified as a boolean primitive or object.
  28962. *
  28963. * @static
  28964. * @memberOf _
  28965. * @since 0.1.0
  28966. * @category Lang
  28967. * @param {*} value The value to check.
  28968. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28969. * @example
  28970. *
  28971. * _.isBoolean(false);
  28972. * // => true
  28973. *
  28974. * _.isBoolean(null);
  28975. * // => false
  28976. */
  28977. function isBoolean(value) {
  28978. return value === true || value === false ||
  28979. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28980. }
  28981. /**
  28982. * Checks if `value` is a buffer.
  28983. *
  28984. * @static
  28985. * @memberOf _
  28986. * @since 4.3.0
  28987. * @category Lang
  28988. * @param {*} value The value to check.
  28989. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28990. * @example
  28991. *
  28992. * _.isBuffer(new Buffer(2));
  28993. * // => true
  28994. *
  28995. * _.isBuffer(new Uint8Array(2));
  28996. * // => false
  28997. */
  28998. var isBuffer = nativeIsBuffer || stubFalse;
  28999. /**
  29000. * Checks if `value` is classified as a `Date` object.
  29001. *
  29002. * @static
  29003. * @memberOf _
  29004. * @since 0.1.0
  29005. * @category Lang
  29006. * @param {*} value The value to check.
  29007. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29008. * @example
  29009. *
  29010. * _.isDate(new Date);
  29011. * // => true
  29012. *
  29013. * _.isDate('Mon April 23 2012');
  29014. * // => false
  29015. */
  29016. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29017. /**
  29018. * Checks if `value` is likely a DOM element.
  29019. *
  29020. * @static
  29021. * @memberOf _
  29022. * @since 0.1.0
  29023. * @category Lang
  29024. * @param {*} value The value to check.
  29025. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29026. * @example
  29027. *
  29028. * _.isElement(document.body);
  29029. * // => true
  29030. *
  29031. * _.isElement('<body>');
  29032. * // => false
  29033. */
  29034. function isElement(value) {
  29035. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29036. }
  29037. /**
  29038. * Checks if `value` is an empty object, collection, map, or set.
  29039. *
  29040. * Objects are considered empty if they have no own enumerable string keyed
  29041. * properties.
  29042. *
  29043. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29044. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29045. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29046. *
  29047. * @static
  29048. * @memberOf _
  29049. * @since 0.1.0
  29050. * @category Lang
  29051. * @param {*} value The value to check.
  29052. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29053. * @example
  29054. *
  29055. * _.isEmpty(null);
  29056. * // => true
  29057. *
  29058. * _.isEmpty(true);
  29059. * // => true
  29060. *
  29061. * _.isEmpty(1);
  29062. * // => true
  29063. *
  29064. * _.isEmpty([1, 2, 3]);
  29065. * // => false
  29066. *
  29067. * _.isEmpty({ 'a': 1 });
  29068. * // => false
  29069. */
  29070. function isEmpty(value) {
  29071. if (value == null) {
  29072. return true;
  29073. }
  29074. if (isArrayLike(value) &&
  29075. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29076. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29077. return !value.length;
  29078. }
  29079. var tag = getTag(value);
  29080. if (tag == mapTag || tag == setTag) {
  29081. return !value.size;
  29082. }
  29083. if (isPrototype(value)) {
  29084. return !baseKeys(value).length;
  29085. }
  29086. for (var key in value) {
  29087. if (hasOwnProperty.call(value, key)) {
  29088. return false;
  29089. }
  29090. }
  29091. return true;
  29092. }
  29093. /**
  29094. * Performs a deep comparison between two values to determine if they are
  29095. * equivalent.
  29096. *
  29097. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29098. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29099. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29100. * by their own, not inherited, enumerable properties. Functions and DOM
  29101. * nodes are compared by strict equality, i.e. `===`.
  29102. *
  29103. * @static
  29104. * @memberOf _
  29105. * @since 0.1.0
  29106. * @category Lang
  29107. * @param {*} value The value to compare.
  29108. * @param {*} other The other value to compare.
  29109. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29110. * @example
  29111. *
  29112. * var object = { 'a': 1 };
  29113. * var other = { 'a': 1 };
  29114. *
  29115. * _.isEqual(object, other);
  29116. * // => true
  29117. *
  29118. * object === other;
  29119. * // => false
  29120. */
  29121. function isEqual(value, other) {
  29122. return baseIsEqual(value, other);
  29123. }
  29124. /**
  29125. * This method is like `_.isEqual` except that it accepts `customizer` which
  29126. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29127. * are handled by the method instead. The `customizer` is invoked with up to
  29128. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29129. *
  29130. * @static
  29131. * @memberOf _
  29132. * @since 4.0.0
  29133. * @category Lang
  29134. * @param {*} value The value to compare.
  29135. * @param {*} other The other value to compare.
  29136. * @param {Function} [customizer] The function to customize comparisons.
  29137. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29138. * @example
  29139. *
  29140. * function isGreeting(value) {
  29141. * return /^h(?:i|ello)$/.test(value);
  29142. * }
  29143. *
  29144. * function customizer(objValue, othValue) {
  29145. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29146. * return true;
  29147. * }
  29148. * }
  29149. *
  29150. * var array = ['hello', 'goodbye'];
  29151. * var other = ['hi', 'goodbye'];
  29152. *
  29153. * _.isEqualWith(array, other, customizer);
  29154. * // => true
  29155. */
  29156. function isEqualWith(value, other, customizer) {
  29157. customizer = typeof customizer == 'function' ? customizer : undefined;
  29158. var result = customizer ? customizer(value, other) : undefined;
  29159. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29160. }
  29161. /**
  29162. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29163. * `SyntaxError`, `TypeError`, or `URIError` object.
  29164. *
  29165. * @static
  29166. * @memberOf _
  29167. * @since 3.0.0
  29168. * @category Lang
  29169. * @param {*} value The value to check.
  29170. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29171. * @example
  29172. *
  29173. * _.isError(new Error);
  29174. * // => true
  29175. *
  29176. * _.isError(Error);
  29177. * // => false
  29178. */
  29179. function isError(value) {
  29180. if (!isObjectLike(value)) {
  29181. return false;
  29182. }
  29183. var tag = baseGetTag(value);
  29184. return tag == errorTag || tag == domExcTag ||
  29185. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29186. }
  29187. /**
  29188. * Checks if `value` is a finite primitive number.
  29189. *
  29190. * **Note:** This method is based on
  29191. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29192. *
  29193. * @static
  29194. * @memberOf _
  29195. * @since 0.1.0
  29196. * @category Lang
  29197. * @param {*} value The value to check.
  29198. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29199. * @example
  29200. *
  29201. * _.isFinite(3);
  29202. * // => true
  29203. *
  29204. * _.isFinite(Number.MIN_VALUE);
  29205. * // => true
  29206. *
  29207. * _.isFinite(Infinity);
  29208. * // => false
  29209. *
  29210. * _.isFinite('3');
  29211. * // => false
  29212. */
  29213. function isFinite(value) {
  29214. return typeof value == 'number' && nativeIsFinite(value);
  29215. }
  29216. /**
  29217. * Checks if `value` is classified as a `Function` object.
  29218. *
  29219. * @static
  29220. * @memberOf _
  29221. * @since 0.1.0
  29222. * @category Lang
  29223. * @param {*} value The value to check.
  29224. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29225. * @example
  29226. *
  29227. * _.isFunction(_);
  29228. * // => true
  29229. *
  29230. * _.isFunction(/abc/);
  29231. * // => false
  29232. */
  29233. function isFunction(value) {
  29234. if (!isObject(value)) {
  29235. return false;
  29236. }
  29237. // The use of `Object#toString` avoids issues with the `typeof` operator
  29238. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29239. var tag = baseGetTag(value);
  29240. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29241. }
  29242. /**
  29243. * Checks if `value` is an integer.
  29244. *
  29245. * **Note:** This method is based on
  29246. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29247. *
  29248. * @static
  29249. * @memberOf _
  29250. * @since 4.0.0
  29251. * @category Lang
  29252. * @param {*} value The value to check.
  29253. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29254. * @example
  29255. *
  29256. * _.isInteger(3);
  29257. * // => true
  29258. *
  29259. * _.isInteger(Number.MIN_VALUE);
  29260. * // => false
  29261. *
  29262. * _.isInteger(Infinity);
  29263. * // => false
  29264. *
  29265. * _.isInteger('3');
  29266. * // => false
  29267. */
  29268. function isInteger(value) {
  29269. return typeof value == 'number' && value == toInteger(value);
  29270. }
  29271. /**
  29272. * Checks if `value` is a valid array-like length.
  29273. *
  29274. * **Note:** This method is loosely based on
  29275. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29276. *
  29277. * @static
  29278. * @memberOf _
  29279. * @since 4.0.0
  29280. * @category Lang
  29281. * @param {*} value The value to check.
  29282. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29283. * @example
  29284. *
  29285. * _.isLength(3);
  29286. * // => true
  29287. *
  29288. * _.isLength(Number.MIN_VALUE);
  29289. * // => false
  29290. *
  29291. * _.isLength(Infinity);
  29292. * // => false
  29293. *
  29294. * _.isLength('3');
  29295. * // => false
  29296. */
  29297. function isLength(value) {
  29298. return typeof value == 'number' &&
  29299. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29300. }
  29301. /**
  29302. * Checks if `value` is the
  29303. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29304. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29305. *
  29306. * @static
  29307. * @memberOf _
  29308. * @since 0.1.0
  29309. * @category Lang
  29310. * @param {*} value The value to check.
  29311. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29312. * @example
  29313. *
  29314. * _.isObject({});
  29315. * // => true
  29316. *
  29317. * _.isObject([1, 2, 3]);
  29318. * // => true
  29319. *
  29320. * _.isObject(_.noop);
  29321. * // => true
  29322. *
  29323. * _.isObject(null);
  29324. * // => false
  29325. */
  29326. function isObject(value) {
  29327. var type = typeof value;
  29328. return value != null && (type == 'object' || type == 'function');
  29329. }
  29330. /**
  29331. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29332. * and has a `typeof` result of "object".
  29333. *
  29334. * @static
  29335. * @memberOf _
  29336. * @since 4.0.0
  29337. * @category Lang
  29338. * @param {*} value The value to check.
  29339. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29340. * @example
  29341. *
  29342. * _.isObjectLike({});
  29343. * // => true
  29344. *
  29345. * _.isObjectLike([1, 2, 3]);
  29346. * // => true
  29347. *
  29348. * _.isObjectLike(_.noop);
  29349. * // => false
  29350. *
  29351. * _.isObjectLike(null);
  29352. * // => false
  29353. */
  29354. function isObjectLike(value) {
  29355. return value != null && typeof value == 'object';
  29356. }
  29357. /**
  29358. * Checks if `value` is classified as a `Map` object.
  29359. *
  29360. * @static
  29361. * @memberOf _
  29362. * @since 4.3.0
  29363. * @category Lang
  29364. * @param {*} value The value to check.
  29365. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29366. * @example
  29367. *
  29368. * _.isMap(new Map);
  29369. * // => true
  29370. *
  29371. * _.isMap(new WeakMap);
  29372. * // => false
  29373. */
  29374. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29375. /**
  29376. * Performs a partial deep comparison between `object` and `source` to
  29377. * determine if `object` contains equivalent property values.
  29378. *
  29379. * **Note:** This method is equivalent to `_.matches` when `source` is
  29380. * partially applied.
  29381. *
  29382. * Partial comparisons will match empty array and empty object `source`
  29383. * values against any array or object value, respectively. See `_.isEqual`
  29384. * for a list of supported value comparisons.
  29385. *
  29386. * @static
  29387. * @memberOf _
  29388. * @since 3.0.0
  29389. * @category Lang
  29390. * @param {Object} object The object to inspect.
  29391. * @param {Object} source The object of property values to match.
  29392. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29393. * @example
  29394. *
  29395. * var object = { 'a': 1, 'b': 2 };
  29396. *
  29397. * _.isMatch(object, { 'b': 2 });
  29398. * // => true
  29399. *
  29400. * _.isMatch(object, { 'b': 1 });
  29401. * // => false
  29402. */
  29403. function isMatch(object, source) {
  29404. return object === source || baseIsMatch(object, source, getMatchData(source));
  29405. }
  29406. /**
  29407. * This method is like `_.isMatch` except that it accepts `customizer` which
  29408. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29409. * are handled by the method instead. The `customizer` is invoked with five
  29410. * arguments: (objValue, srcValue, index|key, object, source).
  29411. *
  29412. * @static
  29413. * @memberOf _
  29414. * @since 4.0.0
  29415. * @category Lang
  29416. * @param {Object} object The object to inspect.
  29417. * @param {Object} source The object of property values to match.
  29418. * @param {Function} [customizer] The function to customize comparisons.
  29419. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29420. * @example
  29421. *
  29422. * function isGreeting(value) {
  29423. * return /^h(?:i|ello)$/.test(value);
  29424. * }
  29425. *
  29426. * function customizer(objValue, srcValue) {
  29427. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29428. * return true;
  29429. * }
  29430. * }
  29431. *
  29432. * var object = { 'greeting': 'hello' };
  29433. * var source = { 'greeting': 'hi' };
  29434. *
  29435. * _.isMatchWith(object, source, customizer);
  29436. * // => true
  29437. */
  29438. function isMatchWith(object, source, customizer) {
  29439. customizer = typeof customizer == 'function' ? customizer : undefined;
  29440. return baseIsMatch(object, source, getMatchData(source), customizer);
  29441. }
  29442. /**
  29443. * Checks if `value` is `NaN`.
  29444. *
  29445. * **Note:** This method is based on
  29446. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29447. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29448. * `undefined` and other non-number values.
  29449. *
  29450. * @static
  29451. * @memberOf _
  29452. * @since 0.1.0
  29453. * @category Lang
  29454. * @param {*} value The value to check.
  29455. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29456. * @example
  29457. *
  29458. * _.isNaN(NaN);
  29459. * // => true
  29460. *
  29461. * _.isNaN(new Number(NaN));
  29462. * // => true
  29463. *
  29464. * isNaN(undefined);
  29465. * // => true
  29466. *
  29467. * _.isNaN(undefined);
  29468. * // => false
  29469. */
  29470. function isNaN(value) {
  29471. // An `NaN` primitive is the only value that is not equal to itself.
  29472. // Perform the `toStringTag` check first to avoid errors with some
  29473. // ActiveX objects in IE.
  29474. return isNumber(value) && value != +value;
  29475. }
  29476. /**
  29477. * Checks if `value` is a pristine native function.
  29478. *
  29479. * **Note:** This method can't reliably detect native functions in the presence
  29480. * of the core-js package because core-js circumvents this kind of detection.
  29481. * Despite multiple requests, the core-js maintainer has made it clear: any
  29482. * attempt to fix the detection will be obstructed. As a result, we're left
  29483. * with little choice but to throw an error. Unfortunately, this also affects
  29484. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29485. * which rely on core-js.
  29486. *
  29487. * @static
  29488. * @memberOf _
  29489. * @since 3.0.0
  29490. * @category Lang
  29491. * @param {*} value The value to check.
  29492. * @returns {boolean} Returns `true` if `value` is a native function,
  29493. * else `false`.
  29494. * @example
  29495. *
  29496. * _.isNative(Array.prototype.push);
  29497. * // => true
  29498. *
  29499. * _.isNative(_);
  29500. * // => false
  29501. */
  29502. function isNative(value) {
  29503. if (isMaskable(value)) {
  29504. throw new Error(CORE_ERROR_TEXT);
  29505. }
  29506. return baseIsNative(value);
  29507. }
  29508. /**
  29509. * Checks if `value` is `null`.
  29510. *
  29511. * @static
  29512. * @memberOf _
  29513. * @since 0.1.0
  29514. * @category Lang
  29515. * @param {*} value The value to check.
  29516. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29517. * @example
  29518. *
  29519. * _.isNull(null);
  29520. * // => true
  29521. *
  29522. * _.isNull(void 0);
  29523. * // => false
  29524. */
  29525. function isNull(value) {
  29526. return value === null;
  29527. }
  29528. /**
  29529. * Checks if `value` is `null` or `undefined`.
  29530. *
  29531. * @static
  29532. * @memberOf _
  29533. * @since 4.0.0
  29534. * @category Lang
  29535. * @param {*} value The value to check.
  29536. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29537. * @example
  29538. *
  29539. * _.isNil(null);
  29540. * // => true
  29541. *
  29542. * _.isNil(void 0);
  29543. * // => true
  29544. *
  29545. * _.isNil(NaN);
  29546. * // => false
  29547. */
  29548. function isNil(value) {
  29549. return value == null;
  29550. }
  29551. /**
  29552. * Checks if `value` is classified as a `Number` primitive or object.
  29553. *
  29554. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29555. * classified as numbers, use the `_.isFinite` method.
  29556. *
  29557. * @static
  29558. * @memberOf _
  29559. * @since 0.1.0
  29560. * @category Lang
  29561. * @param {*} value The value to check.
  29562. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29563. * @example
  29564. *
  29565. * _.isNumber(3);
  29566. * // => true
  29567. *
  29568. * _.isNumber(Number.MIN_VALUE);
  29569. * // => true
  29570. *
  29571. * _.isNumber(Infinity);
  29572. * // => true
  29573. *
  29574. * _.isNumber('3');
  29575. * // => false
  29576. */
  29577. function isNumber(value) {
  29578. return typeof value == 'number' ||
  29579. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29580. }
  29581. /**
  29582. * Checks if `value` is a plain object, that is, an object created by the
  29583. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29584. *
  29585. * @static
  29586. * @memberOf _
  29587. * @since 0.8.0
  29588. * @category Lang
  29589. * @param {*} value The value to check.
  29590. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29591. * @example
  29592. *
  29593. * function Foo() {
  29594. * this.a = 1;
  29595. * }
  29596. *
  29597. * _.isPlainObject(new Foo);
  29598. * // => false
  29599. *
  29600. * _.isPlainObject([1, 2, 3]);
  29601. * // => false
  29602. *
  29603. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29604. * // => true
  29605. *
  29606. * _.isPlainObject(Object.create(null));
  29607. * // => true
  29608. */
  29609. function isPlainObject(value) {
  29610. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29611. return false;
  29612. }
  29613. var proto = getPrototype(value);
  29614. if (proto === null) {
  29615. return true;
  29616. }
  29617. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29618. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29619. funcToString.call(Ctor) == objectCtorString;
  29620. }
  29621. /**
  29622. * Checks if `value` is classified as a `RegExp` object.
  29623. *
  29624. * @static
  29625. * @memberOf _
  29626. * @since 0.1.0
  29627. * @category Lang
  29628. * @param {*} value The value to check.
  29629. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29630. * @example
  29631. *
  29632. * _.isRegExp(/abc/);
  29633. * // => true
  29634. *
  29635. * _.isRegExp('/abc/');
  29636. * // => false
  29637. */
  29638. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29639. /**
  29640. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29641. * double precision number which isn't the result of a rounded unsafe integer.
  29642. *
  29643. * **Note:** This method is based on
  29644. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29645. *
  29646. * @static
  29647. * @memberOf _
  29648. * @since 4.0.0
  29649. * @category Lang
  29650. * @param {*} value The value to check.
  29651. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29652. * @example
  29653. *
  29654. * _.isSafeInteger(3);
  29655. * // => true
  29656. *
  29657. * _.isSafeInteger(Number.MIN_VALUE);
  29658. * // => false
  29659. *
  29660. * _.isSafeInteger(Infinity);
  29661. * // => false
  29662. *
  29663. * _.isSafeInteger('3');
  29664. * // => false
  29665. */
  29666. function isSafeInteger(value) {
  29667. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29668. }
  29669. /**
  29670. * Checks if `value` is classified as a `Set` object.
  29671. *
  29672. * @static
  29673. * @memberOf _
  29674. * @since 4.3.0
  29675. * @category Lang
  29676. * @param {*} value The value to check.
  29677. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29678. * @example
  29679. *
  29680. * _.isSet(new Set);
  29681. * // => true
  29682. *
  29683. * _.isSet(new WeakSet);
  29684. * // => false
  29685. */
  29686. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29687. /**
  29688. * Checks if `value` is classified as a `String` primitive or object.
  29689. *
  29690. * @static
  29691. * @since 0.1.0
  29692. * @memberOf _
  29693. * @category Lang
  29694. * @param {*} value The value to check.
  29695. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29696. * @example
  29697. *
  29698. * _.isString('abc');
  29699. * // => true
  29700. *
  29701. * _.isString(1);
  29702. * // => false
  29703. */
  29704. function isString(value) {
  29705. return typeof value == 'string' ||
  29706. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29707. }
  29708. /**
  29709. * Checks if `value` is classified as a `Symbol` primitive or object.
  29710. *
  29711. * @static
  29712. * @memberOf _
  29713. * @since 4.0.0
  29714. * @category Lang
  29715. * @param {*} value The value to check.
  29716. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29717. * @example
  29718. *
  29719. * _.isSymbol(Symbol.iterator);
  29720. * // => true
  29721. *
  29722. * _.isSymbol('abc');
  29723. * // => false
  29724. */
  29725. function isSymbol(value) {
  29726. return typeof value == 'symbol' ||
  29727. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29728. }
  29729. /**
  29730. * Checks if `value` is classified as a typed array.
  29731. *
  29732. * @static
  29733. * @memberOf _
  29734. * @since 3.0.0
  29735. * @category Lang
  29736. * @param {*} value The value to check.
  29737. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29738. * @example
  29739. *
  29740. * _.isTypedArray(new Uint8Array);
  29741. * // => true
  29742. *
  29743. * _.isTypedArray([]);
  29744. * // => false
  29745. */
  29746. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29747. /**
  29748. * Checks if `value` is `undefined`.
  29749. *
  29750. * @static
  29751. * @since 0.1.0
  29752. * @memberOf _
  29753. * @category Lang
  29754. * @param {*} value The value to check.
  29755. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29756. * @example
  29757. *
  29758. * _.isUndefined(void 0);
  29759. * // => true
  29760. *
  29761. * _.isUndefined(null);
  29762. * // => false
  29763. */
  29764. function isUndefined(value) {
  29765. return value === undefined;
  29766. }
  29767. /**
  29768. * Checks if `value` is classified as a `WeakMap` object.
  29769. *
  29770. * @static
  29771. * @memberOf _
  29772. * @since 4.3.0
  29773. * @category Lang
  29774. * @param {*} value The value to check.
  29775. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29776. * @example
  29777. *
  29778. * _.isWeakMap(new WeakMap);
  29779. * // => true
  29780. *
  29781. * _.isWeakMap(new Map);
  29782. * // => false
  29783. */
  29784. function isWeakMap(value) {
  29785. return isObjectLike(value) && getTag(value) == weakMapTag;
  29786. }
  29787. /**
  29788. * Checks if `value` is classified as a `WeakSet` object.
  29789. *
  29790. * @static
  29791. * @memberOf _
  29792. * @since 4.3.0
  29793. * @category Lang
  29794. * @param {*} value The value to check.
  29795. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29796. * @example
  29797. *
  29798. * _.isWeakSet(new WeakSet);
  29799. * // => true
  29800. *
  29801. * _.isWeakSet(new Set);
  29802. * // => false
  29803. */
  29804. function isWeakSet(value) {
  29805. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29806. }
  29807. /**
  29808. * Checks if `value` is less than `other`.
  29809. *
  29810. * @static
  29811. * @memberOf _
  29812. * @since 3.9.0
  29813. * @category Lang
  29814. * @param {*} value The value to compare.
  29815. * @param {*} other The other value to compare.
  29816. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29817. * else `false`.
  29818. * @see _.gt
  29819. * @example
  29820. *
  29821. * _.lt(1, 3);
  29822. * // => true
  29823. *
  29824. * _.lt(3, 3);
  29825. * // => false
  29826. *
  29827. * _.lt(3, 1);
  29828. * // => false
  29829. */
  29830. var lt = createRelationalOperation(baseLt);
  29831. /**
  29832. * Checks if `value` is less than or equal to `other`.
  29833. *
  29834. * @static
  29835. * @memberOf _
  29836. * @since 3.9.0
  29837. * @category Lang
  29838. * @param {*} value The value to compare.
  29839. * @param {*} other The other value to compare.
  29840. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29841. * `other`, else `false`.
  29842. * @see _.gte
  29843. * @example
  29844. *
  29845. * _.lte(1, 3);
  29846. * // => true
  29847. *
  29848. * _.lte(3, 3);
  29849. * // => true
  29850. *
  29851. * _.lte(3, 1);
  29852. * // => false
  29853. */
  29854. var lte = createRelationalOperation(function(value, other) {
  29855. return value <= other;
  29856. });
  29857. /**
  29858. * Converts `value` to an array.
  29859. *
  29860. * @static
  29861. * @since 0.1.0
  29862. * @memberOf _
  29863. * @category Lang
  29864. * @param {*} value The value to convert.
  29865. * @returns {Array} Returns the converted array.
  29866. * @example
  29867. *
  29868. * _.toArray({ 'a': 1, 'b': 2 });
  29869. * // => [1, 2]
  29870. *
  29871. * _.toArray('abc');
  29872. * // => ['a', 'b', 'c']
  29873. *
  29874. * _.toArray(1);
  29875. * // => []
  29876. *
  29877. * _.toArray(null);
  29878. * // => []
  29879. */
  29880. function toArray(value) {
  29881. if (!value) {
  29882. return [];
  29883. }
  29884. if (isArrayLike(value)) {
  29885. return isString(value) ? stringToArray(value) : copyArray(value);
  29886. }
  29887. if (symIterator && value[symIterator]) {
  29888. return iteratorToArray(value[symIterator]());
  29889. }
  29890. var tag = getTag(value),
  29891. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29892. return func(value);
  29893. }
  29894. /**
  29895. * Converts `value` to a finite number.
  29896. *
  29897. * @static
  29898. * @memberOf _
  29899. * @since 4.12.0
  29900. * @category Lang
  29901. * @param {*} value The value to convert.
  29902. * @returns {number} Returns the converted number.
  29903. * @example
  29904. *
  29905. * _.toFinite(3.2);
  29906. * // => 3.2
  29907. *
  29908. * _.toFinite(Number.MIN_VALUE);
  29909. * // => 5e-324
  29910. *
  29911. * _.toFinite(Infinity);
  29912. * // => 1.7976931348623157e+308
  29913. *
  29914. * _.toFinite('3.2');
  29915. * // => 3.2
  29916. */
  29917. function toFinite(value) {
  29918. if (!value) {
  29919. return value === 0 ? value : 0;
  29920. }
  29921. value = toNumber(value);
  29922. if (value === INFINITY || value === -INFINITY) {
  29923. var sign = (value < 0 ? -1 : 1);
  29924. return sign * MAX_INTEGER;
  29925. }
  29926. return value === value ? value : 0;
  29927. }
  29928. /**
  29929. * Converts `value` to an integer.
  29930. *
  29931. * **Note:** This method is loosely based on
  29932. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29933. *
  29934. * @static
  29935. * @memberOf _
  29936. * @since 4.0.0
  29937. * @category Lang
  29938. * @param {*} value The value to convert.
  29939. * @returns {number} Returns the converted integer.
  29940. * @example
  29941. *
  29942. * _.toInteger(3.2);
  29943. * // => 3
  29944. *
  29945. * _.toInteger(Number.MIN_VALUE);
  29946. * // => 0
  29947. *
  29948. * _.toInteger(Infinity);
  29949. * // => 1.7976931348623157e+308
  29950. *
  29951. * _.toInteger('3.2');
  29952. * // => 3
  29953. */
  29954. function toInteger(value) {
  29955. var result = toFinite(value),
  29956. remainder = result % 1;
  29957. return result === result ? (remainder ? result - remainder : result) : 0;
  29958. }
  29959. /**
  29960. * Converts `value` to an integer suitable for use as the length of an
  29961. * array-like object.
  29962. *
  29963. * **Note:** This method is based on
  29964. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29965. *
  29966. * @static
  29967. * @memberOf _
  29968. * @since 4.0.0
  29969. * @category Lang
  29970. * @param {*} value The value to convert.
  29971. * @returns {number} Returns the converted integer.
  29972. * @example
  29973. *
  29974. * _.toLength(3.2);
  29975. * // => 3
  29976. *
  29977. * _.toLength(Number.MIN_VALUE);
  29978. * // => 0
  29979. *
  29980. * _.toLength(Infinity);
  29981. * // => 4294967295
  29982. *
  29983. * _.toLength('3.2');
  29984. * // => 3
  29985. */
  29986. function toLength(value) {
  29987. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29988. }
  29989. /**
  29990. * Converts `value` to a number.
  29991. *
  29992. * @static
  29993. * @memberOf _
  29994. * @since 4.0.0
  29995. * @category Lang
  29996. * @param {*} value The value to process.
  29997. * @returns {number} Returns the number.
  29998. * @example
  29999. *
  30000. * _.toNumber(3.2);
  30001. * // => 3.2
  30002. *
  30003. * _.toNumber(Number.MIN_VALUE);
  30004. * // => 5e-324
  30005. *
  30006. * _.toNumber(Infinity);
  30007. * // => Infinity
  30008. *
  30009. * _.toNumber('3.2');
  30010. * // => 3.2
  30011. */
  30012. function toNumber(value) {
  30013. if (typeof value == 'number') {
  30014. return value;
  30015. }
  30016. if (isSymbol(value)) {
  30017. return NAN;
  30018. }
  30019. if (isObject(value)) {
  30020. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30021. value = isObject(other) ? (other + '') : other;
  30022. }
  30023. if (typeof value != 'string') {
  30024. return value === 0 ? value : +value;
  30025. }
  30026. value = value.replace(reTrim, '');
  30027. var isBinary = reIsBinary.test(value);
  30028. return (isBinary || reIsOctal.test(value))
  30029. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30030. : (reIsBadHex.test(value) ? NAN : +value);
  30031. }
  30032. /**
  30033. * Converts `value` to a plain object flattening inherited enumerable string
  30034. * keyed properties of `value` to own properties of the plain object.
  30035. *
  30036. * @static
  30037. * @memberOf _
  30038. * @since 3.0.0
  30039. * @category Lang
  30040. * @param {*} value The value to convert.
  30041. * @returns {Object} Returns the converted plain object.
  30042. * @example
  30043. *
  30044. * function Foo() {
  30045. * this.b = 2;
  30046. * }
  30047. *
  30048. * Foo.prototype.c = 3;
  30049. *
  30050. * _.assign({ 'a': 1 }, new Foo);
  30051. * // => { 'a': 1, 'b': 2 }
  30052. *
  30053. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30054. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30055. */
  30056. function toPlainObject(value) {
  30057. return copyObject(value, keysIn(value));
  30058. }
  30059. /**
  30060. * Converts `value` to a safe integer. A safe integer can be compared and
  30061. * represented correctly.
  30062. *
  30063. * @static
  30064. * @memberOf _
  30065. * @since 4.0.0
  30066. * @category Lang
  30067. * @param {*} value The value to convert.
  30068. * @returns {number} Returns the converted integer.
  30069. * @example
  30070. *
  30071. * _.toSafeInteger(3.2);
  30072. * // => 3
  30073. *
  30074. * _.toSafeInteger(Number.MIN_VALUE);
  30075. * // => 0
  30076. *
  30077. * _.toSafeInteger(Infinity);
  30078. * // => 9007199254740991
  30079. *
  30080. * _.toSafeInteger('3.2');
  30081. * // => 3
  30082. */
  30083. function toSafeInteger(value) {
  30084. return value
  30085. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30086. : (value === 0 ? value : 0);
  30087. }
  30088. /**
  30089. * Converts `value` to a string. An empty string is returned for `null`
  30090. * and `undefined` values. The sign of `-0` is preserved.
  30091. *
  30092. * @static
  30093. * @memberOf _
  30094. * @since 4.0.0
  30095. * @category Lang
  30096. * @param {*} value The value to convert.
  30097. * @returns {string} Returns the converted string.
  30098. * @example
  30099. *
  30100. * _.toString(null);
  30101. * // => ''
  30102. *
  30103. * _.toString(-0);
  30104. * // => '-0'
  30105. *
  30106. * _.toString([1, 2, 3]);
  30107. * // => '1,2,3'
  30108. */
  30109. function toString(value) {
  30110. return value == null ? '' : baseToString(value);
  30111. }
  30112. /*------------------------------------------------------------------------*/
  30113. /**
  30114. * Assigns own enumerable string keyed properties of source objects to the
  30115. * destination object. Source objects are applied from left to right.
  30116. * Subsequent sources overwrite property assignments of previous sources.
  30117. *
  30118. * **Note:** This method mutates `object` and is loosely based on
  30119. * [`Object.assign`](https://mdn.io/Object/assign).
  30120. *
  30121. * @static
  30122. * @memberOf _
  30123. * @since 0.10.0
  30124. * @category Object
  30125. * @param {Object} object The destination object.
  30126. * @param {...Object} [sources] The source objects.
  30127. * @returns {Object} Returns `object`.
  30128. * @see _.assignIn
  30129. * @example
  30130. *
  30131. * function Foo() {
  30132. * this.a = 1;
  30133. * }
  30134. *
  30135. * function Bar() {
  30136. * this.c = 3;
  30137. * }
  30138. *
  30139. * Foo.prototype.b = 2;
  30140. * Bar.prototype.d = 4;
  30141. *
  30142. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30143. * // => { 'a': 1, 'c': 3 }
  30144. */
  30145. var assign = createAssigner(function(object, source) {
  30146. if (isPrototype(source) || isArrayLike(source)) {
  30147. copyObject(source, keys(source), object);
  30148. return;
  30149. }
  30150. for (var key in source) {
  30151. if (hasOwnProperty.call(source, key)) {
  30152. assignValue(object, key, source[key]);
  30153. }
  30154. }
  30155. });
  30156. /**
  30157. * This method is like `_.assign` except that it iterates over own and
  30158. * inherited source properties.
  30159. *
  30160. * **Note:** This method mutates `object`.
  30161. *
  30162. * @static
  30163. * @memberOf _
  30164. * @since 4.0.0
  30165. * @alias extend
  30166. * @category Object
  30167. * @param {Object} object The destination object.
  30168. * @param {...Object} [sources] The source objects.
  30169. * @returns {Object} Returns `object`.
  30170. * @see _.assign
  30171. * @example
  30172. *
  30173. * function Foo() {
  30174. * this.a = 1;
  30175. * }
  30176. *
  30177. * function Bar() {
  30178. * this.c = 3;
  30179. * }
  30180. *
  30181. * Foo.prototype.b = 2;
  30182. * Bar.prototype.d = 4;
  30183. *
  30184. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30185. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30186. */
  30187. var assignIn = createAssigner(function(object, source) {
  30188. copyObject(source, keysIn(source), object);
  30189. });
  30190. /**
  30191. * This method is like `_.assignIn` except that it accepts `customizer`
  30192. * which is invoked to produce the assigned values. If `customizer` returns
  30193. * `undefined`, assignment is handled by the method instead. The `customizer`
  30194. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30195. *
  30196. * **Note:** This method mutates `object`.
  30197. *
  30198. * @static
  30199. * @memberOf _
  30200. * @since 4.0.0
  30201. * @alias extendWith
  30202. * @category Object
  30203. * @param {Object} object The destination object.
  30204. * @param {...Object} sources The source objects.
  30205. * @param {Function} [customizer] The function to customize assigned values.
  30206. * @returns {Object} Returns `object`.
  30207. * @see _.assignWith
  30208. * @example
  30209. *
  30210. * function customizer(objValue, srcValue) {
  30211. * return _.isUndefined(objValue) ? srcValue : objValue;
  30212. * }
  30213. *
  30214. * var defaults = _.partialRight(_.assignInWith, customizer);
  30215. *
  30216. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30217. * // => { 'a': 1, 'b': 2 }
  30218. */
  30219. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30220. copyObject(source, keysIn(source), object, customizer);
  30221. });
  30222. /**
  30223. * This method is like `_.assign` except that it accepts `customizer`
  30224. * which is invoked to produce the assigned values. If `customizer` returns
  30225. * `undefined`, assignment is handled by the method instead. The `customizer`
  30226. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30227. *
  30228. * **Note:** This method mutates `object`.
  30229. *
  30230. * @static
  30231. * @memberOf _
  30232. * @since 4.0.0
  30233. * @category Object
  30234. * @param {Object} object The destination object.
  30235. * @param {...Object} sources The source objects.
  30236. * @param {Function} [customizer] The function to customize assigned values.
  30237. * @returns {Object} Returns `object`.
  30238. * @see _.assignInWith
  30239. * @example
  30240. *
  30241. * function customizer(objValue, srcValue) {
  30242. * return _.isUndefined(objValue) ? srcValue : objValue;
  30243. * }
  30244. *
  30245. * var defaults = _.partialRight(_.assignWith, customizer);
  30246. *
  30247. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30248. * // => { 'a': 1, 'b': 2 }
  30249. */
  30250. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30251. copyObject(source, keys(source), object, customizer);
  30252. });
  30253. /**
  30254. * Creates an array of values corresponding to `paths` of `object`.
  30255. *
  30256. * @static
  30257. * @memberOf _
  30258. * @since 1.0.0
  30259. * @category Object
  30260. * @param {Object} object The object to iterate over.
  30261. * @param {...(string|string[])} [paths] The property paths to pick.
  30262. * @returns {Array} Returns the picked values.
  30263. * @example
  30264. *
  30265. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30266. *
  30267. * _.at(object, ['a[0].b.c', 'a[1]']);
  30268. * // => [3, 4]
  30269. */
  30270. var at = flatRest(baseAt);
  30271. /**
  30272. * Creates an object that inherits from the `prototype` object. If a
  30273. * `properties` object is given, its own enumerable string keyed properties
  30274. * are assigned to the created object.
  30275. *
  30276. * @static
  30277. * @memberOf _
  30278. * @since 2.3.0
  30279. * @category Object
  30280. * @param {Object} prototype The object to inherit from.
  30281. * @param {Object} [properties] The properties to assign to the object.
  30282. * @returns {Object} Returns the new object.
  30283. * @example
  30284. *
  30285. * function Shape() {
  30286. * this.x = 0;
  30287. * this.y = 0;
  30288. * }
  30289. *
  30290. * function Circle() {
  30291. * Shape.call(this);
  30292. * }
  30293. *
  30294. * Circle.prototype = _.create(Shape.prototype, {
  30295. * 'constructor': Circle
  30296. * });
  30297. *
  30298. * var circle = new Circle;
  30299. * circle instanceof Circle;
  30300. * // => true
  30301. *
  30302. * circle instanceof Shape;
  30303. * // => true
  30304. */
  30305. function create(prototype, properties) {
  30306. var result = baseCreate(prototype);
  30307. return properties == null ? result : baseAssign(result, properties);
  30308. }
  30309. /**
  30310. * Assigns own and inherited enumerable string keyed properties of source
  30311. * objects to the destination object for all destination properties that
  30312. * resolve to `undefined`. Source objects are applied from left to right.
  30313. * Once a property is set, additional values of the same property are ignored.
  30314. *
  30315. * **Note:** This method mutates `object`.
  30316. *
  30317. * @static
  30318. * @since 0.1.0
  30319. * @memberOf _
  30320. * @category Object
  30321. * @param {Object} object The destination object.
  30322. * @param {...Object} [sources] The source objects.
  30323. * @returns {Object} Returns `object`.
  30324. * @see _.defaultsDeep
  30325. * @example
  30326. *
  30327. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30328. * // => { 'a': 1, 'b': 2 }
  30329. */
  30330. var defaults = baseRest(function(object, sources) {
  30331. object = Object(object);
  30332. var index = -1;
  30333. var length = sources.length;
  30334. var guard = length > 2 ? sources[2] : undefined;
  30335. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30336. length = 1;
  30337. }
  30338. while (++index < length) {
  30339. var source = sources[index];
  30340. var props = keysIn(source);
  30341. var propsIndex = -1;
  30342. var propsLength = props.length;
  30343. while (++propsIndex < propsLength) {
  30344. var key = props[propsIndex];
  30345. var value = object[key];
  30346. if (value === undefined ||
  30347. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30348. object[key] = source[key];
  30349. }
  30350. }
  30351. }
  30352. return object;
  30353. });
  30354. /**
  30355. * This method is like `_.defaults` except that it recursively assigns
  30356. * default properties.
  30357. *
  30358. * **Note:** This method mutates `object`.
  30359. *
  30360. * @static
  30361. * @memberOf _
  30362. * @since 3.10.0
  30363. * @category Object
  30364. * @param {Object} object The destination object.
  30365. * @param {...Object} [sources] The source objects.
  30366. * @returns {Object} Returns `object`.
  30367. * @see _.defaults
  30368. * @example
  30369. *
  30370. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30371. * // => { 'a': { 'b': 2, 'c': 3 } }
  30372. */
  30373. var defaultsDeep = baseRest(function(args) {
  30374. args.push(undefined, customDefaultsMerge);
  30375. return apply(mergeWith, undefined, args);
  30376. });
  30377. /**
  30378. * This method is like `_.find` except that it returns the key of the first
  30379. * element `predicate` returns truthy for instead of the element itself.
  30380. *
  30381. * @static
  30382. * @memberOf _
  30383. * @since 1.1.0
  30384. * @category Object
  30385. * @param {Object} object The object to inspect.
  30386. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30387. * @returns {string|undefined} Returns the key of the matched element,
  30388. * else `undefined`.
  30389. * @example
  30390. *
  30391. * var users = {
  30392. * 'barney': { 'age': 36, 'active': true },
  30393. * 'fred': { 'age': 40, 'active': false },
  30394. * 'pebbles': { 'age': 1, 'active': true }
  30395. * };
  30396. *
  30397. * _.findKey(users, function(o) { return o.age < 40; });
  30398. * // => 'barney' (iteration order is not guaranteed)
  30399. *
  30400. * // The `_.matches` iteratee shorthand.
  30401. * _.findKey(users, { 'age': 1, 'active': true });
  30402. * // => 'pebbles'
  30403. *
  30404. * // The `_.matchesProperty` iteratee shorthand.
  30405. * _.findKey(users, ['active', false]);
  30406. * // => 'fred'
  30407. *
  30408. * // The `_.property` iteratee shorthand.
  30409. * _.findKey(users, 'active');
  30410. * // => 'barney'
  30411. */
  30412. function findKey(object, predicate) {
  30413. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30414. }
  30415. /**
  30416. * This method is like `_.findKey` except that it iterates over elements of
  30417. * a collection in the opposite order.
  30418. *
  30419. * @static
  30420. * @memberOf _
  30421. * @since 2.0.0
  30422. * @category Object
  30423. * @param {Object} object The object to inspect.
  30424. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30425. * @returns {string|undefined} Returns the key of the matched element,
  30426. * else `undefined`.
  30427. * @example
  30428. *
  30429. * var users = {
  30430. * 'barney': { 'age': 36, 'active': true },
  30431. * 'fred': { 'age': 40, 'active': false },
  30432. * 'pebbles': { 'age': 1, 'active': true }
  30433. * };
  30434. *
  30435. * _.findLastKey(users, function(o) { return o.age < 40; });
  30436. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30437. *
  30438. * // The `_.matches` iteratee shorthand.
  30439. * _.findLastKey(users, { 'age': 36, 'active': true });
  30440. * // => 'barney'
  30441. *
  30442. * // The `_.matchesProperty` iteratee shorthand.
  30443. * _.findLastKey(users, ['active', false]);
  30444. * // => 'fred'
  30445. *
  30446. * // The `_.property` iteratee shorthand.
  30447. * _.findLastKey(users, 'active');
  30448. * // => 'pebbles'
  30449. */
  30450. function findLastKey(object, predicate) {
  30451. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30452. }
  30453. /**
  30454. * Iterates over own and inherited enumerable string keyed properties of an
  30455. * object and invokes `iteratee` for each property. The iteratee is invoked
  30456. * with three arguments: (value, key, object). Iteratee functions may exit
  30457. * iteration early by explicitly returning `false`.
  30458. *
  30459. * @static
  30460. * @memberOf _
  30461. * @since 0.3.0
  30462. * @category Object
  30463. * @param {Object} object The object to iterate over.
  30464. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30465. * @returns {Object} Returns `object`.
  30466. * @see _.forInRight
  30467. * @example
  30468. *
  30469. * function Foo() {
  30470. * this.a = 1;
  30471. * this.b = 2;
  30472. * }
  30473. *
  30474. * Foo.prototype.c = 3;
  30475. *
  30476. * _.forIn(new Foo, function(value, key) {
  30477. * console.log(key);
  30478. * });
  30479. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30480. */
  30481. function forIn(object, iteratee) {
  30482. return object == null
  30483. ? object
  30484. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30485. }
  30486. /**
  30487. * This method is like `_.forIn` except that it iterates over properties of
  30488. * `object` in the opposite order.
  30489. *
  30490. * @static
  30491. * @memberOf _
  30492. * @since 2.0.0
  30493. * @category Object
  30494. * @param {Object} object The object to iterate over.
  30495. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30496. * @returns {Object} Returns `object`.
  30497. * @see _.forIn
  30498. * @example
  30499. *
  30500. * function Foo() {
  30501. * this.a = 1;
  30502. * this.b = 2;
  30503. * }
  30504. *
  30505. * Foo.prototype.c = 3;
  30506. *
  30507. * _.forInRight(new Foo, function(value, key) {
  30508. * console.log(key);
  30509. * });
  30510. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30511. */
  30512. function forInRight(object, iteratee) {
  30513. return object == null
  30514. ? object
  30515. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30516. }
  30517. /**
  30518. * Iterates over own enumerable string keyed properties of an object and
  30519. * invokes `iteratee` for each property. The iteratee is invoked with three
  30520. * arguments: (value, key, object). Iteratee functions may exit iteration
  30521. * early by explicitly returning `false`.
  30522. *
  30523. * @static
  30524. * @memberOf _
  30525. * @since 0.3.0
  30526. * @category Object
  30527. * @param {Object} object The object to iterate over.
  30528. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30529. * @returns {Object} Returns `object`.
  30530. * @see _.forOwnRight
  30531. * @example
  30532. *
  30533. * function Foo() {
  30534. * this.a = 1;
  30535. * this.b = 2;
  30536. * }
  30537. *
  30538. * Foo.prototype.c = 3;
  30539. *
  30540. * _.forOwn(new Foo, function(value, key) {
  30541. * console.log(key);
  30542. * });
  30543. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30544. */
  30545. function forOwn(object, iteratee) {
  30546. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30547. }
  30548. /**
  30549. * This method is like `_.forOwn` except that it iterates over properties of
  30550. * `object` in the opposite order.
  30551. *
  30552. * @static
  30553. * @memberOf _
  30554. * @since 2.0.0
  30555. * @category Object
  30556. * @param {Object} object The object to iterate over.
  30557. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30558. * @returns {Object} Returns `object`.
  30559. * @see _.forOwn
  30560. * @example
  30561. *
  30562. * function Foo() {
  30563. * this.a = 1;
  30564. * this.b = 2;
  30565. * }
  30566. *
  30567. * Foo.prototype.c = 3;
  30568. *
  30569. * _.forOwnRight(new Foo, function(value, key) {
  30570. * console.log(key);
  30571. * });
  30572. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30573. */
  30574. function forOwnRight(object, iteratee) {
  30575. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30576. }
  30577. /**
  30578. * Creates an array of function property names from own enumerable properties
  30579. * of `object`.
  30580. *
  30581. * @static
  30582. * @since 0.1.0
  30583. * @memberOf _
  30584. * @category Object
  30585. * @param {Object} object The object to inspect.
  30586. * @returns {Array} Returns the function names.
  30587. * @see _.functionsIn
  30588. * @example
  30589. *
  30590. * function Foo() {
  30591. * this.a = _.constant('a');
  30592. * this.b = _.constant('b');
  30593. * }
  30594. *
  30595. * Foo.prototype.c = _.constant('c');
  30596. *
  30597. * _.functions(new Foo);
  30598. * // => ['a', 'b']
  30599. */
  30600. function functions(object) {
  30601. return object == null ? [] : baseFunctions(object, keys(object));
  30602. }
  30603. /**
  30604. * Creates an array of function property names from own and inherited
  30605. * enumerable properties of `object`.
  30606. *
  30607. * @static
  30608. * @memberOf _
  30609. * @since 4.0.0
  30610. * @category Object
  30611. * @param {Object} object The object to inspect.
  30612. * @returns {Array} Returns the function names.
  30613. * @see _.functions
  30614. * @example
  30615. *
  30616. * function Foo() {
  30617. * this.a = _.constant('a');
  30618. * this.b = _.constant('b');
  30619. * }
  30620. *
  30621. * Foo.prototype.c = _.constant('c');
  30622. *
  30623. * _.functionsIn(new Foo);
  30624. * // => ['a', 'b', 'c']
  30625. */
  30626. function functionsIn(object) {
  30627. return object == null ? [] : baseFunctions(object, keysIn(object));
  30628. }
  30629. /**
  30630. * Gets the value at `path` of `object`. If the resolved value is
  30631. * `undefined`, the `defaultValue` is returned in its place.
  30632. *
  30633. * @static
  30634. * @memberOf _
  30635. * @since 3.7.0
  30636. * @category Object
  30637. * @param {Object} object The object to query.
  30638. * @param {Array|string} path The path of the property to get.
  30639. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30640. * @returns {*} Returns the resolved value.
  30641. * @example
  30642. *
  30643. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30644. *
  30645. * _.get(object, 'a[0].b.c');
  30646. * // => 3
  30647. *
  30648. * _.get(object, ['a', '0', 'b', 'c']);
  30649. * // => 3
  30650. *
  30651. * _.get(object, 'a.b.c', 'default');
  30652. * // => 'default'
  30653. */
  30654. function get(object, path, defaultValue) {
  30655. var result = object == null ? undefined : baseGet(object, path);
  30656. return result === undefined ? defaultValue : result;
  30657. }
  30658. /**
  30659. * Checks if `path` is a direct property of `object`.
  30660. *
  30661. * @static
  30662. * @since 0.1.0
  30663. * @memberOf _
  30664. * @category Object
  30665. * @param {Object} object The object to query.
  30666. * @param {Array|string} path The path to check.
  30667. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30668. * @example
  30669. *
  30670. * var object = { 'a': { 'b': 2 } };
  30671. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30672. *
  30673. * _.has(object, 'a');
  30674. * // => true
  30675. *
  30676. * _.has(object, 'a.b');
  30677. * // => true
  30678. *
  30679. * _.has(object, ['a', 'b']);
  30680. * // => true
  30681. *
  30682. * _.has(other, 'a');
  30683. * // => false
  30684. */
  30685. function has(object, path) {
  30686. return object != null && hasPath(object, path, baseHas);
  30687. }
  30688. /**
  30689. * Checks if `path` is a direct or inherited property of `object`.
  30690. *
  30691. * @static
  30692. * @memberOf _
  30693. * @since 4.0.0
  30694. * @category Object
  30695. * @param {Object} object The object to query.
  30696. * @param {Array|string} path The path to check.
  30697. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30698. * @example
  30699. *
  30700. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30701. *
  30702. * _.hasIn(object, 'a');
  30703. * // => true
  30704. *
  30705. * _.hasIn(object, 'a.b');
  30706. * // => true
  30707. *
  30708. * _.hasIn(object, ['a', 'b']);
  30709. * // => true
  30710. *
  30711. * _.hasIn(object, 'b');
  30712. * // => false
  30713. */
  30714. function hasIn(object, path) {
  30715. return object != null && hasPath(object, path, baseHasIn);
  30716. }
  30717. /**
  30718. * Creates an object composed of the inverted keys and values of `object`.
  30719. * If `object` contains duplicate values, subsequent values overwrite
  30720. * property assignments of previous values.
  30721. *
  30722. * @static
  30723. * @memberOf _
  30724. * @since 0.7.0
  30725. * @category Object
  30726. * @param {Object} object The object to invert.
  30727. * @returns {Object} Returns the new inverted object.
  30728. * @example
  30729. *
  30730. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30731. *
  30732. * _.invert(object);
  30733. * // => { '1': 'c', '2': 'b' }
  30734. */
  30735. var invert = createInverter(function(result, value, key) {
  30736. if (value != null &&
  30737. typeof value.toString != 'function') {
  30738. value = nativeObjectToString.call(value);
  30739. }
  30740. result[value] = key;
  30741. }, constant(identity));
  30742. /**
  30743. * This method is like `_.invert` except that the inverted object is generated
  30744. * from the results of running each element of `object` thru `iteratee`. The
  30745. * corresponding inverted value of each inverted key is an array of keys
  30746. * responsible for generating the inverted value. The iteratee is invoked
  30747. * with one argument: (value).
  30748. *
  30749. * @static
  30750. * @memberOf _
  30751. * @since 4.1.0
  30752. * @category Object
  30753. * @param {Object} object The object to invert.
  30754. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30755. * @returns {Object} Returns the new inverted object.
  30756. * @example
  30757. *
  30758. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30759. *
  30760. * _.invertBy(object);
  30761. * // => { '1': ['a', 'c'], '2': ['b'] }
  30762. *
  30763. * _.invertBy(object, function(value) {
  30764. * return 'group' + value;
  30765. * });
  30766. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30767. */
  30768. var invertBy = createInverter(function(result, value, key) {
  30769. if (value != null &&
  30770. typeof value.toString != 'function') {
  30771. value = nativeObjectToString.call(value);
  30772. }
  30773. if (hasOwnProperty.call(result, value)) {
  30774. result[value].push(key);
  30775. } else {
  30776. result[value] = [key];
  30777. }
  30778. }, getIteratee);
  30779. /**
  30780. * Invokes the method at `path` of `object`.
  30781. *
  30782. * @static
  30783. * @memberOf _
  30784. * @since 4.0.0
  30785. * @category Object
  30786. * @param {Object} object The object to query.
  30787. * @param {Array|string} path The path of the method to invoke.
  30788. * @param {...*} [args] The arguments to invoke the method with.
  30789. * @returns {*} Returns the result of the invoked method.
  30790. * @example
  30791. *
  30792. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30793. *
  30794. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30795. * // => [2, 3]
  30796. */
  30797. var invoke = baseRest(baseInvoke);
  30798. /**
  30799. * Creates an array of the own enumerable property names of `object`.
  30800. *
  30801. * **Note:** Non-object values are coerced to objects. See the
  30802. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30803. * for more details.
  30804. *
  30805. * @static
  30806. * @since 0.1.0
  30807. * @memberOf _
  30808. * @category Object
  30809. * @param {Object} object The object to query.
  30810. * @returns {Array} Returns the array of property names.
  30811. * @example
  30812. *
  30813. * function Foo() {
  30814. * this.a = 1;
  30815. * this.b = 2;
  30816. * }
  30817. *
  30818. * Foo.prototype.c = 3;
  30819. *
  30820. * _.keys(new Foo);
  30821. * // => ['a', 'b'] (iteration order is not guaranteed)
  30822. *
  30823. * _.keys('hi');
  30824. * // => ['0', '1']
  30825. */
  30826. function keys(object) {
  30827. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30828. }
  30829. /**
  30830. * Creates an array of the own and inherited enumerable property names of `object`.
  30831. *
  30832. * **Note:** Non-object values are coerced to objects.
  30833. *
  30834. * @static
  30835. * @memberOf _
  30836. * @since 3.0.0
  30837. * @category Object
  30838. * @param {Object} object The object to query.
  30839. * @returns {Array} Returns the array of property names.
  30840. * @example
  30841. *
  30842. * function Foo() {
  30843. * this.a = 1;
  30844. * this.b = 2;
  30845. * }
  30846. *
  30847. * Foo.prototype.c = 3;
  30848. *
  30849. * _.keysIn(new Foo);
  30850. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30851. */
  30852. function keysIn(object) {
  30853. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30854. }
  30855. /**
  30856. * The opposite of `_.mapValues`; this method creates an object with the
  30857. * same values as `object` and keys generated by running each own enumerable
  30858. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30859. * with three arguments: (value, key, object).
  30860. *
  30861. * @static
  30862. * @memberOf _
  30863. * @since 3.8.0
  30864. * @category Object
  30865. * @param {Object} object The object to iterate over.
  30866. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30867. * @returns {Object} Returns the new mapped object.
  30868. * @see _.mapValues
  30869. * @example
  30870. *
  30871. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30872. * return key + value;
  30873. * });
  30874. * // => { 'a1': 1, 'b2': 2 }
  30875. */
  30876. function mapKeys(object, iteratee) {
  30877. var result = {};
  30878. iteratee = getIteratee(iteratee, 3);
  30879. baseForOwn(object, function(value, key, object) {
  30880. baseAssignValue(result, iteratee(value, key, object), value);
  30881. });
  30882. return result;
  30883. }
  30884. /**
  30885. * Creates an object with the same keys as `object` and values generated
  30886. * by running each own enumerable string keyed property of `object` thru
  30887. * `iteratee`. The iteratee is invoked with three arguments:
  30888. * (value, key, object).
  30889. *
  30890. * @static
  30891. * @memberOf _
  30892. * @since 2.4.0
  30893. * @category Object
  30894. * @param {Object} object The object to iterate over.
  30895. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30896. * @returns {Object} Returns the new mapped object.
  30897. * @see _.mapKeys
  30898. * @example
  30899. *
  30900. * var users = {
  30901. * 'fred': { 'user': 'fred', 'age': 40 },
  30902. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30903. * };
  30904. *
  30905. * _.mapValues(users, function(o) { return o.age; });
  30906. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30907. *
  30908. * // The `_.property` iteratee shorthand.
  30909. * _.mapValues(users, 'age');
  30910. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30911. */
  30912. function mapValues(object, iteratee) {
  30913. var result = {};
  30914. iteratee = getIteratee(iteratee, 3);
  30915. baseForOwn(object, function(value, key, object) {
  30916. baseAssignValue(result, key, iteratee(value, key, object));
  30917. });
  30918. return result;
  30919. }
  30920. /**
  30921. * This method is like `_.assign` except that it recursively merges own and
  30922. * inherited enumerable string keyed properties of source objects into the
  30923. * destination object. Source properties that resolve to `undefined` are
  30924. * skipped if a destination value exists. Array and plain object properties
  30925. * are merged recursively. Other objects and value types are overridden by
  30926. * assignment. Source objects are applied from left to right. Subsequent
  30927. * sources overwrite property assignments of previous sources.
  30928. *
  30929. * **Note:** This method mutates `object`.
  30930. *
  30931. * @static
  30932. * @memberOf _
  30933. * @since 0.5.0
  30934. * @category Object
  30935. * @param {Object} object The destination object.
  30936. * @param {...Object} [sources] The source objects.
  30937. * @returns {Object} Returns `object`.
  30938. * @example
  30939. *
  30940. * var object = {
  30941. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30942. * };
  30943. *
  30944. * var other = {
  30945. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30946. * };
  30947. *
  30948. * _.merge(object, other);
  30949. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30950. */
  30951. var merge = createAssigner(function(object, source, srcIndex) {
  30952. baseMerge(object, source, srcIndex);
  30953. });
  30954. /**
  30955. * This method is like `_.merge` except that it accepts `customizer` which
  30956. * is invoked to produce the merged values of the destination and source
  30957. * properties. If `customizer` returns `undefined`, merging is handled by the
  30958. * method instead. The `customizer` is invoked with six arguments:
  30959. * (objValue, srcValue, key, object, source, stack).
  30960. *
  30961. * **Note:** This method mutates `object`.
  30962. *
  30963. * @static
  30964. * @memberOf _
  30965. * @since 4.0.0
  30966. * @category Object
  30967. * @param {Object} object The destination object.
  30968. * @param {...Object} sources The source objects.
  30969. * @param {Function} customizer The function to customize assigned values.
  30970. * @returns {Object} Returns `object`.
  30971. * @example
  30972. *
  30973. * function customizer(objValue, srcValue) {
  30974. * if (_.isArray(objValue)) {
  30975. * return objValue.concat(srcValue);
  30976. * }
  30977. * }
  30978. *
  30979. * var object = { 'a': [1], 'b': [2] };
  30980. * var other = { 'a': [3], 'b': [4] };
  30981. *
  30982. * _.mergeWith(object, other, customizer);
  30983. * // => { 'a': [1, 3], 'b': [2, 4] }
  30984. */
  30985. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30986. baseMerge(object, source, srcIndex, customizer);
  30987. });
  30988. /**
  30989. * The opposite of `_.pick`; this method creates an object composed of the
  30990. * own and inherited enumerable property paths of `object` that are not omitted.
  30991. *
  30992. * **Note:** This method is considerably slower than `_.pick`.
  30993. *
  30994. * @static
  30995. * @since 0.1.0
  30996. * @memberOf _
  30997. * @category Object
  30998. * @param {Object} object The source object.
  30999. * @param {...(string|string[])} [paths] The property paths to omit.
  31000. * @returns {Object} Returns the new object.
  31001. * @example
  31002. *
  31003. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31004. *
  31005. * _.omit(object, ['a', 'c']);
  31006. * // => { 'b': '2' }
  31007. */
  31008. var omit = flatRest(function(object, paths) {
  31009. var result = {};
  31010. if (object == null) {
  31011. return result;
  31012. }
  31013. var isDeep = false;
  31014. paths = arrayMap(paths, function(path) {
  31015. path = castPath(path, object);
  31016. isDeep || (isDeep = path.length > 1);
  31017. return path;
  31018. });
  31019. copyObject(object, getAllKeysIn(object), result);
  31020. if (isDeep) {
  31021. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31022. }
  31023. var length = paths.length;
  31024. while (length--) {
  31025. baseUnset(result, paths[length]);
  31026. }
  31027. return result;
  31028. });
  31029. /**
  31030. * The opposite of `_.pickBy`; this method creates an object composed of
  31031. * the own and inherited enumerable string keyed properties of `object` that
  31032. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31033. * arguments: (value, key).
  31034. *
  31035. * @static
  31036. * @memberOf _
  31037. * @since 4.0.0
  31038. * @category Object
  31039. * @param {Object} object The source object.
  31040. * @param {Function} [predicate=_.identity] The function invoked per property.
  31041. * @returns {Object} Returns the new object.
  31042. * @example
  31043. *
  31044. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31045. *
  31046. * _.omitBy(object, _.isNumber);
  31047. * // => { 'b': '2' }
  31048. */
  31049. function omitBy(object, predicate) {
  31050. return pickBy(object, negate(getIteratee(predicate)));
  31051. }
  31052. /**
  31053. * Creates an object composed of the picked `object` properties.
  31054. *
  31055. * @static
  31056. * @since 0.1.0
  31057. * @memberOf _
  31058. * @category Object
  31059. * @param {Object} object The source object.
  31060. * @param {...(string|string[])} [paths] The property paths to pick.
  31061. * @returns {Object} Returns the new object.
  31062. * @example
  31063. *
  31064. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31065. *
  31066. * _.pick(object, ['a', 'c']);
  31067. * // => { 'a': 1, 'c': 3 }
  31068. */
  31069. var pick = flatRest(function(object, paths) {
  31070. return object == null ? {} : basePick(object, paths);
  31071. });
  31072. /**
  31073. * Creates an object composed of the `object` properties `predicate` returns
  31074. * truthy for. The predicate is invoked with two arguments: (value, key).
  31075. *
  31076. * @static
  31077. * @memberOf _
  31078. * @since 4.0.0
  31079. * @category Object
  31080. * @param {Object} object The source object.
  31081. * @param {Function} [predicate=_.identity] The function invoked per property.
  31082. * @returns {Object} Returns the new object.
  31083. * @example
  31084. *
  31085. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31086. *
  31087. * _.pickBy(object, _.isNumber);
  31088. * // => { 'a': 1, 'c': 3 }
  31089. */
  31090. function pickBy(object, predicate) {
  31091. if (object == null) {
  31092. return {};
  31093. }
  31094. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31095. return [prop];
  31096. });
  31097. predicate = getIteratee(predicate);
  31098. return basePickBy(object, props, function(value, path) {
  31099. return predicate(value, path[0]);
  31100. });
  31101. }
  31102. /**
  31103. * This method is like `_.get` except that if the resolved value is a
  31104. * function it's invoked with the `this` binding of its parent object and
  31105. * its result is returned.
  31106. *
  31107. * @static
  31108. * @since 0.1.0
  31109. * @memberOf _
  31110. * @category Object
  31111. * @param {Object} object The object to query.
  31112. * @param {Array|string} path The path of the property to resolve.
  31113. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31114. * @returns {*} Returns the resolved value.
  31115. * @example
  31116. *
  31117. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31118. *
  31119. * _.result(object, 'a[0].b.c1');
  31120. * // => 3
  31121. *
  31122. * _.result(object, 'a[0].b.c2');
  31123. * // => 4
  31124. *
  31125. * _.result(object, 'a[0].b.c3', 'default');
  31126. * // => 'default'
  31127. *
  31128. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31129. * // => 'default'
  31130. */
  31131. function result(object, path, defaultValue) {
  31132. path = castPath(path, object);
  31133. var index = -1,
  31134. length = path.length;
  31135. // Ensure the loop is entered when path is empty.
  31136. if (!length) {
  31137. length = 1;
  31138. object = undefined;
  31139. }
  31140. while (++index < length) {
  31141. var value = object == null ? undefined : object[toKey(path[index])];
  31142. if (value === undefined) {
  31143. index = length;
  31144. value = defaultValue;
  31145. }
  31146. object = isFunction(value) ? value.call(object) : value;
  31147. }
  31148. return object;
  31149. }
  31150. /**
  31151. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31152. * it's created. Arrays are created for missing index properties while objects
  31153. * are created for all other missing properties. Use `_.setWith` to customize
  31154. * `path` creation.
  31155. *
  31156. * **Note:** This method mutates `object`.
  31157. *
  31158. * @static
  31159. * @memberOf _
  31160. * @since 3.7.0
  31161. * @category Object
  31162. * @param {Object} object The object to modify.
  31163. * @param {Array|string} path The path of the property to set.
  31164. * @param {*} value The value to set.
  31165. * @returns {Object} Returns `object`.
  31166. * @example
  31167. *
  31168. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31169. *
  31170. * _.set(object, 'a[0].b.c', 4);
  31171. * console.log(object.a[0].b.c);
  31172. * // => 4
  31173. *
  31174. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31175. * console.log(object.x[0].y.z);
  31176. * // => 5
  31177. */
  31178. function set(object, path, value) {
  31179. return object == null ? object : baseSet(object, path, value);
  31180. }
  31181. /**
  31182. * This method is like `_.set` except that it accepts `customizer` which is
  31183. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31184. * path creation is handled by the method instead. The `customizer` is invoked
  31185. * with three arguments: (nsValue, key, nsObject).
  31186. *
  31187. * **Note:** This method mutates `object`.
  31188. *
  31189. * @static
  31190. * @memberOf _
  31191. * @since 4.0.0
  31192. * @category Object
  31193. * @param {Object} object The object to modify.
  31194. * @param {Array|string} path The path of the property to set.
  31195. * @param {*} value The value to set.
  31196. * @param {Function} [customizer] The function to customize assigned values.
  31197. * @returns {Object} Returns `object`.
  31198. * @example
  31199. *
  31200. * var object = {};
  31201. *
  31202. * _.setWith(object, '[0][1]', 'a', Object);
  31203. * // => { '0': { '1': 'a' } }
  31204. */
  31205. function setWith(object, path, value, customizer) {
  31206. customizer = typeof customizer == 'function' ? customizer : undefined;
  31207. return object == null ? object : baseSet(object, path, value, customizer);
  31208. }
  31209. /**
  31210. * Creates an array of own enumerable string keyed-value pairs for `object`
  31211. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31212. * entries are returned.
  31213. *
  31214. * @static
  31215. * @memberOf _
  31216. * @since 4.0.0
  31217. * @alias entries
  31218. * @category Object
  31219. * @param {Object} object The object to query.
  31220. * @returns {Array} Returns the key-value pairs.
  31221. * @example
  31222. *
  31223. * function Foo() {
  31224. * this.a = 1;
  31225. * this.b = 2;
  31226. * }
  31227. *
  31228. * Foo.prototype.c = 3;
  31229. *
  31230. * _.toPairs(new Foo);
  31231. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31232. */
  31233. var toPairs = createToPairs(keys);
  31234. /**
  31235. * Creates an array of own and inherited enumerable string keyed-value pairs
  31236. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31237. * or set, its entries are returned.
  31238. *
  31239. * @static
  31240. * @memberOf _
  31241. * @since 4.0.0
  31242. * @alias entriesIn
  31243. * @category Object
  31244. * @param {Object} object The object to query.
  31245. * @returns {Array} Returns the key-value pairs.
  31246. * @example
  31247. *
  31248. * function Foo() {
  31249. * this.a = 1;
  31250. * this.b = 2;
  31251. * }
  31252. *
  31253. * Foo.prototype.c = 3;
  31254. *
  31255. * _.toPairsIn(new Foo);
  31256. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31257. */
  31258. var toPairsIn = createToPairs(keysIn);
  31259. /**
  31260. * An alternative to `_.reduce`; this method transforms `object` to a new
  31261. * `accumulator` object which is the result of running each of its own
  31262. * enumerable string keyed properties thru `iteratee`, with each invocation
  31263. * potentially mutating the `accumulator` object. If `accumulator` is not
  31264. * provided, a new object with the same `[[Prototype]]` will be used. The
  31265. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31266. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31267. *
  31268. * @static
  31269. * @memberOf _
  31270. * @since 1.3.0
  31271. * @category Object
  31272. * @param {Object} object The object to iterate over.
  31273. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31274. * @param {*} [accumulator] The custom accumulator value.
  31275. * @returns {*} Returns the accumulated value.
  31276. * @example
  31277. *
  31278. * _.transform([2, 3, 4], function(result, n) {
  31279. * result.push(n *= n);
  31280. * return n % 2 == 0;
  31281. * }, []);
  31282. * // => [4, 9]
  31283. *
  31284. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31285. * (result[value] || (result[value] = [])).push(key);
  31286. * }, {});
  31287. * // => { '1': ['a', 'c'], '2': ['b'] }
  31288. */
  31289. function transform(object, iteratee, accumulator) {
  31290. var isArr = isArray(object),
  31291. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31292. iteratee = getIteratee(iteratee, 4);
  31293. if (accumulator == null) {
  31294. var Ctor = object && object.constructor;
  31295. if (isArrLike) {
  31296. accumulator = isArr ? new Ctor : [];
  31297. }
  31298. else if (isObject(object)) {
  31299. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31300. }
  31301. else {
  31302. accumulator = {};
  31303. }
  31304. }
  31305. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31306. return iteratee(accumulator, value, index, object);
  31307. });
  31308. return accumulator;
  31309. }
  31310. /**
  31311. * Removes the property at `path` of `object`.
  31312. *
  31313. * **Note:** This method mutates `object`.
  31314. *
  31315. * @static
  31316. * @memberOf _
  31317. * @since 4.0.0
  31318. * @category Object
  31319. * @param {Object} object The object to modify.
  31320. * @param {Array|string} path The path of the property to unset.
  31321. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31322. * @example
  31323. *
  31324. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31325. * _.unset(object, 'a[0].b.c');
  31326. * // => true
  31327. *
  31328. * console.log(object);
  31329. * // => { 'a': [{ 'b': {} }] };
  31330. *
  31331. * _.unset(object, ['a', '0', 'b', 'c']);
  31332. * // => true
  31333. *
  31334. * console.log(object);
  31335. * // => { 'a': [{ 'b': {} }] };
  31336. */
  31337. function unset(object, path) {
  31338. return object == null ? true : baseUnset(object, path);
  31339. }
  31340. /**
  31341. * This method is like `_.set` except that accepts `updater` to produce the
  31342. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31343. * is invoked with one argument: (value).
  31344. *
  31345. * **Note:** This method mutates `object`.
  31346. *
  31347. * @static
  31348. * @memberOf _
  31349. * @since 4.6.0
  31350. * @category Object
  31351. * @param {Object} object The object to modify.
  31352. * @param {Array|string} path The path of the property to set.
  31353. * @param {Function} updater The function to produce the updated value.
  31354. * @returns {Object} Returns `object`.
  31355. * @example
  31356. *
  31357. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31358. *
  31359. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31360. * console.log(object.a[0].b.c);
  31361. * // => 9
  31362. *
  31363. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31364. * console.log(object.x[0].y.z);
  31365. * // => 0
  31366. */
  31367. function update(object, path, updater) {
  31368. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31369. }
  31370. /**
  31371. * This method is like `_.update` except that it accepts `customizer` which is
  31372. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31373. * path creation is handled by the method instead. The `customizer` is invoked
  31374. * with three arguments: (nsValue, key, nsObject).
  31375. *
  31376. * **Note:** This method mutates `object`.
  31377. *
  31378. * @static
  31379. * @memberOf _
  31380. * @since 4.6.0
  31381. * @category Object
  31382. * @param {Object} object The object to modify.
  31383. * @param {Array|string} path The path of the property to set.
  31384. * @param {Function} updater The function to produce the updated value.
  31385. * @param {Function} [customizer] The function to customize assigned values.
  31386. * @returns {Object} Returns `object`.
  31387. * @example
  31388. *
  31389. * var object = {};
  31390. *
  31391. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31392. * // => { '0': { '1': 'a' } }
  31393. */
  31394. function updateWith(object, path, updater, customizer) {
  31395. customizer = typeof customizer == 'function' ? customizer : undefined;
  31396. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31397. }
  31398. /**
  31399. * Creates an array of the own enumerable string keyed property values of `object`.
  31400. *
  31401. * **Note:** Non-object values are coerced to objects.
  31402. *
  31403. * @static
  31404. * @since 0.1.0
  31405. * @memberOf _
  31406. * @category Object
  31407. * @param {Object} object The object to query.
  31408. * @returns {Array} Returns the array of property values.
  31409. * @example
  31410. *
  31411. * function Foo() {
  31412. * this.a = 1;
  31413. * this.b = 2;
  31414. * }
  31415. *
  31416. * Foo.prototype.c = 3;
  31417. *
  31418. * _.values(new Foo);
  31419. * // => [1, 2] (iteration order is not guaranteed)
  31420. *
  31421. * _.values('hi');
  31422. * // => ['h', 'i']
  31423. */
  31424. function values(object) {
  31425. return object == null ? [] : baseValues(object, keys(object));
  31426. }
  31427. /**
  31428. * Creates an array of the own and inherited enumerable string keyed property
  31429. * values of `object`.
  31430. *
  31431. * **Note:** Non-object values are coerced to objects.
  31432. *
  31433. * @static
  31434. * @memberOf _
  31435. * @since 3.0.0
  31436. * @category Object
  31437. * @param {Object} object The object to query.
  31438. * @returns {Array} Returns the array of property values.
  31439. * @example
  31440. *
  31441. * function Foo() {
  31442. * this.a = 1;
  31443. * this.b = 2;
  31444. * }
  31445. *
  31446. * Foo.prototype.c = 3;
  31447. *
  31448. * _.valuesIn(new Foo);
  31449. * // => [1, 2, 3] (iteration order is not guaranteed)
  31450. */
  31451. function valuesIn(object) {
  31452. return object == null ? [] : baseValues(object, keysIn(object));
  31453. }
  31454. /*------------------------------------------------------------------------*/
  31455. /**
  31456. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31457. *
  31458. * @static
  31459. * @memberOf _
  31460. * @since 4.0.0
  31461. * @category Number
  31462. * @param {number} number The number to clamp.
  31463. * @param {number} [lower] The lower bound.
  31464. * @param {number} upper The upper bound.
  31465. * @returns {number} Returns the clamped number.
  31466. * @example
  31467. *
  31468. * _.clamp(-10, -5, 5);
  31469. * // => -5
  31470. *
  31471. * _.clamp(10, -5, 5);
  31472. * // => 5
  31473. */
  31474. function clamp(number, lower, upper) {
  31475. if (upper === undefined) {
  31476. upper = lower;
  31477. lower = undefined;
  31478. }
  31479. if (upper !== undefined) {
  31480. upper = toNumber(upper);
  31481. upper = upper === upper ? upper : 0;
  31482. }
  31483. if (lower !== undefined) {
  31484. lower = toNumber(lower);
  31485. lower = lower === lower ? lower : 0;
  31486. }
  31487. return baseClamp(toNumber(number), lower, upper);
  31488. }
  31489. /**
  31490. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31491. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31492. * If `start` is greater than `end` the params are swapped to support
  31493. * negative ranges.
  31494. *
  31495. * @static
  31496. * @memberOf _
  31497. * @since 3.3.0
  31498. * @category Number
  31499. * @param {number} number The number to check.
  31500. * @param {number} [start=0] The start of the range.
  31501. * @param {number} end The end of the range.
  31502. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31503. * @see _.range, _.rangeRight
  31504. * @example
  31505. *
  31506. * _.inRange(3, 2, 4);
  31507. * // => true
  31508. *
  31509. * _.inRange(4, 8);
  31510. * // => true
  31511. *
  31512. * _.inRange(4, 2);
  31513. * // => false
  31514. *
  31515. * _.inRange(2, 2);
  31516. * // => false
  31517. *
  31518. * _.inRange(1.2, 2);
  31519. * // => true
  31520. *
  31521. * _.inRange(5.2, 4);
  31522. * // => false
  31523. *
  31524. * _.inRange(-3, -2, -6);
  31525. * // => true
  31526. */
  31527. function inRange(number, start, end) {
  31528. start = toFinite(start);
  31529. if (end === undefined) {
  31530. end = start;
  31531. start = 0;
  31532. } else {
  31533. end = toFinite(end);
  31534. }
  31535. number = toNumber(number);
  31536. return baseInRange(number, start, end);
  31537. }
  31538. /**
  31539. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31540. * If only one argument is provided a number between `0` and the given number
  31541. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31542. * floats, a floating-point number is returned instead of an integer.
  31543. *
  31544. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31545. * floating-point values which can produce unexpected results.
  31546. *
  31547. * @static
  31548. * @memberOf _
  31549. * @since 0.7.0
  31550. * @category Number
  31551. * @param {number} [lower=0] The lower bound.
  31552. * @param {number} [upper=1] The upper bound.
  31553. * @param {boolean} [floating] Specify returning a floating-point number.
  31554. * @returns {number} Returns the random number.
  31555. * @example
  31556. *
  31557. * _.random(0, 5);
  31558. * // => an integer between 0 and 5
  31559. *
  31560. * _.random(5);
  31561. * // => also an integer between 0 and 5
  31562. *
  31563. * _.random(5, true);
  31564. * // => a floating-point number between 0 and 5
  31565. *
  31566. * _.random(1.2, 5.2);
  31567. * // => a floating-point number between 1.2 and 5.2
  31568. */
  31569. function random(lower, upper, floating) {
  31570. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31571. upper = floating = undefined;
  31572. }
  31573. if (floating === undefined) {
  31574. if (typeof upper == 'boolean') {
  31575. floating = upper;
  31576. upper = undefined;
  31577. }
  31578. else if (typeof lower == 'boolean') {
  31579. floating = lower;
  31580. lower = undefined;
  31581. }
  31582. }
  31583. if (lower === undefined && upper === undefined) {
  31584. lower = 0;
  31585. upper = 1;
  31586. }
  31587. else {
  31588. lower = toFinite(lower);
  31589. if (upper === undefined) {
  31590. upper = lower;
  31591. lower = 0;
  31592. } else {
  31593. upper = toFinite(upper);
  31594. }
  31595. }
  31596. if (lower > upper) {
  31597. var temp = lower;
  31598. lower = upper;
  31599. upper = temp;
  31600. }
  31601. if (floating || lower % 1 || upper % 1) {
  31602. var rand = nativeRandom();
  31603. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31604. }
  31605. return baseRandom(lower, upper);
  31606. }
  31607. /*------------------------------------------------------------------------*/
  31608. /**
  31609. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31610. *
  31611. * @static
  31612. * @memberOf _
  31613. * @since 3.0.0
  31614. * @category String
  31615. * @param {string} [string=''] The string to convert.
  31616. * @returns {string} Returns the camel cased string.
  31617. * @example
  31618. *
  31619. * _.camelCase('Foo Bar');
  31620. * // => 'fooBar'
  31621. *
  31622. * _.camelCase('--foo-bar--');
  31623. * // => 'fooBar'
  31624. *
  31625. * _.camelCase('__FOO_BAR__');
  31626. * // => 'fooBar'
  31627. */
  31628. var camelCase = createCompounder(function(result, word, index) {
  31629. word = word.toLowerCase();
  31630. return result + (index ? capitalize(word) : word);
  31631. });
  31632. /**
  31633. * Converts the first character of `string` to upper case and the remaining
  31634. * to lower case.
  31635. *
  31636. * @static
  31637. * @memberOf _
  31638. * @since 3.0.0
  31639. * @category String
  31640. * @param {string} [string=''] The string to capitalize.
  31641. * @returns {string} Returns the capitalized string.
  31642. * @example
  31643. *
  31644. * _.capitalize('FRED');
  31645. * // => 'Fred'
  31646. */
  31647. function capitalize(string) {
  31648. return upperFirst(toString(string).toLowerCase());
  31649. }
  31650. /**
  31651. * Deburrs `string` by converting
  31652. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31653. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31654. * letters to basic Latin letters and removing
  31655. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31656. *
  31657. * @static
  31658. * @memberOf _
  31659. * @since 3.0.0
  31660. * @category String
  31661. * @param {string} [string=''] The string to deburr.
  31662. * @returns {string} Returns the deburred string.
  31663. * @example
  31664. *
  31665. * _.deburr('déjà vu');
  31666. * // => 'deja vu'
  31667. */
  31668. function deburr(string) {
  31669. string = toString(string);
  31670. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31671. }
  31672. /**
  31673. * Checks if `string` ends with the given target string.
  31674. *
  31675. * @static
  31676. * @memberOf _
  31677. * @since 3.0.0
  31678. * @category String
  31679. * @param {string} [string=''] The string to inspect.
  31680. * @param {string} [target] The string to search for.
  31681. * @param {number} [position=string.length] The position to search up to.
  31682. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31683. * else `false`.
  31684. * @example
  31685. *
  31686. * _.endsWith('abc', 'c');
  31687. * // => true
  31688. *
  31689. * _.endsWith('abc', 'b');
  31690. * // => false
  31691. *
  31692. * _.endsWith('abc', 'b', 2);
  31693. * // => true
  31694. */
  31695. function endsWith(string, target, position) {
  31696. string = toString(string);
  31697. target = baseToString(target);
  31698. var length = string.length;
  31699. position = position === undefined
  31700. ? length
  31701. : baseClamp(toInteger(position), 0, length);
  31702. var end = position;
  31703. position -= target.length;
  31704. return position >= 0 && string.slice(position, end) == target;
  31705. }
  31706. /**
  31707. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31708. * corresponding HTML entities.
  31709. *
  31710. * **Note:** No other characters are escaped. To escape additional
  31711. * characters use a third-party library like [_he_](https://mths.be/he).
  31712. *
  31713. * Though the ">" character is escaped for symmetry, characters like
  31714. * ">" and "/" don't need escaping in HTML and have no special meaning
  31715. * unless they're part of a tag or unquoted attribute value. See
  31716. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31717. * (under "semi-related fun fact") for more details.
  31718. *
  31719. * When working with HTML you should always
  31720. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31721. * XSS vectors.
  31722. *
  31723. * @static
  31724. * @since 0.1.0
  31725. * @memberOf _
  31726. * @category String
  31727. * @param {string} [string=''] The string to escape.
  31728. * @returns {string} Returns the escaped string.
  31729. * @example
  31730. *
  31731. * _.escape('fred, barney, & pebbles');
  31732. * // => 'fred, barney, &amp; pebbles'
  31733. */
  31734. function escape(string) {
  31735. string = toString(string);
  31736. return (string && reHasUnescapedHtml.test(string))
  31737. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31738. : string;
  31739. }
  31740. /**
  31741. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31742. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31743. *
  31744. * @static
  31745. * @memberOf _
  31746. * @since 3.0.0
  31747. * @category String
  31748. * @param {string} [string=''] The string to escape.
  31749. * @returns {string} Returns the escaped string.
  31750. * @example
  31751. *
  31752. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31753. * // => '\[lodash\]\(https://lodash\.com/\)'
  31754. */
  31755. function escapeRegExp(string) {
  31756. string = toString(string);
  31757. return (string && reHasRegExpChar.test(string))
  31758. ? string.replace(reRegExpChar, '\\$&')
  31759. : string;
  31760. }
  31761. /**
  31762. * Converts `string` to
  31763. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31764. *
  31765. * @static
  31766. * @memberOf _
  31767. * @since 3.0.0
  31768. * @category String
  31769. * @param {string} [string=''] The string to convert.
  31770. * @returns {string} Returns the kebab cased string.
  31771. * @example
  31772. *
  31773. * _.kebabCase('Foo Bar');
  31774. * // => 'foo-bar'
  31775. *
  31776. * _.kebabCase('fooBar');
  31777. * // => 'foo-bar'
  31778. *
  31779. * _.kebabCase('__FOO_BAR__');
  31780. * // => 'foo-bar'
  31781. */
  31782. var kebabCase = createCompounder(function(result, word, index) {
  31783. return result + (index ? '-' : '') + word.toLowerCase();
  31784. });
  31785. /**
  31786. * Converts `string`, as space separated words, to lower case.
  31787. *
  31788. * @static
  31789. * @memberOf _
  31790. * @since 4.0.0
  31791. * @category String
  31792. * @param {string} [string=''] The string to convert.
  31793. * @returns {string} Returns the lower cased string.
  31794. * @example
  31795. *
  31796. * _.lowerCase('--Foo-Bar--');
  31797. * // => 'foo bar'
  31798. *
  31799. * _.lowerCase('fooBar');
  31800. * // => 'foo bar'
  31801. *
  31802. * _.lowerCase('__FOO_BAR__');
  31803. * // => 'foo bar'
  31804. */
  31805. var lowerCase = createCompounder(function(result, word, index) {
  31806. return result + (index ? ' ' : '') + word.toLowerCase();
  31807. });
  31808. /**
  31809. * Converts the first character of `string` to lower case.
  31810. *
  31811. * @static
  31812. * @memberOf _
  31813. * @since 4.0.0
  31814. * @category String
  31815. * @param {string} [string=''] The string to convert.
  31816. * @returns {string} Returns the converted string.
  31817. * @example
  31818. *
  31819. * _.lowerFirst('Fred');
  31820. * // => 'fred'
  31821. *
  31822. * _.lowerFirst('FRED');
  31823. * // => 'fRED'
  31824. */
  31825. var lowerFirst = createCaseFirst('toLowerCase');
  31826. /**
  31827. * Pads `string` on the left and right sides if it's shorter than `length`.
  31828. * Padding characters are truncated if they can't be evenly divided by `length`.
  31829. *
  31830. * @static
  31831. * @memberOf _
  31832. * @since 3.0.0
  31833. * @category String
  31834. * @param {string} [string=''] The string to pad.
  31835. * @param {number} [length=0] The padding length.
  31836. * @param {string} [chars=' '] The string used as padding.
  31837. * @returns {string} Returns the padded string.
  31838. * @example
  31839. *
  31840. * _.pad('abc', 8);
  31841. * // => ' abc '
  31842. *
  31843. * _.pad('abc', 8, '_-');
  31844. * // => '_-abc_-_'
  31845. *
  31846. * _.pad('abc', 3);
  31847. * // => 'abc'
  31848. */
  31849. function pad(string, length, chars) {
  31850. string = toString(string);
  31851. length = toInteger(length);
  31852. var strLength = length ? stringSize(string) : 0;
  31853. if (!length || strLength >= length) {
  31854. return string;
  31855. }
  31856. var mid = (length - strLength) / 2;
  31857. return (
  31858. createPadding(nativeFloor(mid), chars) +
  31859. string +
  31860. createPadding(nativeCeil(mid), chars)
  31861. );
  31862. }
  31863. /**
  31864. * Pads `string` on the right side if it's shorter than `length`. Padding
  31865. * characters are truncated if they exceed `length`.
  31866. *
  31867. * @static
  31868. * @memberOf _
  31869. * @since 4.0.0
  31870. * @category String
  31871. * @param {string} [string=''] The string to pad.
  31872. * @param {number} [length=0] The padding length.
  31873. * @param {string} [chars=' '] The string used as padding.
  31874. * @returns {string} Returns the padded string.
  31875. * @example
  31876. *
  31877. * _.padEnd('abc', 6);
  31878. * // => 'abc '
  31879. *
  31880. * _.padEnd('abc', 6, '_-');
  31881. * // => 'abc_-_'
  31882. *
  31883. * _.padEnd('abc', 3);
  31884. * // => 'abc'
  31885. */
  31886. function padEnd(string, length, chars) {
  31887. string = toString(string);
  31888. length = toInteger(length);
  31889. var strLength = length ? stringSize(string) : 0;
  31890. return (length && strLength < length)
  31891. ? (string + createPadding(length - strLength, chars))
  31892. : string;
  31893. }
  31894. /**
  31895. * Pads `string` on the left side if it's shorter than `length`. Padding
  31896. * characters are truncated if they exceed `length`.
  31897. *
  31898. * @static
  31899. * @memberOf _
  31900. * @since 4.0.0
  31901. * @category String
  31902. * @param {string} [string=''] The string to pad.
  31903. * @param {number} [length=0] The padding length.
  31904. * @param {string} [chars=' '] The string used as padding.
  31905. * @returns {string} Returns the padded string.
  31906. * @example
  31907. *
  31908. * _.padStart('abc', 6);
  31909. * // => ' abc'
  31910. *
  31911. * _.padStart('abc', 6, '_-');
  31912. * // => '_-_abc'
  31913. *
  31914. * _.padStart('abc', 3);
  31915. * // => 'abc'
  31916. */
  31917. function padStart(string, length, chars) {
  31918. string = toString(string);
  31919. length = toInteger(length);
  31920. var strLength = length ? stringSize(string) : 0;
  31921. return (length && strLength < length)
  31922. ? (createPadding(length - strLength, chars) + string)
  31923. : string;
  31924. }
  31925. /**
  31926. * Converts `string` to an integer of the specified radix. If `radix` is
  31927. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31928. * hexadecimal, in which case a `radix` of `16` is used.
  31929. *
  31930. * **Note:** This method aligns with the
  31931. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31932. *
  31933. * @static
  31934. * @memberOf _
  31935. * @since 1.1.0
  31936. * @category String
  31937. * @param {string} string The string to convert.
  31938. * @param {number} [radix=10] The radix to interpret `value` by.
  31939. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31940. * @returns {number} Returns the converted integer.
  31941. * @example
  31942. *
  31943. * _.parseInt('08');
  31944. * // => 8
  31945. *
  31946. * _.map(['6', '08', '10'], _.parseInt);
  31947. * // => [6, 8, 10]
  31948. */
  31949. function parseInt(string, radix, guard) {
  31950. if (guard || radix == null) {
  31951. radix = 0;
  31952. } else if (radix) {
  31953. radix = +radix;
  31954. }
  31955. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31956. }
  31957. /**
  31958. * Repeats the given string `n` times.
  31959. *
  31960. * @static
  31961. * @memberOf _
  31962. * @since 3.0.0
  31963. * @category String
  31964. * @param {string} [string=''] The string to repeat.
  31965. * @param {number} [n=1] The number of times to repeat the string.
  31966. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31967. * @returns {string} Returns the repeated string.
  31968. * @example
  31969. *
  31970. * _.repeat('*', 3);
  31971. * // => '***'
  31972. *
  31973. * _.repeat('abc', 2);
  31974. * // => 'abcabc'
  31975. *
  31976. * _.repeat('abc', 0);
  31977. * // => ''
  31978. */
  31979. function repeat(string, n, guard) {
  31980. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31981. n = 1;
  31982. } else {
  31983. n = toInteger(n);
  31984. }
  31985. return baseRepeat(toString(string), n);
  31986. }
  31987. /**
  31988. * Replaces matches for `pattern` in `string` with `replacement`.
  31989. *
  31990. * **Note:** This method is based on
  31991. * [`String#replace`](https://mdn.io/String/replace).
  31992. *
  31993. * @static
  31994. * @memberOf _
  31995. * @since 4.0.0
  31996. * @category String
  31997. * @param {string} [string=''] The string to modify.
  31998. * @param {RegExp|string} pattern The pattern to replace.
  31999. * @param {Function|string} replacement The match replacement.
  32000. * @returns {string} Returns the modified string.
  32001. * @example
  32002. *
  32003. * _.replace('Hi Fred', 'Fred', 'Barney');
  32004. * // => 'Hi Barney'
  32005. */
  32006. function replace() {
  32007. var args = arguments,
  32008. string = toString(args[0]);
  32009. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32010. }
  32011. /**
  32012. * Converts `string` to
  32013. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32014. *
  32015. * @static
  32016. * @memberOf _
  32017. * @since 3.0.0
  32018. * @category String
  32019. * @param {string} [string=''] The string to convert.
  32020. * @returns {string} Returns the snake cased string.
  32021. * @example
  32022. *
  32023. * _.snakeCase('Foo Bar');
  32024. * // => 'foo_bar'
  32025. *
  32026. * _.snakeCase('fooBar');
  32027. * // => 'foo_bar'
  32028. *
  32029. * _.snakeCase('--FOO-BAR--');
  32030. * // => 'foo_bar'
  32031. */
  32032. var snakeCase = createCompounder(function(result, word, index) {
  32033. return result + (index ? '_' : '') + word.toLowerCase();
  32034. });
  32035. /**
  32036. * Splits `string` by `separator`.
  32037. *
  32038. * **Note:** This method is based on
  32039. * [`String#split`](https://mdn.io/String/split).
  32040. *
  32041. * @static
  32042. * @memberOf _
  32043. * @since 4.0.0
  32044. * @category String
  32045. * @param {string} [string=''] The string to split.
  32046. * @param {RegExp|string} separator The separator pattern to split by.
  32047. * @param {number} [limit] The length to truncate results to.
  32048. * @returns {Array} Returns the string segments.
  32049. * @example
  32050. *
  32051. * _.split('a-b-c', '-', 2);
  32052. * // => ['a', 'b']
  32053. */
  32054. function split(string, separator, limit) {
  32055. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32056. separator = limit = undefined;
  32057. }
  32058. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32059. if (!limit) {
  32060. return [];
  32061. }
  32062. string = toString(string);
  32063. if (string && (
  32064. typeof separator == 'string' ||
  32065. (separator != null && !isRegExp(separator))
  32066. )) {
  32067. separator = baseToString(separator);
  32068. if (!separator && hasUnicode(string)) {
  32069. return castSlice(stringToArray(string), 0, limit);
  32070. }
  32071. }
  32072. return string.split(separator, limit);
  32073. }
  32074. /**
  32075. * Converts `string` to
  32076. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32077. *
  32078. * @static
  32079. * @memberOf _
  32080. * @since 3.1.0
  32081. * @category String
  32082. * @param {string} [string=''] The string to convert.
  32083. * @returns {string} Returns the start cased string.
  32084. * @example
  32085. *
  32086. * _.startCase('--foo-bar--');
  32087. * // => 'Foo Bar'
  32088. *
  32089. * _.startCase('fooBar');
  32090. * // => 'Foo Bar'
  32091. *
  32092. * _.startCase('__FOO_BAR__');
  32093. * // => 'FOO BAR'
  32094. */
  32095. var startCase = createCompounder(function(result, word, index) {
  32096. return result + (index ? ' ' : '') + upperFirst(word);
  32097. });
  32098. /**
  32099. * Checks if `string` starts with the given target string.
  32100. *
  32101. * @static
  32102. * @memberOf _
  32103. * @since 3.0.0
  32104. * @category String
  32105. * @param {string} [string=''] The string to inspect.
  32106. * @param {string} [target] The string to search for.
  32107. * @param {number} [position=0] The position to search from.
  32108. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32109. * else `false`.
  32110. * @example
  32111. *
  32112. * _.startsWith('abc', 'a');
  32113. * // => true
  32114. *
  32115. * _.startsWith('abc', 'b');
  32116. * // => false
  32117. *
  32118. * _.startsWith('abc', 'b', 1);
  32119. * // => true
  32120. */
  32121. function startsWith(string, target, position) {
  32122. string = toString(string);
  32123. position = position == null
  32124. ? 0
  32125. : baseClamp(toInteger(position), 0, string.length);
  32126. target = baseToString(target);
  32127. return string.slice(position, position + target.length) == target;
  32128. }
  32129. /**
  32130. * Creates a compiled template function that can interpolate data properties
  32131. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32132. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32133. * properties may be accessed as free variables in the template. If a setting
  32134. * object is given, it takes precedence over `_.templateSettings` values.
  32135. *
  32136. * **Note:** In the development build `_.template` utilizes
  32137. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32138. * for easier debugging.
  32139. *
  32140. * For more information on precompiling templates see
  32141. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32142. *
  32143. * For more information on Chrome extension sandboxes see
  32144. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32145. *
  32146. * @static
  32147. * @since 0.1.0
  32148. * @memberOf _
  32149. * @category String
  32150. * @param {string} [string=''] The template string.
  32151. * @param {Object} [options={}] The options object.
  32152. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32153. * The HTML "escape" delimiter.
  32154. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32155. * The "evaluate" delimiter.
  32156. * @param {Object} [options.imports=_.templateSettings.imports]
  32157. * An object to import into the template as free variables.
  32158. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32159. * The "interpolate" delimiter.
  32160. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32161. * The sourceURL of the compiled template.
  32162. * @param {string} [options.variable='obj']
  32163. * The data object variable name.
  32164. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32165. * @returns {Function} Returns the compiled template function.
  32166. * @example
  32167. *
  32168. * // Use the "interpolate" delimiter to create a compiled template.
  32169. * var compiled = _.template('hello <%= user %>!');
  32170. * compiled({ 'user': 'fred' });
  32171. * // => 'hello fred!'
  32172. *
  32173. * // Use the HTML "escape" delimiter to escape data property values.
  32174. * var compiled = _.template('<b><%- value %></b>');
  32175. * compiled({ 'value': '<script>' });
  32176. * // => '<b>&lt;script&gt;</b>'
  32177. *
  32178. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32179. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32180. * compiled({ 'users': ['fred', 'barney'] });
  32181. * // => '<li>fred</li><li>barney</li>'
  32182. *
  32183. * // Use the internal `print` function in "evaluate" delimiters.
  32184. * var compiled = _.template('<% print("hello " + user); %>!');
  32185. * compiled({ 'user': 'barney' });
  32186. * // => 'hello barney!'
  32187. *
  32188. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32189. * // Disable support by replacing the "interpolate" delimiter.
  32190. * var compiled = _.template('hello ${ user }!');
  32191. * compiled({ 'user': 'pebbles' });
  32192. * // => 'hello pebbles!'
  32193. *
  32194. * // Use backslashes to treat delimiters as plain text.
  32195. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32196. * compiled({ 'value': 'ignored' });
  32197. * // => '<%- value %>'
  32198. *
  32199. * // Use the `imports` option to import `jQuery` as `jq`.
  32200. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32201. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32202. * compiled({ 'users': ['fred', 'barney'] });
  32203. * // => '<li>fred</li><li>barney</li>'
  32204. *
  32205. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32206. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32207. * compiled(data);
  32208. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32209. *
  32210. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32211. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32212. * compiled.source;
  32213. * // => function(data) {
  32214. * // var __t, __p = '';
  32215. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32216. * // return __p;
  32217. * // }
  32218. *
  32219. * // Use custom template delimiters.
  32220. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32221. * var compiled = _.template('hello {{ user }}!');
  32222. * compiled({ 'user': 'mustache' });
  32223. * // => 'hello mustache!'
  32224. *
  32225. * // Use the `source` property to inline compiled templates for meaningful
  32226. * // line numbers in error messages and stack traces.
  32227. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32228. * var JST = {\
  32229. * "main": ' + _.template(mainText).source + '\
  32230. * };\
  32231. * ');
  32232. */
  32233. function template(string, options, guard) {
  32234. // Based on John Resig's `tmpl` implementation
  32235. // (http://ejohn.org/blog/javascript-micro-templating/)
  32236. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32237. var settings = lodash.templateSettings;
  32238. if (guard && isIterateeCall(string, options, guard)) {
  32239. options = undefined;
  32240. }
  32241. string = toString(string);
  32242. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32243. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32244. importsKeys = keys(imports),
  32245. importsValues = baseValues(imports, importsKeys);
  32246. var isEscaping,
  32247. isEvaluating,
  32248. index = 0,
  32249. interpolate = options.interpolate || reNoMatch,
  32250. source = "__p += '";
  32251. // Compile the regexp to match each delimiter.
  32252. var reDelimiters = RegExp(
  32253. (options.escape || reNoMatch).source + '|' +
  32254. interpolate.source + '|' +
  32255. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32256. (options.evaluate || reNoMatch).source + '|$'
  32257. , 'g');
  32258. // Use a sourceURL for easier debugging.
  32259. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32260. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32261. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32262. var sourceURL = '//# sourceURL=' +
  32263. (hasOwnProperty.call(options, 'sourceURL')
  32264. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32265. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32266. ) + '\n';
  32267. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32268. interpolateValue || (interpolateValue = esTemplateValue);
  32269. // Escape characters that can't be included in string literals.
  32270. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32271. // Replace delimiters with snippets.
  32272. if (escapeValue) {
  32273. isEscaping = true;
  32274. source += "' +\n__e(" + escapeValue + ") +\n'";
  32275. }
  32276. if (evaluateValue) {
  32277. isEvaluating = true;
  32278. source += "';\n" + evaluateValue + ";\n__p += '";
  32279. }
  32280. if (interpolateValue) {
  32281. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32282. }
  32283. index = offset + match.length;
  32284. // The JS engine embedded in Adobe products needs `match` returned in
  32285. // order to produce the correct `offset` value.
  32286. return match;
  32287. });
  32288. source += "';\n";
  32289. // If `variable` is not specified wrap a with-statement around the generated
  32290. // code to add the data object to the top of the scope chain.
  32291. // Like with sourceURL, we take care to not check the option's prototype,
  32292. // as this configuration is a code injection vector.
  32293. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32294. if (!variable) {
  32295. source = 'with (obj) {\n' + source + '\n}\n';
  32296. }
  32297. // Cleanup code by stripping empty strings.
  32298. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32299. .replace(reEmptyStringMiddle, '$1')
  32300. .replace(reEmptyStringTrailing, '$1;');
  32301. // Frame code as the function body.
  32302. source = 'function(' + (variable || 'obj') + ') {\n' +
  32303. (variable
  32304. ? ''
  32305. : 'obj || (obj = {});\n'
  32306. ) +
  32307. "var __t, __p = ''" +
  32308. (isEscaping
  32309. ? ', __e = _.escape'
  32310. : ''
  32311. ) +
  32312. (isEvaluating
  32313. ? ', __j = Array.prototype.join;\n' +
  32314. "function print() { __p += __j.call(arguments, '') }\n"
  32315. : ';\n'
  32316. ) +
  32317. source +
  32318. 'return __p\n}';
  32319. var result = attempt(function() {
  32320. return Function(importsKeys, sourceURL + 'return ' + source)
  32321. .apply(undefined, importsValues);
  32322. });
  32323. // Provide the compiled function's source by its `toString` method or
  32324. // the `source` property as a convenience for inlining compiled templates.
  32325. result.source = source;
  32326. if (isError(result)) {
  32327. throw result;
  32328. }
  32329. return result;
  32330. }
  32331. /**
  32332. * Converts `string`, as a whole, to lower case just like
  32333. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32334. *
  32335. * @static
  32336. * @memberOf _
  32337. * @since 4.0.0
  32338. * @category String
  32339. * @param {string} [string=''] The string to convert.
  32340. * @returns {string} Returns the lower cased string.
  32341. * @example
  32342. *
  32343. * _.toLower('--Foo-Bar--');
  32344. * // => '--foo-bar--'
  32345. *
  32346. * _.toLower('fooBar');
  32347. * // => 'foobar'
  32348. *
  32349. * _.toLower('__FOO_BAR__');
  32350. * // => '__foo_bar__'
  32351. */
  32352. function toLower(value) {
  32353. return toString(value).toLowerCase();
  32354. }
  32355. /**
  32356. * Converts `string`, as a whole, to upper case just like
  32357. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32358. *
  32359. * @static
  32360. * @memberOf _
  32361. * @since 4.0.0
  32362. * @category String
  32363. * @param {string} [string=''] The string to convert.
  32364. * @returns {string} Returns the upper cased string.
  32365. * @example
  32366. *
  32367. * _.toUpper('--foo-bar--');
  32368. * // => '--FOO-BAR--'
  32369. *
  32370. * _.toUpper('fooBar');
  32371. * // => 'FOOBAR'
  32372. *
  32373. * _.toUpper('__foo_bar__');
  32374. * // => '__FOO_BAR__'
  32375. */
  32376. function toUpper(value) {
  32377. return toString(value).toUpperCase();
  32378. }
  32379. /**
  32380. * Removes leading and trailing whitespace or specified characters from `string`.
  32381. *
  32382. * @static
  32383. * @memberOf _
  32384. * @since 3.0.0
  32385. * @category String
  32386. * @param {string} [string=''] The string to trim.
  32387. * @param {string} [chars=whitespace] The characters to trim.
  32388. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32389. * @returns {string} Returns the trimmed string.
  32390. * @example
  32391. *
  32392. * _.trim(' abc ');
  32393. * // => 'abc'
  32394. *
  32395. * _.trim('-_-abc-_-', '_-');
  32396. * // => 'abc'
  32397. *
  32398. * _.map([' foo ', ' bar '], _.trim);
  32399. * // => ['foo', 'bar']
  32400. */
  32401. function trim(string, chars, guard) {
  32402. string = toString(string);
  32403. if (string && (guard || chars === undefined)) {
  32404. return string.replace(reTrim, '');
  32405. }
  32406. if (!string || !(chars = baseToString(chars))) {
  32407. return string;
  32408. }
  32409. var strSymbols = stringToArray(string),
  32410. chrSymbols = stringToArray(chars),
  32411. start = charsStartIndex(strSymbols, chrSymbols),
  32412. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32413. return castSlice(strSymbols, start, end).join('');
  32414. }
  32415. /**
  32416. * Removes trailing whitespace or specified characters from `string`.
  32417. *
  32418. * @static
  32419. * @memberOf _
  32420. * @since 4.0.0
  32421. * @category String
  32422. * @param {string} [string=''] The string to trim.
  32423. * @param {string} [chars=whitespace] The characters to trim.
  32424. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32425. * @returns {string} Returns the trimmed string.
  32426. * @example
  32427. *
  32428. * _.trimEnd(' abc ');
  32429. * // => ' abc'
  32430. *
  32431. * _.trimEnd('-_-abc-_-', '_-');
  32432. * // => '-_-abc'
  32433. */
  32434. function trimEnd(string, chars, guard) {
  32435. string = toString(string);
  32436. if (string && (guard || chars === undefined)) {
  32437. return string.replace(reTrimEnd, '');
  32438. }
  32439. if (!string || !(chars = baseToString(chars))) {
  32440. return string;
  32441. }
  32442. var strSymbols = stringToArray(string),
  32443. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32444. return castSlice(strSymbols, 0, end).join('');
  32445. }
  32446. /**
  32447. * Removes leading whitespace or specified characters from `string`.
  32448. *
  32449. * @static
  32450. * @memberOf _
  32451. * @since 4.0.0
  32452. * @category String
  32453. * @param {string} [string=''] The string to trim.
  32454. * @param {string} [chars=whitespace] The characters to trim.
  32455. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32456. * @returns {string} Returns the trimmed string.
  32457. * @example
  32458. *
  32459. * _.trimStart(' abc ');
  32460. * // => 'abc '
  32461. *
  32462. * _.trimStart('-_-abc-_-', '_-');
  32463. * // => 'abc-_-'
  32464. */
  32465. function trimStart(string, chars, guard) {
  32466. string = toString(string);
  32467. if (string && (guard || chars === undefined)) {
  32468. return string.replace(reTrimStart, '');
  32469. }
  32470. if (!string || !(chars = baseToString(chars))) {
  32471. return string;
  32472. }
  32473. var strSymbols = stringToArray(string),
  32474. start = charsStartIndex(strSymbols, stringToArray(chars));
  32475. return castSlice(strSymbols, start).join('');
  32476. }
  32477. /**
  32478. * Truncates `string` if it's longer than the given maximum string length.
  32479. * The last characters of the truncated string are replaced with the omission
  32480. * string which defaults to "...".
  32481. *
  32482. * @static
  32483. * @memberOf _
  32484. * @since 4.0.0
  32485. * @category String
  32486. * @param {string} [string=''] The string to truncate.
  32487. * @param {Object} [options={}] The options object.
  32488. * @param {number} [options.length=30] The maximum string length.
  32489. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32490. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32491. * @returns {string} Returns the truncated string.
  32492. * @example
  32493. *
  32494. * _.truncate('hi-diddly-ho there, neighborino');
  32495. * // => 'hi-diddly-ho there, neighbo...'
  32496. *
  32497. * _.truncate('hi-diddly-ho there, neighborino', {
  32498. * 'length': 24,
  32499. * 'separator': ' '
  32500. * });
  32501. * // => 'hi-diddly-ho there,...'
  32502. *
  32503. * _.truncate('hi-diddly-ho there, neighborino', {
  32504. * 'length': 24,
  32505. * 'separator': /,? +/
  32506. * });
  32507. * // => 'hi-diddly-ho there...'
  32508. *
  32509. * _.truncate('hi-diddly-ho there, neighborino', {
  32510. * 'omission': ' [...]'
  32511. * });
  32512. * // => 'hi-diddly-ho there, neig [...]'
  32513. */
  32514. function truncate(string, options) {
  32515. var length = DEFAULT_TRUNC_LENGTH,
  32516. omission = DEFAULT_TRUNC_OMISSION;
  32517. if (isObject(options)) {
  32518. var separator = 'separator' in options ? options.separator : separator;
  32519. length = 'length' in options ? toInteger(options.length) : length;
  32520. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32521. }
  32522. string = toString(string);
  32523. var strLength = string.length;
  32524. if (hasUnicode(string)) {
  32525. var strSymbols = stringToArray(string);
  32526. strLength = strSymbols.length;
  32527. }
  32528. if (length >= strLength) {
  32529. return string;
  32530. }
  32531. var end = length - stringSize(omission);
  32532. if (end < 1) {
  32533. return omission;
  32534. }
  32535. var result = strSymbols
  32536. ? castSlice(strSymbols, 0, end).join('')
  32537. : string.slice(0, end);
  32538. if (separator === undefined) {
  32539. return result + omission;
  32540. }
  32541. if (strSymbols) {
  32542. end += (result.length - end);
  32543. }
  32544. if (isRegExp(separator)) {
  32545. if (string.slice(end).search(separator)) {
  32546. var match,
  32547. substring = result;
  32548. if (!separator.global) {
  32549. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32550. }
  32551. separator.lastIndex = 0;
  32552. while ((match = separator.exec(substring))) {
  32553. var newEnd = match.index;
  32554. }
  32555. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32556. }
  32557. } else if (string.indexOf(baseToString(separator), end) != end) {
  32558. var index = result.lastIndexOf(separator);
  32559. if (index > -1) {
  32560. result = result.slice(0, index);
  32561. }
  32562. }
  32563. return result + omission;
  32564. }
  32565. /**
  32566. * The inverse of `_.escape`; this method converts the HTML entities
  32567. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32568. * their corresponding characters.
  32569. *
  32570. * **Note:** No other HTML entities are unescaped. To unescape additional
  32571. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32572. *
  32573. * @static
  32574. * @memberOf _
  32575. * @since 0.6.0
  32576. * @category String
  32577. * @param {string} [string=''] The string to unescape.
  32578. * @returns {string} Returns the unescaped string.
  32579. * @example
  32580. *
  32581. * _.unescape('fred, barney, &amp; pebbles');
  32582. * // => 'fred, barney, & pebbles'
  32583. */
  32584. function unescape(string) {
  32585. string = toString(string);
  32586. return (string && reHasEscapedHtml.test(string))
  32587. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32588. : string;
  32589. }
  32590. /**
  32591. * Converts `string`, as space separated words, to upper case.
  32592. *
  32593. * @static
  32594. * @memberOf _
  32595. * @since 4.0.0
  32596. * @category String
  32597. * @param {string} [string=''] The string to convert.
  32598. * @returns {string} Returns the upper cased string.
  32599. * @example
  32600. *
  32601. * _.upperCase('--foo-bar');
  32602. * // => 'FOO BAR'
  32603. *
  32604. * _.upperCase('fooBar');
  32605. * // => 'FOO BAR'
  32606. *
  32607. * _.upperCase('__foo_bar__');
  32608. * // => 'FOO BAR'
  32609. */
  32610. var upperCase = createCompounder(function(result, word, index) {
  32611. return result + (index ? ' ' : '') + word.toUpperCase();
  32612. });
  32613. /**
  32614. * Converts the first character of `string` to upper case.
  32615. *
  32616. * @static
  32617. * @memberOf _
  32618. * @since 4.0.0
  32619. * @category String
  32620. * @param {string} [string=''] The string to convert.
  32621. * @returns {string} Returns the converted string.
  32622. * @example
  32623. *
  32624. * _.upperFirst('fred');
  32625. * // => 'Fred'
  32626. *
  32627. * _.upperFirst('FRED');
  32628. * // => 'FRED'
  32629. */
  32630. var upperFirst = createCaseFirst('toUpperCase');
  32631. /**
  32632. * Splits `string` into an array of its words.
  32633. *
  32634. * @static
  32635. * @memberOf _
  32636. * @since 3.0.0
  32637. * @category String
  32638. * @param {string} [string=''] The string to inspect.
  32639. * @param {RegExp|string} [pattern] The pattern to match words.
  32640. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32641. * @returns {Array} Returns the words of `string`.
  32642. * @example
  32643. *
  32644. * _.words('fred, barney, & pebbles');
  32645. * // => ['fred', 'barney', 'pebbles']
  32646. *
  32647. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32648. * // => ['fred', 'barney', '&', 'pebbles']
  32649. */
  32650. function words(string, pattern, guard) {
  32651. string = toString(string);
  32652. pattern = guard ? undefined : pattern;
  32653. if (pattern === undefined) {
  32654. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32655. }
  32656. return string.match(pattern) || [];
  32657. }
  32658. /*------------------------------------------------------------------------*/
  32659. /**
  32660. * Attempts to invoke `func`, returning either the result or the caught error
  32661. * object. Any additional arguments are provided to `func` when it's invoked.
  32662. *
  32663. * @static
  32664. * @memberOf _
  32665. * @since 3.0.0
  32666. * @category Util
  32667. * @param {Function} func The function to attempt.
  32668. * @param {...*} [args] The arguments to invoke `func` with.
  32669. * @returns {*} Returns the `func` result or error object.
  32670. * @example
  32671. *
  32672. * // Avoid throwing errors for invalid selectors.
  32673. * var elements = _.attempt(function(selector) {
  32674. * return document.querySelectorAll(selector);
  32675. * }, '>_>');
  32676. *
  32677. * if (_.isError(elements)) {
  32678. * elements = [];
  32679. * }
  32680. */
  32681. var attempt = baseRest(function(func, args) {
  32682. try {
  32683. return apply(func, undefined, args);
  32684. } catch (e) {
  32685. return isError(e) ? e : new Error(e);
  32686. }
  32687. });
  32688. /**
  32689. * Binds methods of an object to the object itself, overwriting the existing
  32690. * method.
  32691. *
  32692. * **Note:** This method doesn't set the "length" property of bound functions.
  32693. *
  32694. * @static
  32695. * @since 0.1.0
  32696. * @memberOf _
  32697. * @category Util
  32698. * @param {Object} object The object to bind and assign the bound methods to.
  32699. * @param {...(string|string[])} methodNames The object method names to bind.
  32700. * @returns {Object} Returns `object`.
  32701. * @example
  32702. *
  32703. * var view = {
  32704. * 'label': 'docs',
  32705. * 'click': function() {
  32706. * console.log('clicked ' + this.label);
  32707. * }
  32708. * };
  32709. *
  32710. * _.bindAll(view, ['click']);
  32711. * jQuery(element).on('click', view.click);
  32712. * // => Logs 'clicked docs' when clicked.
  32713. */
  32714. var bindAll = flatRest(function(object, methodNames) {
  32715. arrayEach(methodNames, function(key) {
  32716. key = toKey(key);
  32717. baseAssignValue(object, key, bind(object[key], object));
  32718. });
  32719. return object;
  32720. });
  32721. /**
  32722. * Creates a function that iterates over `pairs` and invokes the corresponding
  32723. * function of the first predicate to return truthy. The predicate-function
  32724. * pairs are invoked with the `this` binding and arguments of the created
  32725. * function.
  32726. *
  32727. * @static
  32728. * @memberOf _
  32729. * @since 4.0.0
  32730. * @category Util
  32731. * @param {Array} pairs The predicate-function pairs.
  32732. * @returns {Function} Returns the new composite function.
  32733. * @example
  32734. *
  32735. * var func = _.cond([
  32736. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32737. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32738. * [_.stubTrue, _.constant('no match')]
  32739. * ]);
  32740. *
  32741. * func({ 'a': 1, 'b': 2 });
  32742. * // => 'matches A'
  32743. *
  32744. * func({ 'a': 0, 'b': 1 });
  32745. * // => 'matches B'
  32746. *
  32747. * func({ 'a': '1', 'b': '2' });
  32748. * // => 'no match'
  32749. */
  32750. function cond(pairs) {
  32751. var length = pairs == null ? 0 : pairs.length,
  32752. toIteratee = getIteratee();
  32753. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32754. if (typeof pair[1] != 'function') {
  32755. throw new TypeError(FUNC_ERROR_TEXT);
  32756. }
  32757. return [toIteratee(pair[0]), pair[1]];
  32758. });
  32759. return baseRest(function(args) {
  32760. var index = -1;
  32761. while (++index < length) {
  32762. var pair = pairs[index];
  32763. if (apply(pair[0], this, args)) {
  32764. return apply(pair[1], this, args);
  32765. }
  32766. }
  32767. });
  32768. }
  32769. /**
  32770. * Creates a function that invokes the predicate properties of `source` with
  32771. * the corresponding property values of a given object, returning `true` if
  32772. * all predicates return truthy, else `false`.
  32773. *
  32774. * **Note:** The created function is equivalent to `_.conformsTo` with
  32775. * `source` partially applied.
  32776. *
  32777. * @static
  32778. * @memberOf _
  32779. * @since 4.0.0
  32780. * @category Util
  32781. * @param {Object} source The object of property predicates to conform to.
  32782. * @returns {Function} Returns the new spec function.
  32783. * @example
  32784. *
  32785. * var objects = [
  32786. * { 'a': 2, 'b': 1 },
  32787. * { 'a': 1, 'b': 2 }
  32788. * ];
  32789. *
  32790. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32791. * // => [{ 'a': 1, 'b': 2 }]
  32792. */
  32793. function conforms(source) {
  32794. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32795. }
  32796. /**
  32797. * Creates a function that returns `value`.
  32798. *
  32799. * @static
  32800. * @memberOf _
  32801. * @since 2.4.0
  32802. * @category Util
  32803. * @param {*} value The value to return from the new function.
  32804. * @returns {Function} Returns the new constant function.
  32805. * @example
  32806. *
  32807. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32808. *
  32809. * console.log(objects);
  32810. * // => [{ 'a': 1 }, { 'a': 1 }]
  32811. *
  32812. * console.log(objects[0] === objects[1]);
  32813. * // => true
  32814. */
  32815. function constant(value) {
  32816. return function() {
  32817. return value;
  32818. };
  32819. }
  32820. /**
  32821. * Checks `value` to determine whether a default value should be returned in
  32822. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32823. * or `undefined`.
  32824. *
  32825. * @static
  32826. * @memberOf _
  32827. * @since 4.14.0
  32828. * @category Util
  32829. * @param {*} value The value to check.
  32830. * @param {*} defaultValue The default value.
  32831. * @returns {*} Returns the resolved value.
  32832. * @example
  32833. *
  32834. * _.defaultTo(1, 10);
  32835. * // => 1
  32836. *
  32837. * _.defaultTo(undefined, 10);
  32838. * // => 10
  32839. */
  32840. function defaultTo(value, defaultValue) {
  32841. return (value == null || value !== value) ? defaultValue : value;
  32842. }
  32843. /**
  32844. * Creates a function that returns the result of invoking the given functions
  32845. * with the `this` binding of the created function, where each successive
  32846. * invocation is supplied the return value of the previous.
  32847. *
  32848. * @static
  32849. * @memberOf _
  32850. * @since 3.0.0
  32851. * @category Util
  32852. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32853. * @returns {Function} Returns the new composite function.
  32854. * @see _.flowRight
  32855. * @example
  32856. *
  32857. * function square(n) {
  32858. * return n * n;
  32859. * }
  32860. *
  32861. * var addSquare = _.flow([_.add, square]);
  32862. * addSquare(1, 2);
  32863. * // => 9
  32864. */
  32865. var flow = createFlow();
  32866. /**
  32867. * This method is like `_.flow` except that it creates a function that
  32868. * invokes the given functions from right to left.
  32869. *
  32870. * @static
  32871. * @since 3.0.0
  32872. * @memberOf _
  32873. * @category Util
  32874. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32875. * @returns {Function} Returns the new composite function.
  32876. * @see _.flow
  32877. * @example
  32878. *
  32879. * function square(n) {
  32880. * return n * n;
  32881. * }
  32882. *
  32883. * var addSquare = _.flowRight([square, _.add]);
  32884. * addSquare(1, 2);
  32885. * // => 9
  32886. */
  32887. var flowRight = createFlow(true);
  32888. /**
  32889. * This method returns the first argument it receives.
  32890. *
  32891. * @static
  32892. * @since 0.1.0
  32893. * @memberOf _
  32894. * @category Util
  32895. * @param {*} value Any value.
  32896. * @returns {*} Returns `value`.
  32897. * @example
  32898. *
  32899. * var object = { 'a': 1 };
  32900. *
  32901. * console.log(_.identity(object) === object);
  32902. * // => true
  32903. */
  32904. function identity(value) {
  32905. return value;
  32906. }
  32907. /**
  32908. * Creates a function that invokes `func` with the arguments of the created
  32909. * function. If `func` is a property name, the created function returns the
  32910. * property value for a given element. If `func` is an array or object, the
  32911. * created function returns `true` for elements that contain the equivalent
  32912. * source properties, otherwise it returns `false`.
  32913. *
  32914. * @static
  32915. * @since 4.0.0
  32916. * @memberOf _
  32917. * @category Util
  32918. * @param {*} [func=_.identity] The value to convert to a callback.
  32919. * @returns {Function} Returns the callback.
  32920. * @example
  32921. *
  32922. * var users = [
  32923. * { 'user': 'barney', 'age': 36, 'active': true },
  32924. * { 'user': 'fred', 'age': 40, 'active': false }
  32925. * ];
  32926. *
  32927. * // The `_.matches` iteratee shorthand.
  32928. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32929. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32930. *
  32931. * // The `_.matchesProperty` iteratee shorthand.
  32932. * _.filter(users, _.iteratee(['user', 'fred']));
  32933. * // => [{ 'user': 'fred', 'age': 40 }]
  32934. *
  32935. * // The `_.property` iteratee shorthand.
  32936. * _.map(users, _.iteratee('user'));
  32937. * // => ['barney', 'fred']
  32938. *
  32939. * // Create custom iteratee shorthands.
  32940. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32941. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32942. * return func.test(string);
  32943. * };
  32944. * });
  32945. *
  32946. * _.filter(['abc', 'def'], /ef/);
  32947. * // => ['def']
  32948. */
  32949. function iteratee(func) {
  32950. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32951. }
  32952. /**
  32953. * Creates a function that performs a partial deep comparison between a given
  32954. * object and `source`, returning `true` if the given object has equivalent
  32955. * property values, else `false`.
  32956. *
  32957. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32958. * partially applied.
  32959. *
  32960. * Partial comparisons will match empty array and empty object `source`
  32961. * values against any array or object value, respectively. See `_.isEqual`
  32962. * for a list of supported value comparisons.
  32963. *
  32964. * @static
  32965. * @memberOf _
  32966. * @since 3.0.0
  32967. * @category Util
  32968. * @param {Object} source The object of property values to match.
  32969. * @returns {Function} Returns the new spec function.
  32970. * @example
  32971. *
  32972. * var objects = [
  32973. * { 'a': 1, 'b': 2, 'c': 3 },
  32974. * { 'a': 4, 'b': 5, 'c': 6 }
  32975. * ];
  32976. *
  32977. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32978. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32979. */
  32980. function matches(source) {
  32981. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32982. }
  32983. /**
  32984. * Creates a function that performs a partial deep comparison between the
  32985. * value at `path` of a given object to `srcValue`, returning `true` if the
  32986. * object value is equivalent, else `false`.
  32987. *
  32988. * **Note:** Partial comparisons will match empty array and empty object
  32989. * `srcValue` values against any array or object value, respectively. See
  32990. * `_.isEqual` for a list of supported value comparisons.
  32991. *
  32992. * @static
  32993. * @memberOf _
  32994. * @since 3.2.0
  32995. * @category Util
  32996. * @param {Array|string} path The path of the property to get.
  32997. * @param {*} srcValue The value to match.
  32998. * @returns {Function} Returns the new spec function.
  32999. * @example
  33000. *
  33001. * var objects = [
  33002. * { 'a': 1, 'b': 2, 'c': 3 },
  33003. * { 'a': 4, 'b': 5, 'c': 6 }
  33004. * ];
  33005. *
  33006. * _.find(objects, _.matchesProperty('a', 4));
  33007. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33008. */
  33009. function matchesProperty(path, srcValue) {
  33010. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33011. }
  33012. /**
  33013. * Creates a function that invokes the method at `path` of a given object.
  33014. * Any additional arguments are provided to the invoked method.
  33015. *
  33016. * @static
  33017. * @memberOf _
  33018. * @since 3.7.0
  33019. * @category Util
  33020. * @param {Array|string} path The path of the method to invoke.
  33021. * @param {...*} [args] The arguments to invoke the method with.
  33022. * @returns {Function} Returns the new invoker function.
  33023. * @example
  33024. *
  33025. * var objects = [
  33026. * { 'a': { 'b': _.constant(2) } },
  33027. * { 'a': { 'b': _.constant(1) } }
  33028. * ];
  33029. *
  33030. * _.map(objects, _.method('a.b'));
  33031. * // => [2, 1]
  33032. *
  33033. * _.map(objects, _.method(['a', 'b']));
  33034. * // => [2, 1]
  33035. */
  33036. var method = baseRest(function(path, args) {
  33037. return function(object) {
  33038. return baseInvoke(object, path, args);
  33039. };
  33040. });
  33041. /**
  33042. * The opposite of `_.method`; this method creates a function that invokes
  33043. * the method at a given path of `object`. Any additional arguments are
  33044. * provided to the invoked method.
  33045. *
  33046. * @static
  33047. * @memberOf _
  33048. * @since 3.7.0
  33049. * @category Util
  33050. * @param {Object} object The object to query.
  33051. * @param {...*} [args] The arguments to invoke the method with.
  33052. * @returns {Function} Returns the new invoker function.
  33053. * @example
  33054. *
  33055. * var array = _.times(3, _.constant),
  33056. * object = { 'a': array, 'b': array, 'c': array };
  33057. *
  33058. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33059. * // => [2, 0]
  33060. *
  33061. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33062. * // => [2, 0]
  33063. */
  33064. var methodOf = baseRest(function(object, args) {
  33065. return function(path) {
  33066. return baseInvoke(object, path, args);
  33067. };
  33068. });
  33069. /**
  33070. * Adds all own enumerable string keyed function properties of a source
  33071. * object to the destination object. If `object` is a function, then methods
  33072. * are added to its prototype as well.
  33073. *
  33074. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33075. * avoid conflicts caused by modifying the original.
  33076. *
  33077. * @static
  33078. * @since 0.1.0
  33079. * @memberOf _
  33080. * @category Util
  33081. * @param {Function|Object} [object=lodash] The destination object.
  33082. * @param {Object} source The object of functions to add.
  33083. * @param {Object} [options={}] The options object.
  33084. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33085. * @returns {Function|Object} Returns `object`.
  33086. * @example
  33087. *
  33088. * function vowels(string) {
  33089. * return _.filter(string, function(v) {
  33090. * return /[aeiou]/i.test(v);
  33091. * });
  33092. * }
  33093. *
  33094. * _.mixin({ 'vowels': vowels });
  33095. * _.vowels('fred');
  33096. * // => ['e']
  33097. *
  33098. * _('fred').vowels().value();
  33099. * // => ['e']
  33100. *
  33101. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33102. * _('fred').vowels();
  33103. * // => ['e']
  33104. */
  33105. function mixin(object, source, options) {
  33106. var props = keys(source),
  33107. methodNames = baseFunctions(source, props);
  33108. if (options == null &&
  33109. !(isObject(source) && (methodNames.length || !props.length))) {
  33110. options = source;
  33111. source = object;
  33112. object = this;
  33113. methodNames = baseFunctions(source, keys(source));
  33114. }
  33115. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33116. isFunc = isFunction(object);
  33117. arrayEach(methodNames, function(methodName) {
  33118. var func = source[methodName];
  33119. object[methodName] = func;
  33120. if (isFunc) {
  33121. object.prototype[methodName] = function() {
  33122. var chainAll = this.__chain__;
  33123. if (chain || chainAll) {
  33124. var result = object(this.__wrapped__),
  33125. actions = result.__actions__ = copyArray(this.__actions__);
  33126. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33127. result.__chain__ = chainAll;
  33128. return result;
  33129. }
  33130. return func.apply(object, arrayPush([this.value()], arguments));
  33131. };
  33132. }
  33133. });
  33134. return object;
  33135. }
  33136. /**
  33137. * Reverts the `_` variable to its previous value and returns a reference to
  33138. * the `lodash` function.
  33139. *
  33140. * @static
  33141. * @since 0.1.0
  33142. * @memberOf _
  33143. * @category Util
  33144. * @returns {Function} Returns the `lodash` function.
  33145. * @example
  33146. *
  33147. * var lodash = _.noConflict();
  33148. */
  33149. function noConflict() {
  33150. if (root._ === this) {
  33151. root._ = oldDash;
  33152. }
  33153. return this;
  33154. }
  33155. /**
  33156. * This method returns `undefined`.
  33157. *
  33158. * @static
  33159. * @memberOf _
  33160. * @since 2.3.0
  33161. * @category Util
  33162. * @example
  33163. *
  33164. * _.times(2, _.noop);
  33165. * // => [undefined, undefined]
  33166. */
  33167. function noop() {
  33168. // No operation performed.
  33169. }
  33170. /**
  33171. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33172. * the nth argument from the end is returned.
  33173. *
  33174. * @static
  33175. * @memberOf _
  33176. * @since 4.0.0
  33177. * @category Util
  33178. * @param {number} [n=0] The index of the argument to return.
  33179. * @returns {Function} Returns the new pass-thru function.
  33180. * @example
  33181. *
  33182. * var func = _.nthArg(1);
  33183. * func('a', 'b', 'c', 'd');
  33184. * // => 'b'
  33185. *
  33186. * var func = _.nthArg(-2);
  33187. * func('a', 'b', 'c', 'd');
  33188. * // => 'c'
  33189. */
  33190. function nthArg(n) {
  33191. n = toInteger(n);
  33192. return baseRest(function(args) {
  33193. return baseNth(args, n);
  33194. });
  33195. }
  33196. /**
  33197. * Creates a function that invokes `iteratees` with the arguments it receives
  33198. * and returns their results.
  33199. *
  33200. * @static
  33201. * @memberOf _
  33202. * @since 4.0.0
  33203. * @category Util
  33204. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33205. * The iteratees to invoke.
  33206. * @returns {Function} Returns the new function.
  33207. * @example
  33208. *
  33209. * var func = _.over([Math.max, Math.min]);
  33210. *
  33211. * func(1, 2, 3, 4);
  33212. * // => [4, 1]
  33213. */
  33214. var over = createOver(arrayMap);
  33215. /**
  33216. * Creates a function that checks if **all** of the `predicates` return
  33217. * truthy when invoked with the arguments it receives.
  33218. *
  33219. * @static
  33220. * @memberOf _
  33221. * @since 4.0.0
  33222. * @category Util
  33223. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33224. * The predicates to check.
  33225. * @returns {Function} Returns the new function.
  33226. * @example
  33227. *
  33228. * var func = _.overEvery([Boolean, isFinite]);
  33229. *
  33230. * func('1');
  33231. * // => true
  33232. *
  33233. * func(null);
  33234. * // => false
  33235. *
  33236. * func(NaN);
  33237. * // => false
  33238. */
  33239. var overEvery = createOver(arrayEvery);
  33240. /**
  33241. * Creates a function that checks if **any** of the `predicates` return
  33242. * truthy when invoked with the arguments it receives.
  33243. *
  33244. * @static
  33245. * @memberOf _
  33246. * @since 4.0.0
  33247. * @category Util
  33248. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33249. * The predicates to check.
  33250. * @returns {Function} Returns the new function.
  33251. * @example
  33252. *
  33253. * var func = _.overSome([Boolean, isFinite]);
  33254. *
  33255. * func('1');
  33256. * // => true
  33257. *
  33258. * func(null);
  33259. * // => true
  33260. *
  33261. * func(NaN);
  33262. * // => false
  33263. */
  33264. var overSome = createOver(arraySome);
  33265. /**
  33266. * Creates a function that returns the value at `path` of a given object.
  33267. *
  33268. * @static
  33269. * @memberOf _
  33270. * @since 2.4.0
  33271. * @category Util
  33272. * @param {Array|string} path The path of the property to get.
  33273. * @returns {Function} Returns the new accessor function.
  33274. * @example
  33275. *
  33276. * var objects = [
  33277. * { 'a': { 'b': 2 } },
  33278. * { 'a': { 'b': 1 } }
  33279. * ];
  33280. *
  33281. * _.map(objects, _.property('a.b'));
  33282. * // => [2, 1]
  33283. *
  33284. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33285. * // => [1, 2]
  33286. */
  33287. function property(path) {
  33288. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33289. }
  33290. /**
  33291. * The opposite of `_.property`; this method creates a function that returns
  33292. * the value at a given path of `object`.
  33293. *
  33294. * @static
  33295. * @memberOf _
  33296. * @since 3.0.0
  33297. * @category Util
  33298. * @param {Object} object The object to query.
  33299. * @returns {Function} Returns the new accessor function.
  33300. * @example
  33301. *
  33302. * var array = [0, 1, 2],
  33303. * object = { 'a': array, 'b': array, 'c': array };
  33304. *
  33305. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33306. * // => [2, 0]
  33307. *
  33308. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33309. * // => [2, 0]
  33310. */
  33311. function propertyOf(object) {
  33312. return function(path) {
  33313. return object == null ? undefined : baseGet(object, path);
  33314. };
  33315. }
  33316. /**
  33317. * Creates an array of numbers (positive and/or negative) progressing from
  33318. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33319. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33320. * it's set to `start` with `start` then set to `0`.
  33321. *
  33322. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33323. * floating-point values which can produce unexpected results.
  33324. *
  33325. * @static
  33326. * @since 0.1.0
  33327. * @memberOf _
  33328. * @category Util
  33329. * @param {number} [start=0] The start of the range.
  33330. * @param {number} end The end of the range.
  33331. * @param {number} [step=1] The value to increment or decrement by.
  33332. * @returns {Array} Returns the range of numbers.
  33333. * @see _.inRange, _.rangeRight
  33334. * @example
  33335. *
  33336. * _.range(4);
  33337. * // => [0, 1, 2, 3]
  33338. *
  33339. * _.range(-4);
  33340. * // => [0, -1, -2, -3]
  33341. *
  33342. * _.range(1, 5);
  33343. * // => [1, 2, 3, 4]
  33344. *
  33345. * _.range(0, 20, 5);
  33346. * // => [0, 5, 10, 15]
  33347. *
  33348. * _.range(0, -4, -1);
  33349. * // => [0, -1, -2, -3]
  33350. *
  33351. * _.range(1, 4, 0);
  33352. * // => [1, 1, 1]
  33353. *
  33354. * _.range(0);
  33355. * // => []
  33356. */
  33357. var range = createRange();
  33358. /**
  33359. * This method is like `_.range` except that it populates values in
  33360. * descending order.
  33361. *
  33362. * @static
  33363. * @memberOf _
  33364. * @since 4.0.0
  33365. * @category Util
  33366. * @param {number} [start=0] The start of the range.
  33367. * @param {number} end The end of the range.
  33368. * @param {number} [step=1] The value to increment or decrement by.
  33369. * @returns {Array} Returns the range of numbers.
  33370. * @see _.inRange, _.range
  33371. * @example
  33372. *
  33373. * _.rangeRight(4);
  33374. * // => [3, 2, 1, 0]
  33375. *
  33376. * _.rangeRight(-4);
  33377. * // => [-3, -2, -1, 0]
  33378. *
  33379. * _.rangeRight(1, 5);
  33380. * // => [4, 3, 2, 1]
  33381. *
  33382. * _.rangeRight(0, 20, 5);
  33383. * // => [15, 10, 5, 0]
  33384. *
  33385. * _.rangeRight(0, -4, -1);
  33386. * // => [-3, -2, -1, 0]
  33387. *
  33388. * _.rangeRight(1, 4, 0);
  33389. * // => [1, 1, 1]
  33390. *
  33391. * _.rangeRight(0);
  33392. * // => []
  33393. */
  33394. var rangeRight = createRange(true);
  33395. /**
  33396. * This method returns a new empty array.
  33397. *
  33398. * @static
  33399. * @memberOf _
  33400. * @since 4.13.0
  33401. * @category Util
  33402. * @returns {Array} Returns the new empty array.
  33403. * @example
  33404. *
  33405. * var arrays = _.times(2, _.stubArray);
  33406. *
  33407. * console.log(arrays);
  33408. * // => [[], []]
  33409. *
  33410. * console.log(arrays[0] === arrays[1]);
  33411. * // => false
  33412. */
  33413. function stubArray() {
  33414. return [];
  33415. }
  33416. /**
  33417. * This method returns `false`.
  33418. *
  33419. * @static
  33420. * @memberOf _
  33421. * @since 4.13.0
  33422. * @category Util
  33423. * @returns {boolean} Returns `false`.
  33424. * @example
  33425. *
  33426. * _.times(2, _.stubFalse);
  33427. * // => [false, false]
  33428. */
  33429. function stubFalse() {
  33430. return false;
  33431. }
  33432. /**
  33433. * This method returns a new empty object.
  33434. *
  33435. * @static
  33436. * @memberOf _
  33437. * @since 4.13.0
  33438. * @category Util
  33439. * @returns {Object} Returns the new empty object.
  33440. * @example
  33441. *
  33442. * var objects = _.times(2, _.stubObject);
  33443. *
  33444. * console.log(objects);
  33445. * // => [{}, {}]
  33446. *
  33447. * console.log(objects[0] === objects[1]);
  33448. * // => false
  33449. */
  33450. function stubObject() {
  33451. return {};
  33452. }
  33453. /**
  33454. * This method returns an empty string.
  33455. *
  33456. * @static
  33457. * @memberOf _
  33458. * @since 4.13.0
  33459. * @category Util
  33460. * @returns {string} Returns the empty string.
  33461. * @example
  33462. *
  33463. * _.times(2, _.stubString);
  33464. * // => ['', '']
  33465. */
  33466. function stubString() {
  33467. return '';
  33468. }
  33469. /**
  33470. * This method returns `true`.
  33471. *
  33472. * @static
  33473. * @memberOf _
  33474. * @since 4.13.0
  33475. * @category Util
  33476. * @returns {boolean} Returns `true`.
  33477. * @example
  33478. *
  33479. * _.times(2, _.stubTrue);
  33480. * // => [true, true]
  33481. */
  33482. function stubTrue() {
  33483. return true;
  33484. }
  33485. /**
  33486. * Invokes the iteratee `n` times, returning an array of the results of
  33487. * each invocation. The iteratee is invoked with one argument; (index).
  33488. *
  33489. * @static
  33490. * @since 0.1.0
  33491. * @memberOf _
  33492. * @category Util
  33493. * @param {number} n The number of times to invoke `iteratee`.
  33494. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33495. * @returns {Array} Returns the array of results.
  33496. * @example
  33497. *
  33498. * _.times(3, String);
  33499. * // => ['0', '1', '2']
  33500. *
  33501. * _.times(4, _.constant(0));
  33502. * // => [0, 0, 0, 0]
  33503. */
  33504. function times(n, iteratee) {
  33505. n = toInteger(n);
  33506. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33507. return [];
  33508. }
  33509. var index = MAX_ARRAY_LENGTH,
  33510. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33511. iteratee = getIteratee(iteratee);
  33512. n -= MAX_ARRAY_LENGTH;
  33513. var result = baseTimes(length, iteratee);
  33514. while (++index < n) {
  33515. iteratee(index);
  33516. }
  33517. return result;
  33518. }
  33519. /**
  33520. * Converts `value` to a property path array.
  33521. *
  33522. * @static
  33523. * @memberOf _
  33524. * @since 4.0.0
  33525. * @category Util
  33526. * @param {*} value The value to convert.
  33527. * @returns {Array} Returns the new property path array.
  33528. * @example
  33529. *
  33530. * _.toPath('a.b.c');
  33531. * // => ['a', 'b', 'c']
  33532. *
  33533. * _.toPath('a[0].b.c');
  33534. * // => ['a', '0', 'b', 'c']
  33535. */
  33536. function toPath(value) {
  33537. if (isArray(value)) {
  33538. return arrayMap(value, toKey);
  33539. }
  33540. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33541. }
  33542. /**
  33543. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33544. *
  33545. * @static
  33546. * @since 0.1.0
  33547. * @memberOf _
  33548. * @category Util
  33549. * @param {string} [prefix=''] The value to prefix the ID with.
  33550. * @returns {string} Returns the unique ID.
  33551. * @example
  33552. *
  33553. * _.uniqueId('contact_');
  33554. * // => 'contact_104'
  33555. *
  33556. * _.uniqueId();
  33557. * // => '105'
  33558. */
  33559. function uniqueId(prefix) {
  33560. var id = ++idCounter;
  33561. return toString(prefix) + id;
  33562. }
  33563. /*------------------------------------------------------------------------*/
  33564. /**
  33565. * Adds two numbers.
  33566. *
  33567. * @static
  33568. * @memberOf _
  33569. * @since 3.4.0
  33570. * @category Math
  33571. * @param {number} augend The first number in an addition.
  33572. * @param {number} addend The second number in an addition.
  33573. * @returns {number} Returns the total.
  33574. * @example
  33575. *
  33576. * _.add(6, 4);
  33577. * // => 10
  33578. */
  33579. var add = createMathOperation(function(augend, addend) {
  33580. return augend + addend;
  33581. }, 0);
  33582. /**
  33583. * Computes `number` rounded up to `precision`.
  33584. *
  33585. * @static
  33586. * @memberOf _
  33587. * @since 3.10.0
  33588. * @category Math
  33589. * @param {number} number The number to round up.
  33590. * @param {number} [precision=0] The precision to round up to.
  33591. * @returns {number} Returns the rounded up number.
  33592. * @example
  33593. *
  33594. * _.ceil(4.006);
  33595. * // => 5
  33596. *
  33597. * _.ceil(6.004, 2);
  33598. * // => 6.01
  33599. *
  33600. * _.ceil(6040, -2);
  33601. * // => 6100
  33602. */
  33603. var ceil = createRound('ceil');
  33604. /**
  33605. * Divide two numbers.
  33606. *
  33607. * @static
  33608. * @memberOf _
  33609. * @since 4.7.0
  33610. * @category Math
  33611. * @param {number} dividend The first number in a division.
  33612. * @param {number} divisor The second number in a division.
  33613. * @returns {number} Returns the quotient.
  33614. * @example
  33615. *
  33616. * _.divide(6, 4);
  33617. * // => 1.5
  33618. */
  33619. var divide = createMathOperation(function(dividend, divisor) {
  33620. return dividend / divisor;
  33621. }, 1);
  33622. /**
  33623. * Computes `number` rounded down to `precision`.
  33624. *
  33625. * @static
  33626. * @memberOf _
  33627. * @since 3.10.0
  33628. * @category Math
  33629. * @param {number} number The number to round down.
  33630. * @param {number} [precision=0] The precision to round down to.
  33631. * @returns {number} Returns the rounded down number.
  33632. * @example
  33633. *
  33634. * _.floor(4.006);
  33635. * // => 4
  33636. *
  33637. * _.floor(0.046, 2);
  33638. * // => 0.04
  33639. *
  33640. * _.floor(4060, -2);
  33641. * // => 4000
  33642. */
  33643. var floor = createRound('floor');
  33644. /**
  33645. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33646. * `undefined` is returned.
  33647. *
  33648. * @static
  33649. * @since 0.1.0
  33650. * @memberOf _
  33651. * @category Math
  33652. * @param {Array} array The array to iterate over.
  33653. * @returns {*} Returns the maximum value.
  33654. * @example
  33655. *
  33656. * _.max([4, 2, 8, 6]);
  33657. * // => 8
  33658. *
  33659. * _.max([]);
  33660. * // => undefined
  33661. */
  33662. function max(array) {
  33663. return (array && array.length)
  33664. ? baseExtremum(array, identity, baseGt)
  33665. : undefined;
  33666. }
  33667. /**
  33668. * This method is like `_.max` except that it accepts `iteratee` which is
  33669. * invoked for each element in `array` to generate the criterion by which
  33670. * the value is ranked. The iteratee is invoked with one argument: (value).
  33671. *
  33672. * @static
  33673. * @memberOf _
  33674. * @since 4.0.0
  33675. * @category Math
  33676. * @param {Array} array The array to iterate over.
  33677. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33678. * @returns {*} Returns the maximum value.
  33679. * @example
  33680. *
  33681. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33682. *
  33683. * _.maxBy(objects, function(o) { return o.n; });
  33684. * // => { 'n': 2 }
  33685. *
  33686. * // The `_.property` iteratee shorthand.
  33687. * _.maxBy(objects, 'n');
  33688. * // => { 'n': 2 }
  33689. */
  33690. function maxBy(array, iteratee) {
  33691. return (array && array.length)
  33692. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33693. : undefined;
  33694. }
  33695. /**
  33696. * Computes the mean of the values in `array`.
  33697. *
  33698. * @static
  33699. * @memberOf _
  33700. * @since 4.0.0
  33701. * @category Math
  33702. * @param {Array} array The array to iterate over.
  33703. * @returns {number} Returns the mean.
  33704. * @example
  33705. *
  33706. * _.mean([4, 2, 8, 6]);
  33707. * // => 5
  33708. */
  33709. function mean(array) {
  33710. return baseMean(array, identity);
  33711. }
  33712. /**
  33713. * This method is like `_.mean` except that it accepts `iteratee` which is
  33714. * invoked for each element in `array` to generate the value to be averaged.
  33715. * The iteratee is invoked with one argument: (value).
  33716. *
  33717. * @static
  33718. * @memberOf _
  33719. * @since 4.7.0
  33720. * @category Math
  33721. * @param {Array} array The array to iterate over.
  33722. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33723. * @returns {number} Returns the mean.
  33724. * @example
  33725. *
  33726. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33727. *
  33728. * _.meanBy(objects, function(o) { return o.n; });
  33729. * // => 5
  33730. *
  33731. * // The `_.property` iteratee shorthand.
  33732. * _.meanBy(objects, 'n');
  33733. * // => 5
  33734. */
  33735. function meanBy(array, iteratee) {
  33736. return baseMean(array, getIteratee(iteratee, 2));
  33737. }
  33738. /**
  33739. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33740. * `undefined` is returned.
  33741. *
  33742. * @static
  33743. * @since 0.1.0
  33744. * @memberOf _
  33745. * @category Math
  33746. * @param {Array} array The array to iterate over.
  33747. * @returns {*} Returns the minimum value.
  33748. * @example
  33749. *
  33750. * _.min([4, 2, 8, 6]);
  33751. * // => 2
  33752. *
  33753. * _.min([]);
  33754. * // => undefined
  33755. */
  33756. function min(array) {
  33757. return (array && array.length)
  33758. ? baseExtremum(array, identity, baseLt)
  33759. : undefined;
  33760. }
  33761. /**
  33762. * This method is like `_.min` except that it accepts `iteratee` which is
  33763. * invoked for each element in `array` to generate the criterion by which
  33764. * the value is ranked. The iteratee is invoked with one argument: (value).
  33765. *
  33766. * @static
  33767. * @memberOf _
  33768. * @since 4.0.0
  33769. * @category Math
  33770. * @param {Array} array The array to iterate over.
  33771. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33772. * @returns {*} Returns the minimum value.
  33773. * @example
  33774. *
  33775. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33776. *
  33777. * _.minBy(objects, function(o) { return o.n; });
  33778. * // => { 'n': 1 }
  33779. *
  33780. * // The `_.property` iteratee shorthand.
  33781. * _.minBy(objects, 'n');
  33782. * // => { 'n': 1 }
  33783. */
  33784. function minBy(array, iteratee) {
  33785. return (array && array.length)
  33786. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33787. : undefined;
  33788. }
  33789. /**
  33790. * Multiply two numbers.
  33791. *
  33792. * @static
  33793. * @memberOf _
  33794. * @since 4.7.0
  33795. * @category Math
  33796. * @param {number} multiplier The first number in a multiplication.
  33797. * @param {number} multiplicand The second number in a multiplication.
  33798. * @returns {number} Returns the product.
  33799. * @example
  33800. *
  33801. * _.multiply(6, 4);
  33802. * // => 24
  33803. */
  33804. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33805. return multiplier * multiplicand;
  33806. }, 1);
  33807. /**
  33808. * Computes `number` rounded to `precision`.
  33809. *
  33810. * @static
  33811. * @memberOf _
  33812. * @since 3.10.0
  33813. * @category Math
  33814. * @param {number} number The number to round.
  33815. * @param {number} [precision=0] The precision to round to.
  33816. * @returns {number} Returns the rounded number.
  33817. * @example
  33818. *
  33819. * _.round(4.006);
  33820. * // => 4
  33821. *
  33822. * _.round(4.006, 2);
  33823. * // => 4.01
  33824. *
  33825. * _.round(4060, -2);
  33826. * // => 4100
  33827. */
  33828. var round = createRound('round');
  33829. /**
  33830. * Subtract two numbers.
  33831. *
  33832. * @static
  33833. * @memberOf _
  33834. * @since 4.0.0
  33835. * @category Math
  33836. * @param {number} minuend The first number in a subtraction.
  33837. * @param {number} subtrahend The second number in a subtraction.
  33838. * @returns {number} Returns the difference.
  33839. * @example
  33840. *
  33841. * _.subtract(6, 4);
  33842. * // => 2
  33843. */
  33844. var subtract = createMathOperation(function(minuend, subtrahend) {
  33845. return minuend - subtrahend;
  33846. }, 0);
  33847. /**
  33848. * Computes the sum of the values in `array`.
  33849. *
  33850. * @static
  33851. * @memberOf _
  33852. * @since 3.4.0
  33853. * @category Math
  33854. * @param {Array} array The array to iterate over.
  33855. * @returns {number} Returns the sum.
  33856. * @example
  33857. *
  33858. * _.sum([4, 2, 8, 6]);
  33859. * // => 20
  33860. */
  33861. function sum(array) {
  33862. return (array && array.length)
  33863. ? baseSum(array, identity)
  33864. : 0;
  33865. }
  33866. /**
  33867. * This method is like `_.sum` except that it accepts `iteratee` which is
  33868. * invoked for each element in `array` to generate the value to be summed.
  33869. * The iteratee is invoked with one argument: (value).
  33870. *
  33871. * @static
  33872. * @memberOf _
  33873. * @since 4.0.0
  33874. * @category Math
  33875. * @param {Array} array The array to iterate over.
  33876. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33877. * @returns {number} Returns the sum.
  33878. * @example
  33879. *
  33880. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33881. *
  33882. * _.sumBy(objects, function(o) { return o.n; });
  33883. * // => 20
  33884. *
  33885. * // The `_.property` iteratee shorthand.
  33886. * _.sumBy(objects, 'n');
  33887. * // => 20
  33888. */
  33889. function sumBy(array, iteratee) {
  33890. return (array && array.length)
  33891. ? baseSum(array, getIteratee(iteratee, 2))
  33892. : 0;
  33893. }
  33894. /*------------------------------------------------------------------------*/
  33895. // Add methods that return wrapped values in chain sequences.
  33896. lodash.after = after;
  33897. lodash.ary = ary;
  33898. lodash.assign = assign;
  33899. lodash.assignIn = assignIn;
  33900. lodash.assignInWith = assignInWith;
  33901. lodash.assignWith = assignWith;
  33902. lodash.at = at;
  33903. lodash.before = before;
  33904. lodash.bind = bind;
  33905. lodash.bindAll = bindAll;
  33906. lodash.bindKey = bindKey;
  33907. lodash.castArray = castArray;
  33908. lodash.chain = chain;
  33909. lodash.chunk = chunk;
  33910. lodash.compact = compact;
  33911. lodash.concat = concat;
  33912. lodash.cond = cond;
  33913. lodash.conforms = conforms;
  33914. lodash.constant = constant;
  33915. lodash.countBy = countBy;
  33916. lodash.create = create;
  33917. lodash.curry = curry;
  33918. lodash.curryRight = curryRight;
  33919. lodash.debounce = debounce;
  33920. lodash.defaults = defaults;
  33921. lodash.defaultsDeep = defaultsDeep;
  33922. lodash.defer = defer;
  33923. lodash.delay = delay;
  33924. lodash.difference = difference;
  33925. lodash.differenceBy = differenceBy;
  33926. lodash.differenceWith = differenceWith;
  33927. lodash.drop = drop;
  33928. lodash.dropRight = dropRight;
  33929. lodash.dropRightWhile = dropRightWhile;
  33930. lodash.dropWhile = dropWhile;
  33931. lodash.fill = fill;
  33932. lodash.filter = filter;
  33933. lodash.flatMap = flatMap;
  33934. lodash.flatMapDeep = flatMapDeep;
  33935. lodash.flatMapDepth = flatMapDepth;
  33936. lodash.flatten = flatten;
  33937. lodash.flattenDeep = flattenDeep;
  33938. lodash.flattenDepth = flattenDepth;
  33939. lodash.flip = flip;
  33940. lodash.flow = flow;
  33941. lodash.flowRight = flowRight;
  33942. lodash.fromPairs = fromPairs;
  33943. lodash.functions = functions;
  33944. lodash.functionsIn = functionsIn;
  33945. lodash.groupBy = groupBy;
  33946. lodash.initial = initial;
  33947. lodash.intersection = intersection;
  33948. lodash.intersectionBy = intersectionBy;
  33949. lodash.intersectionWith = intersectionWith;
  33950. lodash.invert = invert;
  33951. lodash.invertBy = invertBy;
  33952. lodash.invokeMap = invokeMap;
  33953. lodash.iteratee = iteratee;
  33954. lodash.keyBy = keyBy;
  33955. lodash.keys = keys;
  33956. lodash.keysIn = keysIn;
  33957. lodash.map = map;
  33958. lodash.mapKeys = mapKeys;
  33959. lodash.mapValues = mapValues;
  33960. lodash.matches = matches;
  33961. lodash.matchesProperty = matchesProperty;
  33962. lodash.memoize = memoize;
  33963. lodash.merge = merge;
  33964. lodash.mergeWith = mergeWith;
  33965. lodash.method = method;
  33966. lodash.methodOf = methodOf;
  33967. lodash.mixin = mixin;
  33968. lodash.negate = negate;
  33969. lodash.nthArg = nthArg;
  33970. lodash.omit = omit;
  33971. lodash.omitBy = omitBy;
  33972. lodash.once = once;
  33973. lodash.orderBy = orderBy;
  33974. lodash.over = over;
  33975. lodash.overArgs = overArgs;
  33976. lodash.overEvery = overEvery;
  33977. lodash.overSome = overSome;
  33978. lodash.partial = partial;
  33979. lodash.partialRight = partialRight;
  33980. lodash.partition = partition;
  33981. lodash.pick = pick;
  33982. lodash.pickBy = pickBy;
  33983. lodash.property = property;
  33984. lodash.propertyOf = propertyOf;
  33985. lodash.pull = pull;
  33986. lodash.pullAll = pullAll;
  33987. lodash.pullAllBy = pullAllBy;
  33988. lodash.pullAllWith = pullAllWith;
  33989. lodash.pullAt = pullAt;
  33990. lodash.range = range;
  33991. lodash.rangeRight = rangeRight;
  33992. lodash.rearg = rearg;
  33993. lodash.reject = reject;
  33994. lodash.remove = remove;
  33995. lodash.rest = rest;
  33996. lodash.reverse = reverse;
  33997. lodash.sampleSize = sampleSize;
  33998. lodash.set = set;
  33999. lodash.setWith = setWith;
  34000. lodash.shuffle = shuffle;
  34001. lodash.slice = slice;
  34002. lodash.sortBy = sortBy;
  34003. lodash.sortedUniq = sortedUniq;
  34004. lodash.sortedUniqBy = sortedUniqBy;
  34005. lodash.split = split;
  34006. lodash.spread = spread;
  34007. lodash.tail = tail;
  34008. lodash.take = take;
  34009. lodash.takeRight = takeRight;
  34010. lodash.takeRightWhile = takeRightWhile;
  34011. lodash.takeWhile = takeWhile;
  34012. lodash.tap = tap;
  34013. lodash.throttle = throttle;
  34014. lodash.thru = thru;
  34015. lodash.toArray = toArray;
  34016. lodash.toPairs = toPairs;
  34017. lodash.toPairsIn = toPairsIn;
  34018. lodash.toPath = toPath;
  34019. lodash.toPlainObject = toPlainObject;
  34020. lodash.transform = transform;
  34021. lodash.unary = unary;
  34022. lodash.union = union;
  34023. lodash.unionBy = unionBy;
  34024. lodash.unionWith = unionWith;
  34025. lodash.uniq = uniq;
  34026. lodash.uniqBy = uniqBy;
  34027. lodash.uniqWith = uniqWith;
  34028. lodash.unset = unset;
  34029. lodash.unzip = unzip;
  34030. lodash.unzipWith = unzipWith;
  34031. lodash.update = update;
  34032. lodash.updateWith = updateWith;
  34033. lodash.values = values;
  34034. lodash.valuesIn = valuesIn;
  34035. lodash.without = without;
  34036. lodash.words = words;
  34037. lodash.wrap = wrap;
  34038. lodash.xor = xor;
  34039. lodash.xorBy = xorBy;
  34040. lodash.xorWith = xorWith;
  34041. lodash.zip = zip;
  34042. lodash.zipObject = zipObject;
  34043. lodash.zipObjectDeep = zipObjectDeep;
  34044. lodash.zipWith = zipWith;
  34045. // Add aliases.
  34046. lodash.entries = toPairs;
  34047. lodash.entriesIn = toPairsIn;
  34048. lodash.extend = assignIn;
  34049. lodash.extendWith = assignInWith;
  34050. // Add methods to `lodash.prototype`.
  34051. mixin(lodash, lodash);
  34052. /*------------------------------------------------------------------------*/
  34053. // Add methods that return unwrapped values in chain sequences.
  34054. lodash.add = add;
  34055. lodash.attempt = attempt;
  34056. lodash.camelCase = camelCase;
  34057. lodash.capitalize = capitalize;
  34058. lodash.ceil = ceil;
  34059. lodash.clamp = clamp;
  34060. lodash.clone = clone;
  34061. lodash.cloneDeep = cloneDeep;
  34062. lodash.cloneDeepWith = cloneDeepWith;
  34063. lodash.cloneWith = cloneWith;
  34064. lodash.conformsTo = conformsTo;
  34065. lodash.deburr = deburr;
  34066. lodash.defaultTo = defaultTo;
  34067. lodash.divide = divide;
  34068. lodash.endsWith = endsWith;
  34069. lodash.eq = eq;
  34070. lodash.escape = escape;
  34071. lodash.escapeRegExp = escapeRegExp;
  34072. lodash.every = every;
  34073. lodash.find = find;
  34074. lodash.findIndex = findIndex;
  34075. lodash.findKey = findKey;
  34076. lodash.findLast = findLast;
  34077. lodash.findLastIndex = findLastIndex;
  34078. lodash.findLastKey = findLastKey;
  34079. lodash.floor = floor;
  34080. lodash.forEach = forEach;
  34081. lodash.forEachRight = forEachRight;
  34082. lodash.forIn = forIn;
  34083. lodash.forInRight = forInRight;
  34084. lodash.forOwn = forOwn;
  34085. lodash.forOwnRight = forOwnRight;
  34086. lodash.get = get;
  34087. lodash.gt = gt;
  34088. lodash.gte = gte;
  34089. lodash.has = has;
  34090. lodash.hasIn = hasIn;
  34091. lodash.head = head;
  34092. lodash.identity = identity;
  34093. lodash.includes = includes;
  34094. lodash.indexOf = indexOf;
  34095. lodash.inRange = inRange;
  34096. lodash.invoke = invoke;
  34097. lodash.isArguments = isArguments;
  34098. lodash.isArray = isArray;
  34099. lodash.isArrayBuffer = isArrayBuffer;
  34100. lodash.isArrayLike = isArrayLike;
  34101. lodash.isArrayLikeObject = isArrayLikeObject;
  34102. lodash.isBoolean = isBoolean;
  34103. lodash.isBuffer = isBuffer;
  34104. lodash.isDate = isDate;
  34105. lodash.isElement = isElement;
  34106. lodash.isEmpty = isEmpty;
  34107. lodash.isEqual = isEqual;
  34108. lodash.isEqualWith = isEqualWith;
  34109. lodash.isError = isError;
  34110. lodash.isFinite = isFinite;
  34111. lodash.isFunction = isFunction;
  34112. lodash.isInteger = isInteger;
  34113. lodash.isLength = isLength;
  34114. lodash.isMap = isMap;
  34115. lodash.isMatch = isMatch;
  34116. lodash.isMatchWith = isMatchWith;
  34117. lodash.isNaN = isNaN;
  34118. lodash.isNative = isNative;
  34119. lodash.isNil = isNil;
  34120. lodash.isNull = isNull;
  34121. lodash.isNumber = isNumber;
  34122. lodash.isObject = isObject;
  34123. lodash.isObjectLike = isObjectLike;
  34124. lodash.isPlainObject = isPlainObject;
  34125. lodash.isRegExp = isRegExp;
  34126. lodash.isSafeInteger = isSafeInteger;
  34127. lodash.isSet = isSet;
  34128. lodash.isString = isString;
  34129. lodash.isSymbol = isSymbol;
  34130. lodash.isTypedArray = isTypedArray;
  34131. lodash.isUndefined = isUndefined;
  34132. lodash.isWeakMap = isWeakMap;
  34133. lodash.isWeakSet = isWeakSet;
  34134. lodash.join = join;
  34135. lodash.kebabCase = kebabCase;
  34136. lodash.last = last;
  34137. lodash.lastIndexOf = lastIndexOf;
  34138. lodash.lowerCase = lowerCase;
  34139. lodash.lowerFirst = lowerFirst;
  34140. lodash.lt = lt;
  34141. lodash.lte = lte;
  34142. lodash.max = max;
  34143. lodash.maxBy = maxBy;
  34144. lodash.mean = mean;
  34145. lodash.meanBy = meanBy;
  34146. lodash.min = min;
  34147. lodash.minBy = minBy;
  34148. lodash.stubArray = stubArray;
  34149. lodash.stubFalse = stubFalse;
  34150. lodash.stubObject = stubObject;
  34151. lodash.stubString = stubString;
  34152. lodash.stubTrue = stubTrue;
  34153. lodash.multiply = multiply;
  34154. lodash.nth = nth;
  34155. lodash.noConflict = noConflict;
  34156. lodash.noop = noop;
  34157. lodash.now = now;
  34158. lodash.pad = pad;
  34159. lodash.padEnd = padEnd;
  34160. lodash.padStart = padStart;
  34161. lodash.parseInt = parseInt;
  34162. lodash.random = random;
  34163. lodash.reduce = reduce;
  34164. lodash.reduceRight = reduceRight;
  34165. lodash.repeat = repeat;
  34166. lodash.replace = replace;
  34167. lodash.result = result;
  34168. lodash.round = round;
  34169. lodash.runInContext = runInContext;
  34170. lodash.sample = sample;
  34171. lodash.size = size;
  34172. lodash.snakeCase = snakeCase;
  34173. lodash.some = some;
  34174. lodash.sortedIndex = sortedIndex;
  34175. lodash.sortedIndexBy = sortedIndexBy;
  34176. lodash.sortedIndexOf = sortedIndexOf;
  34177. lodash.sortedLastIndex = sortedLastIndex;
  34178. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34179. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34180. lodash.startCase = startCase;
  34181. lodash.startsWith = startsWith;
  34182. lodash.subtract = subtract;
  34183. lodash.sum = sum;
  34184. lodash.sumBy = sumBy;
  34185. lodash.template = template;
  34186. lodash.times = times;
  34187. lodash.toFinite = toFinite;
  34188. lodash.toInteger = toInteger;
  34189. lodash.toLength = toLength;
  34190. lodash.toLower = toLower;
  34191. lodash.toNumber = toNumber;
  34192. lodash.toSafeInteger = toSafeInteger;
  34193. lodash.toString = toString;
  34194. lodash.toUpper = toUpper;
  34195. lodash.trim = trim;
  34196. lodash.trimEnd = trimEnd;
  34197. lodash.trimStart = trimStart;
  34198. lodash.truncate = truncate;
  34199. lodash.unescape = unescape;
  34200. lodash.uniqueId = uniqueId;
  34201. lodash.upperCase = upperCase;
  34202. lodash.upperFirst = upperFirst;
  34203. // Add aliases.
  34204. lodash.each = forEach;
  34205. lodash.eachRight = forEachRight;
  34206. lodash.first = head;
  34207. mixin(lodash, (function() {
  34208. var source = {};
  34209. baseForOwn(lodash, function(func, methodName) {
  34210. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34211. source[methodName] = func;
  34212. }
  34213. });
  34214. return source;
  34215. }()), { 'chain': false });
  34216. /*------------------------------------------------------------------------*/
  34217. /**
  34218. * The semantic version number.
  34219. *
  34220. * @static
  34221. * @memberOf _
  34222. * @type {string}
  34223. */
  34224. lodash.VERSION = VERSION;
  34225. // Assign default placeholders.
  34226. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34227. lodash[methodName].placeholder = lodash;
  34228. });
  34229. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34230. arrayEach(['drop', 'take'], function(methodName, index) {
  34231. LazyWrapper.prototype[methodName] = function(n) {
  34232. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34233. var result = (this.__filtered__ && !index)
  34234. ? new LazyWrapper(this)
  34235. : this.clone();
  34236. if (result.__filtered__) {
  34237. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34238. } else {
  34239. result.__views__.push({
  34240. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34241. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34242. });
  34243. }
  34244. return result;
  34245. };
  34246. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34247. return this.reverse()[methodName](n).reverse();
  34248. };
  34249. });
  34250. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34251. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34252. var type = index + 1,
  34253. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34254. LazyWrapper.prototype[methodName] = function(iteratee) {
  34255. var result = this.clone();
  34256. result.__iteratees__.push({
  34257. 'iteratee': getIteratee(iteratee, 3),
  34258. 'type': type
  34259. });
  34260. result.__filtered__ = result.__filtered__ || isFilter;
  34261. return result;
  34262. };
  34263. });
  34264. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34265. arrayEach(['head', 'last'], function(methodName, index) {
  34266. var takeName = 'take' + (index ? 'Right' : '');
  34267. LazyWrapper.prototype[methodName] = function() {
  34268. return this[takeName](1).value()[0];
  34269. };
  34270. });
  34271. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34272. arrayEach(['initial', 'tail'], function(methodName, index) {
  34273. var dropName = 'drop' + (index ? '' : 'Right');
  34274. LazyWrapper.prototype[methodName] = function() {
  34275. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34276. };
  34277. });
  34278. LazyWrapper.prototype.compact = function() {
  34279. return this.filter(identity);
  34280. };
  34281. LazyWrapper.prototype.find = function(predicate) {
  34282. return this.filter(predicate).head();
  34283. };
  34284. LazyWrapper.prototype.findLast = function(predicate) {
  34285. return this.reverse().find(predicate);
  34286. };
  34287. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34288. if (typeof path == 'function') {
  34289. return new LazyWrapper(this);
  34290. }
  34291. return this.map(function(value) {
  34292. return baseInvoke(value, path, args);
  34293. });
  34294. });
  34295. LazyWrapper.prototype.reject = function(predicate) {
  34296. return this.filter(negate(getIteratee(predicate)));
  34297. };
  34298. LazyWrapper.prototype.slice = function(start, end) {
  34299. start = toInteger(start);
  34300. var result = this;
  34301. if (result.__filtered__ && (start > 0 || end < 0)) {
  34302. return new LazyWrapper(result);
  34303. }
  34304. if (start < 0) {
  34305. result = result.takeRight(-start);
  34306. } else if (start) {
  34307. result = result.drop(start);
  34308. }
  34309. if (end !== undefined) {
  34310. end = toInteger(end);
  34311. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34312. }
  34313. return result;
  34314. };
  34315. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34316. return this.reverse().takeWhile(predicate).reverse();
  34317. };
  34318. LazyWrapper.prototype.toArray = function() {
  34319. return this.take(MAX_ARRAY_LENGTH);
  34320. };
  34321. // Add `LazyWrapper` methods to `lodash.prototype`.
  34322. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34323. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34324. isTaker = /^(?:head|last)$/.test(methodName),
  34325. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34326. retUnwrapped = isTaker || /^find/.test(methodName);
  34327. if (!lodashFunc) {
  34328. return;
  34329. }
  34330. lodash.prototype[methodName] = function() {
  34331. var value = this.__wrapped__,
  34332. args = isTaker ? [1] : arguments,
  34333. isLazy = value instanceof LazyWrapper,
  34334. iteratee = args[0],
  34335. useLazy = isLazy || isArray(value);
  34336. var interceptor = function(value) {
  34337. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34338. return (isTaker && chainAll) ? result[0] : result;
  34339. };
  34340. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34341. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34342. isLazy = useLazy = false;
  34343. }
  34344. var chainAll = this.__chain__,
  34345. isHybrid = !!this.__actions__.length,
  34346. isUnwrapped = retUnwrapped && !chainAll,
  34347. onlyLazy = isLazy && !isHybrid;
  34348. if (!retUnwrapped && useLazy) {
  34349. value = onlyLazy ? value : new LazyWrapper(this);
  34350. var result = func.apply(value, args);
  34351. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34352. return new LodashWrapper(result, chainAll);
  34353. }
  34354. if (isUnwrapped && onlyLazy) {
  34355. return func.apply(this, args);
  34356. }
  34357. result = this.thru(interceptor);
  34358. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34359. };
  34360. });
  34361. // Add `Array` methods to `lodash.prototype`.
  34362. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34363. var func = arrayProto[methodName],
  34364. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34365. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34366. lodash.prototype[methodName] = function() {
  34367. var args = arguments;
  34368. if (retUnwrapped && !this.__chain__) {
  34369. var value = this.value();
  34370. return func.apply(isArray(value) ? value : [], args);
  34371. }
  34372. return this[chainName](function(value) {
  34373. return func.apply(isArray(value) ? value : [], args);
  34374. });
  34375. };
  34376. });
  34377. // Map minified method names to their real names.
  34378. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34379. var lodashFunc = lodash[methodName];
  34380. if (lodashFunc) {
  34381. var key = lodashFunc.name + '';
  34382. if (!hasOwnProperty.call(realNames, key)) {
  34383. realNames[key] = [];
  34384. }
  34385. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34386. }
  34387. });
  34388. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34389. 'name': 'wrapper',
  34390. 'func': undefined
  34391. }];
  34392. // Add methods to `LazyWrapper`.
  34393. LazyWrapper.prototype.clone = lazyClone;
  34394. LazyWrapper.prototype.reverse = lazyReverse;
  34395. LazyWrapper.prototype.value = lazyValue;
  34396. // Add chain sequence methods to the `lodash` wrapper.
  34397. lodash.prototype.at = wrapperAt;
  34398. lodash.prototype.chain = wrapperChain;
  34399. lodash.prototype.commit = wrapperCommit;
  34400. lodash.prototype.next = wrapperNext;
  34401. lodash.prototype.plant = wrapperPlant;
  34402. lodash.prototype.reverse = wrapperReverse;
  34403. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34404. // Add lazy aliases.
  34405. lodash.prototype.first = lodash.prototype.head;
  34406. if (symIterator) {
  34407. lodash.prototype[symIterator] = wrapperToIterator;
  34408. }
  34409. return lodash;
  34410. });
  34411. /*--------------------------------------------------------------------------*/
  34412. // Export lodash.
  34413. var _ = runInContext();
  34414. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34415. if (true) {
  34416. // Expose Lodash on the global object to prevent errors when Lodash is
  34417. // loaded by a script tag in the presence of an AMD loader.
  34418. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34419. // Use `_.noConflict` to remove Lodash from the global object.
  34420. root._ = _;
  34421. // Define as an anonymous module so, through path mapping, it can be
  34422. // referenced as the "underscore" module.
  34423. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34424. return _;
  34425. }).call(exports, __webpack_require__, exports, module),
  34426. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34427. }
  34428. // Check for `exports` after `define` in case a build optimizer adds it.
  34429. else {}
  34430. }.call(this));
  34431. /* 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)))
  34432. /***/ }),
  34433. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34434. /*!***************************************************!*\
  34435. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34436. \***************************************************/
  34437. /*! exports provided: default */
  34438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34439. "use strict";
  34440. __webpack_require__.r(__webpack_exports__);
  34441. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34442. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34443. * @version 1.16.1
  34444. * @license
  34445. * Copyright (c) 2016 Federico Zivolo and contributors
  34446. *
  34447. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34448. * of this software and associated documentation files (the "Software"), to deal
  34449. * in the Software without restriction, including without limitation the rights
  34450. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34451. * copies of the Software, and to permit persons to whom the Software is
  34452. * furnished to do so, subject to the following conditions:
  34453. *
  34454. * The above copyright notice and this permission notice shall be included in all
  34455. * copies or substantial portions of the Software.
  34456. *
  34457. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34458. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34459. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34460. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34461. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34462. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34463. * SOFTWARE.
  34464. */
  34465. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34466. var timeoutDuration = function () {
  34467. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34468. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34469. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34470. return 1;
  34471. }
  34472. }
  34473. return 0;
  34474. }();
  34475. function microtaskDebounce(fn) {
  34476. var called = false;
  34477. return function () {
  34478. if (called) {
  34479. return;
  34480. }
  34481. called = true;
  34482. window.Promise.resolve().then(function () {
  34483. called = false;
  34484. fn();
  34485. });
  34486. };
  34487. }
  34488. function taskDebounce(fn) {
  34489. var scheduled = false;
  34490. return function () {
  34491. if (!scheduled) {
  34492. scheduled = true;
  34493. setTimeout(function () {
  34494. scheduled = false;
  34495. fn();
  34496. }, timeoutDuration);
  34497. }
  34498. };
  34499. }
  34500. var supportsMicroTasks = isBrowser && window.Promise;
  34501. /**
  34502. * Create a debounced version of a method, that's asynchronously deferred
  34503. * but called in the minimum time possible.
  34504. *
  34505. * @method
  34506. * @memberof Popper.Utils
  34507. * @argument {Function} fn
  34508. * @returns {Function}
  34509. */
  34510. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34511. /**
  34512. * Check if the given variable is a function
  34513. * @method
  34514. * @memberof Popper.Utils
  34515. * @argument {Any} functionToCheck - variable to check
  34516. * @returns {Boolean} answer to: is a function?
  34517. */
  34518. function isFunction(functionToCheck) {
  34519. var getType = {};
  34520. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34521. }
  34522. /**
  34523. * Get CSS computed property of the given element
  34524. * @method
  34525. * @memberof Popper.Utils
  34526. * @argument {Eement} element
  34527. * @argument {String} property
  34528. */
  34529. function getStyleComputedProperty(element, property) {
  34530. if (element.nodeType !== 1) {
  34531. return [];
  34532. }
  34533. // NOTE: 1 DOM access here
  34534. var window = element.ownerDocument.defaultView;
  34535. var css = window.getComputedStyle(element, null);
  34536. return property ? css[property] : css;
  34537. }
  34538. /**
  34539. * Returns the parentNode or the host of the element
  34540. * @method
  34541. * @memberof Popper.Utils
  34542. * @argument {Element} element
  34543. * @returns {Element} parent
  34544. */
  34545. function getParentNode(element) {
  34546. if (element.nodeName === 'HTML') {
  34547. return element;
  34548. }
  34549. return element.parentNode || element.host;
  34550. }
  34551. /**
  34552. * Returns the scrolling parent of the given element
  34553. * @method
  34554. * @memberof Popper.Utils
  34555. * @argument {Element} element
  34556. * @returns {Element} scroll parent
  34557. */
  34558. function getScrollParent(element) {
  34559. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34560. if (!element) {
  34561. return document.body;
  34562. }
  34563. switch (element.nodeName) {
  34564. case 'HTML':
  34565. case 'BODY':
  34566. return element.ownerDocument.body;
  34567. case '#document':
  34568. return element.body;
  34569. }
  34570. // Firefox want us to check `-x` and `-y` variations as well
  34571. var _getStyleComputedProp = getStyleComputedProperty(element),
  34572. overflow = _getStyleComputedProp.overflow,
  34573. overflowX = _getStyleComputedProp.overflowX,
  34574. overflowY = _getStyleComputedProp.overflowY;
  34575. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34576. return element;
  34577. }
  34578. return getScrollParent(getParentNode(element));
  34579. }
  34580. /**
  34581. * Returns the reference node of the reference object, or the reference object itself.
  34582. * @method
  34583. * @memberof Popper.Utils
  34584. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34585. * @returns {Element} parent
  34586. */
  34587. function getReferenceNode(reference) {
  34588. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34589. }
  34590. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34591. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34592. /**
  34593. * Determines if the browser is Internet Explorer
  34594. * @method
  34595. * @memberof Popper.Utils
  34596. * @param {Number} version to check
  34597. * @returns {Boolean} isIE
  34598. */
  34599. function isIE(version) {
  34600. if (version === 11) {
  34601. return isIE11;
  34602. }
  34603. if (version === 10) {
  34604. return isIE10;
  34605. }
  34606. return isIE11 || isIE10;
  34607. }
  34608. /**
  34609. * Returns the offset parent of the given element
  34610. * @method
  34611. * @memberof Popper.Utils
  34612. * @argument {Element} element
  34613. * @returns {Element} offset parent
  34614. */
  34615. function getOffsetParent(element) {
  34616. if (!element) {
  34617. return document.documentElement;
  34618. }
  34619. var noOffsetParent = isIE(10) ? document.body : null;
  34620. // NOTE: 1 DOM access here
  34621. var offsetParent = element.offsetParent || null;
  34622. // Skip hidden elements which don't have an offsetParent
  34623. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34624. offsetParent = (element = element.nextElementSibling).offsetParent;
  34625. }
  34626. var nodeName = offsetParent && offsetParent.nodeName;
  34627. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34628. return element ? element.ownerDocument.documentElement : document.documentElement;
  34629. }
  34630. // .offsetParent will return the closest TH, TD or TABLE in case
  34631. // no offsetParent is present, I hate this job...
  34632. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34633. return getOffsetParent(offsetParent);
  34634. }
  34635. return offsetParent;
  34636. }
  34637. function isOffsetContainer(element) {
  34638. var nodeName = element.nodeName;
  34639. if (nodeName === 'BODY') {
  34640. return false;
  34641. }
  34642. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34643. }
  34644. /**
  34645. * Finds the root node (document, shadowDOM root) of the given element
  34646. * @method
  34647. * @memberof Popper.Utils
  34648. * @argument {Element} node
  34649. * @returns {Element} root node
  34650. */
  34651. function getRoot(node) {
  34652. if (node.parentNode !== null) {
  34653. return getRoot(node.parentNode);
  34654. }
  34655. return node;
  34656. }
  34657. /**
  34658. * Finds the offset parent common to the two provided nodes
  34659. * @method
  34660. * @memberof Popper.Utils
  34661. * @argument {Element} element1
  34662. * @argument {Element} element2
  34663. * @returns {Element} common offset parent
  34664. */
  34665. function findCommonOffsetParent(element1, element2) {
  34666. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34667. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34668. return document.documentElement;
  34669. }
  34670. // Here we make sure to give as "start" the element that comes first in the DOM
  34671. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34672. var start = order ? element1 : element2;
  34673. var end = order ? element2 : element1;
  34674. // Get common ancestor container
  34675. var range = document.createRange();
  34676. range.setStart(start, 0);
  34677. range.setEnd(end, 0);
  34678. var commonAncestorContainer = range.commonAncestorContainer;
  34679. // Both nodes are inside #document
  34680. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34681. if (isOffsetContainer(commonAncestorContainer)) {
  34682. return commonAncestorContainer;
  34683. }
  34684. return getOffsetParent(commonAncestorContainer);
  34685. }
  34686. // one of the nodes is inside shadowDOM, find which one
  34687. var element1root = getRoot(element1);
  34688. if (element1root.host) {
  34689. return findCommonOffsetParent(element1root.host, element2);
  34690. } else {
  34691. return findCommonOffsetParent(element1, getRoot(element2).host);
  34692. }
  34693. }
  34694. /**
  34695. * Gets the scroll value of the given element in the given side (top and left)
  34696. * @method
  34697. * @memberof Popper.Utils
  34698. * @argument {Element} element
  34699. * @argument {String} side `top` or `left`
  34700. * @returns {number} amount of scrolled pixels
  34701. */
  34702. function getScroll(element) {
  34703. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34704. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34705. var nodeName = element.nodeName;
  34706. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34707. var html = element.ownerDocument.documentElement;
  34708. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34709. return scrollingElement[upperSide];
  34710. }
  34711. return element[upperSide];
  34712. }
  34713. /*
  34714. * Sum or subtract the element scroll values (left and top) from a given rect object
  34715. * @method
  34716. * @memberof Popper.Utils
  34717. * @param {Object} rect - Rect object you want to change
  34718. * @param {HTMLElement} element - The element from the function reads the scroll values
  34719. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34720. * @return {Object} rect - The modifier rect object
  34721. */
  34722. function includeScroll(rect, element) {
  34723. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34724. var scrollTop = getScroll(element, 'top');
  34725. var scrollLeft = getScroll(element, 'left');
  34726. var modifier = subtract ? -1 : 1;
  34727. rect.top += scrollTop * modifier;
  34728. rect.bottom += scrollTop * modifier;
  34729. rect.left += scrollLeft * modifier;
  34730. rect.right += scrollLeft * modifier;
  34731. return rect;
  34732. }
  34733. /*
  34734. * Helper to detect borders of a given element
  34735. * @method
  34736. * @memberof Popper.Utils
  34737. * @param {CSSStyleDeclaration} styles
  34738. * Result of `getStyleComputedProperty` on the given element
  34739. * @param {String} axis - `x` or `y`
  34740. * @return {number} borders - The borders size of the given axis
  34741. */
  34742. function getBordersSize(styles, axis) {
  34743. var sideA = axis === 'x' ? 'Left' : 'Top';
  34744. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34745. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34746. }
  34747. function getSize(axis, body, html, computedStyle) {
  34748. 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);
  34749. }
  34750. function getWindowSizes(document) {
  34751. var body = document.body;
  34752. var html = document.documentElement;
  34753. var computedStyle = isIE(10) && getComputedStyle(html);
  34754. return {
  34755. height: getSize('Height', body, html, computedStyle),
  34756. width: getSize('Width', body, html, computedStyle)
  34757. };
  34758. }
  34759. var classCallCheck = function (instance, Constructor) {
  34760. if (!(instance instanceof Constructor)) {
  34761. throw new TypeError("Cannot call a class as a function");
  34762. }
  34763. };
  34764. var createClass = function () {
  34765. function defineProperties(target, props) {
  34766. for (var i = 0; i < props.length; i++) {
  34767. var descriptor = props[i];
  34768. descriptor.enumerable = descriptor.enumerable || false;
  34769. descriptor.configurable = true;
  34770. if ("value" in descriptor) descriptor.writable = true;
  34771. Object.defineProperty(target, descriptor.key, descriptor);
  34772. }
  34773. }
  34774. return function (Constructor, protoProps, staticProps) {
  34775. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34776. if (staticProps) defineProperties(Constructor, staticProps);
  34777. return Constructor;
  34778. };
  34779. }();
  34780. var defineProperty = function (obj, key, value) {
  34781. if (key in obj) {
  34782. Object.defineProperty(obj, key, {
  34783. value: value,
  34784. enumerable: true,
  34785. configurable: true,
  34786. writable: true
  34787. });
  34788. } else {
  34789. obj[key] = value;
  34790. }
  34791. return obj;
  34792. };
  34793. var _extends = Object.assign || function (target) {
  34794. for (var i = 1; i < arguments.length; i++) {
  34795. var source = arguments[i];
  34796. for (var key in source) {
  34797. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34798. target[key] = source[key];
  34799. }
  34800. }
  34801. }
  34802. return target;
  34803. };
  34804. /**
  34805. * Given element offsets, generate an output similar to getBoundingClientRect
  34806. * @method
  34807. * @memberof Popper.Utils
  34808. * @argument {Object} offsets
  34809. * @returns {Object} ClientRect like output
  34810. */
  34811. function getClientRect(offsets) {
  34812. return _extends({}, offsets, {
  34813. right: offsets.left + offsets.width,
  34814. bottom: offsets.top + offsets.height
  34815. });
  34816. }
  34817. /**
  34818. * Get bounding client rect of given element
  34819. * @method
  34820. * @memberof Popper.Utils
  34821. * @param {HTMLElement} element
  34822. * @return {Object} client rect
  34823. */
  34824. function getBoundingClientRect(element) {
  34825. var rect = {};
  34826. // IE10 10 FIX: Please, don't ask, the element isn't
  34827. // considered in DOM in some circumstances...
  34828. // This isn't reproducible in IE10 compatibility mode of IE11
  34829. try {
  34830. if (isIE(10)) {
  34831. rect = element.getBoundingClientRect();
  34832. var scrollTop = getScroll(element, 'top');
  34833. var scrollLeft = getScroll(element, 'left');
  34834. rect.top += scrollTop;
  34835. rect.left += scrollLeft;
  34836. rect.bottom += scrollTop;
  34837. rect.right += scrollLeft;
  34838. } else {
  34839. rect = element.getBoundingClientRect();
  34840. }
  34841. } catch (e) {}
  34842. var result = {
  34843. left: rect.left,
  34844. top: rect.top,
  34845. width: rect.right - rect.left,
  34846. height: rect.bottom - rect.top
  34847. };
  34848. // subtract scrollbar size from sizes
  34849. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34850. var width = sizes.width || element.clientWidth || result.width;
  34851. var height = sizes.height || element.clientHeight || result.height;
  34852. var horizScrollbar = element.offsetWidth - width;
  34853. var vertScrollbar = element.offsetHeight - height;
  34854. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34855. // we make this check conditional for performance reasons
  34856. if (horizScrollbar || vertScrollbar) {
  34857. var styles = getStyleComputedProperty(element);
  34858. horizScrollbar -= getBordersSize(styles, 'x');
  34859. vertScrollbar -= getBordersSize(styles, 'y');
  34860. result.width -= horizScrollbar;
  34861. result.height -= vertScrollbar;
  34862. }
  34863. return getClientRect(result);
  34864. }
  34865. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34866. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34867. var isIE10 = isIE(10);
  34868. var isHTML = parent.nodeName === 'HTML';
  34869. var childrenRect = getBoundingClientRect(children);
  34870. var parentRect = getBoundingClientRect(parent);
  34871. var scrollParent = getScrollParent(children);
  34872. var styles = getStyleComputedProperty(parent);
  34873. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34874. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34875. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34876. if (fixedPosition && isHTML) {
  34877. parentRect.top = Math.max(parentRect.top, 0);
  34878. parentRect.left = Math.max(parentRect.left, 0);
  34879. }
  34880. var offsets = getClientRect({
  34881. top: childrenRect.top - parentRect.top - borderTopWidth,
  34882. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34883. width: childrenRect.width,
  34884. height: childrenRect.height
  34885. });
  34886. offsets.marginTop = 0;
  34887. offsets.marginLeft = 0;
  34888. // Subtract margins of documentElement in case it's being used as parent
  34889. // we do this only on HTML because it's the only element that behaves
  34890. // differently when margins are applied to it. The margins are included in
  34891. // the box of the documentElement, in the other cases not.
  34892. if (!isIE10 && isHTML) {
  34893. var marginTop = parseFloat(styles.marginTop);
  34894. var marginLeft = parseFloat(styles.marginLeft);
  34895. offsets.top -= borderTopWidth - marginTop;
  34896. offsets.bottom -= borderTopWidth - marginTop;
  34897. offsets.left -= borderLeftWidth - marginLeft;
  34898. offsets.right -= borderLeftWidth - marginLeft;
  34899. // Attach marginTop and marginLeft because in some circumstances we may need them
  34900. offsets.marginTop = marginTop;
  34901. offsets.marginLeft = marginLeft;
  34902. }
  34903. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34904. offsets = includeScroll(offsets, parent);
  34905. }
  34906. return offsets;
  34907. }
  34908. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34909. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34910. var html = element.ownerDocument.documentElement;
  34911. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34912. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34913. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34914. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34915. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34916. var offset = {
  34917. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34918. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34919. width: width,
  34920. height: height
  34921. };
  34922. return getClientRect(offset);
  34923. }
  34924. /**
  34925. * Check if the given element is fixed or is inside a fixed parent
  34926. * @method
  34927. * @memberof Popper.Utils
  34928. * @argument {Element} element
  34929. * @argument {Element} customContainer
  34930. * @returns {Boolean} answer to "isFixed?"
  34931. */
  34932. function isFixed(element) {
  34933. var nodeName = element.nodeName;
  34934. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34935. return false;
  34936. }
  34937. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34938. return true;
  34939. }
  34940. var parentNode = getParentNode(element);
  34941. if (!parentNode) {
  34942. return false;
  34943. }
  34944. return isFixed(parentNode);
  34945. }
  34946. /**
  34947. * Finds the first parent of an element that has a transformed property defined
  34948. * @method
  34949. * @memberof Popper.Utils
  34950. * @argument {Element} element
  34951. * @returns {Element} first transformed parent or documentElement
  34952. */
  34953. function getFixedPositionOffsetParent(element) {
  34954. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34955. if (!element || !element.parentElement || isIE()) {
  34956. return document.documentElement;
  34957. }
  34958. var el = element.parentElement;
  34959. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34960. el = el.parentElement;
  34961. }
  34962. return el || document.documentElement;
  34963. }
  34964. /**
  34965. * Computed the boundaries limits and return them
  34966. * @method
  34967. * @memberof Popper.Utils
  34968. * @param {HTMLElement} popper
  34969. * @param {HTMLElement} reference
  34970. * @param {number} padding
  34971. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34972. * @param {Boolean} fixedPosition - Is in fixed position mode
  34973. * @returns {Object} Coordinates of the boundaries
  34974. */
  34975. function getBoundaries(popper, reference, padding, boundariesElement) {
  34976. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34977. // NOTE: 1 DOM access here
  34978. var boundaries = { top: 0, left: 0 };
  34979. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34980. // Handle viewport case
  34981. if (boundariesElement === 'viewport') {
  34982. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34983. } else {
  34984. // Handle other cases based on DOM element used as boundaries
  34985. var boundariesNode = void 0;
  34986. if (boundariesElement === 'scrollParent') {
  34987. boundariesNode = getScrollParent(getParentNode(reference));
  34988. if (boundariesNode.nodeName === 'BODY') {
  34989. boundariesNode = popper.ownerDocument.documentElement;
  34990. }
  34991. } else if (boundariesElement === 'window') {
  34992. boundariesNode = popper.ownerDocument.documentElement;
  34993. } else {
  34994. boundariesNode = boundariesElement;
  34995. }
  34996. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34997. // In case of HTML, we need a different computation
  34998. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34999. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35000. height = _getWindowSizes.height,
  35001. width = _getWindowSizes.width;
  35002. boundaries.top += offsets.top - offsets.marginTop;
  35003. boundaries.bottom = height + offsets.top;
  35004. boundaries.left += offsets.left - offsets.marginLeft;
  35005. boundaries.right = width + offsets.left;
  35006. } else {
  35007. // for all the other DOM elements, this one is good
  35008. boundaries = offsets;
  35009. }
  35010. }
  35011. // Add paddings
  35012. padding = padding || 0;
  35013. var isPaddingNumber = typeof padding === 'number';
  35014. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35015. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35016. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35017. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35018. return boundaries;
  35019. }
  35020. function getArea(_ref) {
  35021. var width = _ref.width,
  35022. height = _ref.height;
  35023. return width * height;
  35024. }
  35025. /**
  35026. * Utility used to transform the `auto` placement to the placement with more
  35027. * available space.
  35028. * @method
  35029. * @memberof Popper.Utils
  35030. * @argument {Object} data - The data object generated by update method
  35031. * @argument {Object} options - Modifiers configuration and options
  35032. * @returns {Object} The data object, properly modified
  35033. */
  35034. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35035. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35036. if (placement.indexOf('auto') === -1) {
  35037. return placement;
  35038. }
  35039. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35040. var rects = {
  35041. top: {
  35042. width: boundaries.width,
  35043. height: refRect.top - boundaries.top
  35044. },
  35045. right: {
  35046. width: boundaries.right - refRect.right,
  35047. height: boundaries.height
  35048. },
  35049. bottom: {
  35050. width: boundaries.width,
  35051. height: boundaries.bottom - refRect.bottom
  35052. },
  35053. left: {
  35054. width: refRect.left - boundaries.left,
  35055. height: boundaries.height
  35056. }
  35057. };
  35058. var sortedAreas = Object.keys(rects).map(function (key) {
  35059. return _extends({
  35060. key: key
  35061. }, rects[key], {
  35062. area: getArea(rects[key])
  35063. });
  35064. }).sort(function (a, b) {
  35065. return b.area - a.area;
  35066. });
  35067. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35068. var width = _ref2.width,
  35069. height = _ref2.height;
  35070. return width >= popper.clientWidth && height >= popper.clientHeight;
  35071. });
  35072. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35073. var variation = placement.split('-')[1];
  35074. return computedPlacement + (variation ? '-' + variation : '');
  35075. }
  35076. /**
  35077. * Get offsets to the reference element
  35078. * @method
  35079. * @memberof Popper.Utils
  35080. * @param {Object} state
  35081. * @param {Element} popper - the popper element
  35082. * @param {Element} reference - the reference element (the popper will be relative to this)
  35083. * @param {Element} fixedPosition - is in fixed position mode
  35084. * @returns {Object} An object containing the offsets which will be applied to the popper
  35085. */
  35086. function getReferenceOffsets(state, popper, reference) {
  35087. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35088. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35089. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35090. }
  35091. /**
  35092. * Get the outer sizes of the given element (offset size + margins)
  35093. * @method
  35094. * @memberof Popper.Utils
  35095. * @argument {Element} element
  35096. * @returns {Object} object containing width and height properties
  35097. */
  35098. function getOuterSizes(element) {
  35099. var window = element.ownerDocument.defaultView;
  35100. var styles = window.getComputedStyle(element);
  35101. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35102. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35103. var result = {
  35104. width: element.offsetWidth + y,
  35105. height: element.offsetHeight + x
  35106. };
  35107. return result;
  35108. }
  35109. /**
  35110. * Get the opposite placement of the given one
  35111. * @method
  35112. * @memberof Popper.Utils
  35113. * @argument {String} placement
  35114. * @returns {String} flipped placement
  35115. */
  35116. function getOppositePlacement(placement) {
  35117. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35118. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35119. return hash[matched];
  35120. });
  35121. }
  35122. /**
  35123. * Get offsets to the popper
  35124. * @method
  35125. * @memberof Popper.Utils
  35126. * @param {Object} position - CSS position the Popper will get applied
  35127. * @param {HTMLElement} popper - the popper element
  35128. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35129. * @param {String} placement - one of the valid placement options
  35130. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35131. */
  35132. function getPopperOffsets(popper, referenceOffsets, placement) {
  35133. placement = placement.split('-')[0];
  35134. // Get popper node sizes
  35135. var popperRect = getOuterSizes(popper);
  35136. // Add position, width and height to our offsets object
  35137. var popperOffsets = {
  35138. width: popperRect.width,
  35139. height: popperRect.height
  35140. };
  35141. // depending by the popper placement we have to compute its offsets slightly differently
  35142. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35143. var mainSide = isHoriz ? 'top' : 'left';
  35144. var secondarySide = isHoriz ? 'left' : 'top';
  35145. var measurement = isHoriz ? 'height' : 'width';
  35146. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35147. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35148. if (placement === secondarySide) {
  35149. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35150. } else {
  35151. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35152. }
  35153. return popperOffsets;
  35154. }
  35155. /**
  35156. * Mimics the `find` method of Array
  35157. * @method
  35158. * @memberof Popper.Utils
  35159. * @argument {Array} arr
  35160. * @argument prop
  35161. * @argument value
  35162. * @returns index or -1
  35163. */
  35164. function find(arr, check) {
  35165. // use native find if supported
  35166. if (Array.prototype.find) {
  35167. return arr.find(check);
  35168. }
  35169. // use `filter` to obtain the same behavior of `find`
  35170. return arr.filter(check)[0];
  35171. }
  35172. /**
  35173. * Return the index of the matching object
  35174. * @method
  35175. * @memberof Popper.Utils
  35176. * @argument {Array} arr
  35177. * @argument prop
  35178. * @argument value
  35179. * @returns index or -1
  35180. */
  35181. function findIndex(arr, prop, value) {
  35182. // use native findIndex if supported
  35183. if (Array.prototype.findIndex) {
  35184. return arr.findIndex(function (cur) {
  35185. return cur[prop] === value;
  35186. });
  35187. }
  35188. // use `find` + `indexOf` if `findIndex` isn't supported
  35189. var match = find(arr, function (obj) {
  35190. return obj[prop] === value;
  35191. });
  35192. return arr.indexOf(match);
  35193. }
  35194. /**
  35195. * Loop trough the list of modifiers and run them in order,
  35196. * each of them will then edit the data object.
  35197. * @method
  35198. * @memberof Popper.Utils
  35199. * @param {dataObject} data
  35200. * @param {Array} modifiers
  35201. * @param {String} ends - Optional modifier name used as stopper
  35202. * @returns {dataObject}
  35203. */
  35204. function runModifiers(modifiers, data, ends) {
  35205. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35206. modifiersToRun.forEach(function (modifier) {
  35207. if (modifier['function']) {
  35208. // eslint-disable-line dot-notation
  35209. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35210. }
  35211. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35212. if (modifier.enabled && isFunction(fn)) {
  35213. // Add properties to offsets to make them a complete clientRect object
  35214. // we do this before each modifier to make sure the previous one doesn't
  35215. // mess with these values
  35216. data.offsets.popper = getClientRect(data.offsets.popper);
  35217. data.offsets.reference = getClientRect(data.offsets.reference);
  35218. data = fn(data, modifier);
  35219. }
  35220. });
  35221. return data;
  35222. }
  35223. /**
  35224. * Updates the position of the popper, computing the new offsets and applying
  35225. * the new style.<br />
  35226. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35227. * @method
  35228. * @memberof Popper
  35229. */
  35230. function update() {
  35231. // if popper is destroyed, don't perform any further update
  35232. if (this.state.isDestroyed) {
  35233. return;
  35234. }
  35235. var data = {
  35236. instance: this,
  35237. styles: {},
  35238. arrowStyles: {},
  35239. attributes: {},
  35240. flipped: false,
  35241. offsets: {}
  35242. };
  35243. // compute reference element offsets
  35244. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35245. // compute auto placement, store placement inside the data object,
  35246. // modifiers will be able to edit `placement` if needed
  35247. // and refer to originalPlacement to know the original value
  35248. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35249. // store the computed placement inside `originalPlacement`
  35250. data.originalPlacement = data.placement;
  35251. data.positionFixed = this.options.positionFixed;
  35252. // compute the popper offsets
  35253. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35254. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35255. // run the modifiers
  35256. data = runModifiers(this.modifiers, data);
  35257. // the first `update` will call `onCreate` callback
  35258. // the other ones will call `onUpdate` callback
  35259. if (!this.state.isCreated) {
  35260. this.state.isCreated = true;
  35261. this.options.onCreate(data);
  35262. } else {
  35263. this.options.onUpdate(data);
  35264. }
  35265. }
  35266. /**
  35267. * Helper used to know if the given modifier is enabled.
  35268. * @method
  35269. * @memberof Popper.Utils
  35270. * @returns {Boolean}
  35271. */
  35272. function isModifierEnabled(modifiers, modifierName) {
  35273. return modifiers.some(function (_ref) {
  35274. var name = _ref.name,
  35275. enabled = _ref.enabled;
  35276. return enabled && name === modifierName;
  35277. });
  35278. }
  35279. /**
  35280. * Get the prefixed supported property name
  35281. * @method
  35282. * @memberof Popper.Utils
  35283. * @argument {String} property (camelCase)
  35284. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35285. */
  35286. function getSupportedPropertyName(property) {
  35287. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35288. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35289. for (var i = 0; i < prefixes.length; i++) {
  35290. var prefix = prefixes[i];
  35291. var toCheck = prefix ? '' + prefix + upperProp : property;
  35292. if (typeof document.body.style[toCheck] !== 'undefined') {
  35293. return toCheck;
  35294. }
  35295. }
  35296. return null;
  35297. }
  35298. /**
  35299. * Destroys the popper.
  35300. * @method
  35301. * @memberof Popper
  35302. */
  35303. function destroy() {
  35304. this.state.isDestroyed = true;
  35305. // touch DOM only if `applyStyle` modifier is enabled
  35306. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35307. this.popper.removeAttribute('x-placement');
  35308. this.popper.style.position = '';
  35309. this.popper.style.top = '';
  35310. this.popper.style.left = '';
  35311. this.popper.style.right = '';
  35312. this.popper.style.bottom = '';
  35313. this.popper.style.willChange = '';
  35314. this.popper.style[getSupportedPropertyName('transform')] = '';
  35315. }
  35316. this.disableEventListeners();
  35317. // remove the popper if user explicitly asked for the deletion on destroy
  35318. // do not use `remove` because IE11 doesn't support it
  35319. if (this.options.removeOnDestroy) {
  35320. this.popper.parentNode.removeChild(this.popper);
  35321. }
  35322. return this;
  35323. }
  35324. /**
  35325. * Get the window associated with the element
  35326. * @argument {Element} element
  35327. * @returns {Window}
  35328. */
  35329. function getWindow(element) {
  35330. var ownerDocument = element.ownerDocument;
  35331. return ownerDocument ? ownerDocument.defaultView : window;
  35332. }
  35333. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35334. var isBody = scrollParent.nodeName === 'BODY';
  35335. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35336. target.addEventListener(event, callback, { passive: true });
  35337. if (!isBody) {
  35338. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35339. }
  35340. scrollParents.push(target);
  35341. }
  35342. /**
  35343. * Setup needed event listeners used to update the popper position
  35344. * @method
  35345. * @memberof Popper.Utils
  35346. * @private
  35347. */
  35348. function setupEventListeners(reference, options, state, updateBound) {
  35349. // Resize event listener on window
  35350. state.updateBound = updateBound;
  35351. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35352. // Scroll event listener on scroll parents
  35353. var scrollElement = getScrollParent(reference);
  35354. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35355. state.scrollElement = scrollElement;
  35356. state.eventsEnabled = true;
  35357. return state;
  35358. }
  35359. /**
  35360. * It will add resize/scroll events and start recalculating
  35361. * position of the popper element when they are triggered.
  35362. * @method
  35363. * @memberof Popper
  35364. */
  35365. function enableEventListeners() {
  35366. if (!this.state.eventsEnabled) {
  35367. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35368. }
  35369. }
  35370. /**
  35371. * Remove event listeners used to update the popper position
  35372. * @method
  35373. * @memberof Popper.Utils
  35374. * @private
  35375. */
  35376. function removeEventListeners(reference, state) {
  35377. // Remove resize event listener on window
  35378. getWindow(reference).removeEventListener('resize', state.updateBound);
  35379. // Remove scroll event listener on scroll parents
  35380. state.scrollParents.forEach(function (target) {
  35381. target.removeEventListener('scroll', state.updateBound);
  35382. });
  35383. // Reset state
  35384. state.updateBound = null;
  35385. state.scrollParents = [];
  35386. state.scrollElement = null;
  35387. state.eventsEnabled = false;
  35388. return state;
  35389. }
  35390. /**
  35391. * It will remove resize/scroll events and won't recalculate popper position
  35392. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35393. * unless you call `update` method manually.
  35394. * @method
  35395. * @memberof Popper
  35396. */
  35397. function disableEventListeners() {
  35398. if (this.state.eventsEnabled) {
  35399. cancelAnimationFrame(this.scheduleUpdate);
  35400. this.state = removeEventListeners(this.reference, this.state);
  35401. }
  35402. }
  35403. /**
  35404. * Tells if a given input is a number
  35405. * @method
  35406. * @memberof Popper.Utils
  35407. * @param {*} input to check
  35408. * @return {Boolean}
  35409. */
  35410. function isNumeric(n) {
  35411. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35412. }
  35413. /**
  35414. * Set the style to the given popper
  35415. * @method
  35416. * @memberof Popper.Utils
  35417. * @argument {Element} element - Element to apply the style to
  35418. * @argument {Object} styles
  35419. * Object with a list of properties and values which will be applied to the element
  35420. */
  35421. function setStyles(element, styles) {
  35422. Object.keys(styles).forEach(function (prop) {
  35423. var unit = '';
  35424. // add unit if the value is numeric and is one of the following
  35425. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35426. unit = 'px';
  35427. }
  35428. element.style[prop] = styles[prop] + unit;
  35429. });
  35430. }
  35431. /**
  35432. * Set the attributes to the given popper
  35433. * @method
  35434. * @memberof Popper.Utils
  35435. * @argument {Element} element - Element to apply the attributes to
  35436. * @argument {Object} styles
  35437. * Object with a list of properties and values which will be applied to the element
  35438. */
  35439. function setAttributes(element, attributes) {
  35440. Object.keys(attributes).forEach(function (prop) {
  35441. var value = attributes[prop];
  35442. if (value !== false) {
  35443. element.setAttribute(prop, attributes[prop]);
  35444. } else {
  35445. element.removeAttribute(prop);
  35446. }
  35447. });
  35448. }
  35449. /**
  35450. * @function
  35451. * @memberof Modifiers
  35452. * @argument {Object} data - The data object generated by `update` method
  35453. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35454. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35455. * @argument {Object} options - Modifiers configuration and options
  35456. * @returns {Object} The same data object
  35457. */
  35458. function applyStyle(data) {
  35459. // any property present in `data.styles` will be applied to the popper,
  35460. // in this way we can make the 3rd party modifiers add custom styles to it
  35461. // Be aware, modifiers could override the properties defined in the previous
  35462. // lines of this modifier!
  35463. setStyles(data.instance.popper, data.styles);
  35464. // any property present in `data.attributes` will be applied to the popper,
  35465. // they will be set as HTML attributes of the element
  35466. setAttributes(data.instance.popper, data.attributes);
  35467. // if arrowElement is defined and arrowStyles has some properties
  35468. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35469. setStyles(data.arrowElement, data.arrowStyles);
  35470. }
  35471. return data;
  35472. }
  35473. /**
  35474. * Set the x-placement attribute before everything else because it could be used
  35475. * to add margins to the popper margins needs to be calculated to get the
  35476. * correct popper offsets.
  35477. * @method
  35478. * @memberof Popper.modifiers
  35479. * @param {HTMLElement} reference - The reference element used to position the popper
  35480. * @param {HTMLElement} popper - The HTML element used as popper
  35481. * @param {Object} options - Popper.js options
  35482. */
  35483. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35484. // compute reference element offsets
  35485. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35486. // compute auto placement, store placement inside the data object,
  35487. // modifiers will be able to edit `placement` if needed
  35488. // and refer to originalPlacement to know the original value
  35489. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35490. popper.setAttribute('x-placement', placement);
  35491. // Apply `position` to popper before anything else because
  35492. // without the position applied we can't guarantee correct computations
  35493. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35494. return options;
  35495. }
  35496. /**
  35497. * @function
  35498. * @memberof Popper.Utils
  35499. * @argument {Object} data - The data object generated by `update` method
  35500. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35501. * @returns {Object} The popper's position offsets rounded
  35502. *
  35503. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35504. * good as it can be within reason.
  35505. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35506. *
  35507. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35508. * as well on High DPI screens).
  35509. *
  35510. * Firefox prefers no rounding for positioning and does not have blurriness on
  35511. * high DPI screens.
  35512. *
  35513. * Only horizontal placement and left/right values need to be considered.
  35514. */
  35515. function getRoundedOffsets(data, shouldRound) {
  35516. var _data$offsets = data.offsets,
  35517. popper = _data$offsets.popper,
  35518. reference = _data$offsets.reference;
  35519. var round = Math.round,
  35520. floor = Math.floor;
  35521. var noRound = function noRound(v) {
  35522. return v;
  35523. };
  35524. var referenceWidth = round(reference.width);
  35525. var popperWidth = round(popper.width);
  35526. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35527. var isVariation = data.placement.indexOf('-') !== -1;
  35528. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35529. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35530. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35531. var verticalToInteger = !shouldRound ? noRound : round;
  35532. return {
  35533. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35534. top: verticalToInteger(popper.top),
  35535. bottom: verticalToInteger(popper.bottom),
  35536. right: horizontalToInteger(popper.right)
  35537. };
  35538. }
  35539. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35540. /**
  35541. * @function
  35542. * @memberof Modifiers
  35543. * @argument {Object} data - The data object generated by `update` method
  35544. * @argument {Object} options - Modifiers configuration and options
  35545. * @returns {Object} The data object, properly modified
  35546. */
  35547. function computeStyle(data, options) {
  35548. var x = options.x,
  35549. y = options.y;
  35550. var popper = data.offsets.popper;
  35551. // Remove this legacy support in Popper.js v2
  35552. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35553. return modifier.name === 'applyStyle';
  35554. }).gpuAcceleration;
  35555. if (legacyGpuAccelerationOption !== undefined) {
  35556. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35557. }
  35558. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35559. var offsetParent = getOffsetParent(data.instance.popper);
  35560. var offsetParentRect = getBoundingClientRect(offsetParent);
  35561. // Styles
  35562. var styles = {
  35563. position: popper.position
  35564. };
  35565. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35566. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35567. var sideB = y === 'right' ? 'left' : 'right';
  35568. // if gpuAcceleration is set to `true` and transform is supported,
  35569. // we use `translate3d` to apply the position to the popper we
  35570. // automatically use the supported prefixed version if needed
  35571. var prefixedProperty = getSupportedPropertyName('transform');
  35572. // now, let's make a step back and look at this code closely (wtf?)
  35573. // If the content of the popper grows once it's been positioned, it
  35574. // may happen that the popper gets misplaced because of the new content
  35575. // overflowing its reference element
  35576. // To avoid this problem, we provide two options (x and y), which allow
  35577. // the consumer to define the offset origin.
  35578. // If we position a popper on top of a reference element, we can set
  35579. // `x` to `top` to make the popper grow towards its top instead of
  35580. // its bottom.
  35581. var left = void 0,
  35582. top = void 0;
  35583. if (sideA === 'bottom') {
  35584. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35585. // and not the bottom of the html element
  35586. if (offsetParent.nodeName === 'HTML') {
  35587. top = -offsetParent.clientHeight + offsets.bottom;
  35588. } else {
  35589. top = -offsetParentRect.height + offsets.bottom;
  35590. }
  35591. } else {
  35592. top = offsets.top;
  35593. }
  35594. if (sideB === 'right') {
  35595. if (offsetParent.nodeName === 'HTML') {
  35596. left = -offsetParent.clientWidth + offsets.right;
  35597. } else {
  35598. left = -offsetParentRect.width + offsets.right;
  35599. }
  35600. } else {
  35601. left = offsets.left;
  35602. }
  35603. if (gpuAcceleration && prefixedProperty) {
  35604. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35605. styles[sideA] = 0;
  35606. styles[sideB] = 0;
  35607. styles.willChange = 'transform';
  35608. } else {
  35609. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35610. var invertTop = sideA === 'bottom' ? -1 : 1;
  35611. var invertLeft = sideB === 'right' ? -1 : 1;
  35612. styles[sideA] = top * invertTop;
  35613. styles[sideB] = left * invertLeft;
  35614. styles.willChange = sideA + ', ' + sideB;
  35615. }
  35616. // Attributes
  35617. var attributes = {
  35618. 'x-placement': data.placement
  35619. };
  35620. // Update `data` attributes, styles and arrowStyles
  35621. data.attributes = _extends({}, attributes, data.attributes);
  35622. data.styles = _extends({}, styles, data.styles);
  35623. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35624. return data;
  35625. }
  35626. /**
  35627. * Helper used to know if the given modifier depends from another one.<br />
  35628. * It checks if the needed modifier is listed and enabled.
  35629. * @method
  35630. * @memberof Popper.Utils
  35631. * @param {Array} modifiers - list of modifiers
  35632. * @param {String} requestingName - name of requesting modifier
  35633. * @param {String} requestedName - name of requested modifier
  35634. * @returns {Boolean}
  35635. */
  35636. function isModifierRequired(modifiers, requestingName, requestedName) {
  35637. var requesting = find(modifiers, function (_ref) {
  35638. var name = _ref.name;
  35639. return name === requestingName;
  35640. });
  35641. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35642. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35643. });
  35644. if (!isRequired) {
  35645. var _requesting = '`' + requestingName + '`';
  35646. var requested = '`' + requestedName + '`';
  35647. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35648. }
  35649. return isRequired;
  35650. }
  35651. /**
  35652. * @function
  35653. * @memberof Modifiers
  35654. * @argument {Object} data - The data object generated by update method
  35655. * @argument {Object} options - Modifiers configuration and options
  35656. * @returns {Object} The data object, properly modified
  35657. */
  35658. function arrow(data, options) {
  35659. var _data$offsets$arrow;
  35660. // arrow depends on keepTogether in order to work
  35661. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35662. return data;
  35663. }
  35664. var arrowElement = options.element;
  35665. // if arrowElement is a string, suppose it's a CSS selector
  35666. if (typeof arrowElement === 'string') {
  35667. arrowElement = data.instance.popper.querySelector(arrowElement);
  35668. // if arrowElement is not found, don't run the modifier
  35669. if (!arrowElement) {
  35670. return data;
  35671. }
  35672. } else {
  35673. // if the arrowElement isn't a query selector we must check that the
  35674. // provided DOM node is child of its popper node
  35675. if (!data.instance.popper.contains(arrowElement)) {
  35676. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35677. return data;
  35678. }
  35679. }
  35680. var placement = data.placement.split('-')[0];
  35681. var _data$offsets = data.offsets,
  35682. popper = _data$offsets.popper,
  35683. reference = _data$offsets.reference;
  35684. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35685. var len = isVertical ? 'height' : 'width';
  35686. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35687. var side = sideCapitalized.toLowerCase();
  35688. var altSide = isVertical ? 'left' : 'top';
  35689. var opSide = isVertical ? 'bottom' : 'right';
  35690. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35691. //
  35692. // extends keepTogether behavior making sure the popper and its
  35693. // reference have enough pixels in conjunction
  35694. //
  35695. // top/left side
  35696. if (reference[opSide] - arrowElementSize < popper[side]) {
  35697. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35698. }
  35699. // bottom/right side
  35700. if (reference[side] + arrowElementSize > popper[opSide]) {
  35701. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35702. }
  35703. data.offsets.popper = getClientRect(data.offsets.popper);
  35704. // compute center of the popper
  35705. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35706. // Compute the sideValue using the updated popper offsets
  35707. // take popper margin in account because we don't have this info available
  35708. var css = getStyleComputedProperty(data.instance.popper);
  35709. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35710. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35711. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35712. // prevent arrowElement from being placed not contiguously to its popper
  35713. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35714. data.arrowElement = arrowElement;
  35715. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35716. return data;
  35717. }
  35718. /**
  35719. * Get the opposite placement variation of the given one
  35720. * @method
  35721. * @memberof Popper.Utils
  35722. * @argument {String} placement variation
  35723. * @returns {String} flipped placement variation
  35724. */
  35725. function getOppositeVariation(variation) {
  35726. if (variation === 'end') {
  35727. return 'start';
  35728. } else if (variation === 'start') {
  35729. return 'end';
  35730. }
  35731. return variation;
  35732. }
  35733. /**
  35734. * List of accepted placements to use as values of the `placement` option.<br />
  35735. * Valid placements are:
  35736. * - `auto`
  35737. * - `top`
  35738. * - `right`
  35739. * - `bottom`
  35740. * - `left`
  35741. *
  35742. * Each placement can have a variation from this list:
  35743. * - `-start`
  35744. * - `-end`
  35745. *
  35746. * Variations are interpreted easily if you think of them as the left to right
  35747. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35748. * is right.<br />
  35749. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35750. *
  35751. * Some valid examples are:
  35752. * - `top-end` (on top of reference, right aligned)
  35753. * - `right-start` (on right of reference, top aligned)
  35754. * - `bottom` (on bottom, centered)
  35755. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35756. *
  35757. * @static
  35758. * @type {Array}
  35759. * @enum {String}
  35760. * @readonly
  35761. * @method placements
  35762. * @memberof Popper
  35763. */
  35764. 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'];
  35765. // Get rid of `auto` `auto-start` and `auto-end`
  35766. var validPlacements = placements.slice(3);
  35767. /**
  35768. * Given an initial placement, returns all the subsequent placements
  35769. * clockwise (or counter-clockwise).
  35770. *
  35771. * @method
  35772. * @memberof Popper.Utils
  35773. * @argument {String} placement - A valid placement (it accepts variations)
  35774. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35775. * @returns {Array} placements including their variations
  35776. */
  35777. function clockwise(placement) {
  35778. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35779. var index = validPlacements.indexOf(placement);
  35780. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35781. return counter ? arr.reverse() : arr;
  35782. }
  35783. var BEHAVIORS = {
  35784. FLIP: 'flip',
  35785. CLOCKWISE: 'clockwise',
  35786. COUNTERCLOCKWISE: 'counterclockwise'
  35787. };
  35788. /**
  35789. * @function
  35790. * @memberof Modifiers
  35791. * @argument {Object} data - The data object generated by update method
  35792. * @argument {Object} options - Modifiers configuration and options
  35793. * @returns {Object} The data object, properly modified
  35794. */
  35795. function flip(data, options) {
  35796. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35797. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35798. return data;
  35799. }
  35800. if (data.flipped && data.placement === data.originalPlacement) {
  35801. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35802. return data;
  35803. }
  35804. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35805. var placement = data.placement.split('-')[0];
  35806. var placementOpposite = getOppositePlacement(placement);
  35807. var variation = data.placement.split('-')[1] || '';
  35808. var flipOrder = [];
  35809. switch (options.behavior) {
  35810. case BEHAVIORS.FLIP:
  35811. flipOrder = [placement, placementOpposite];
  35812. break;
  35813. case BEHAVIORS.CLOCKWISE:
  35814. flipOrder = clockwise(placement);
  35815. break;
  35816. case BEHAVIORS.COUNTERCLOCKWISE:
  35817. flipOrder = clockwise(placement, true);
  35818. break;
  35819. default:
  35820. flipOrder = options.behavior;
  35821. }
  35822. flipOrder.forEach(function (step, index) {
  35823. if (placement !== step || flipOrder.length === index + 1) {
  35824. return data;
  35825. }
  35826. placement = data.placement.split('-')[0];
  35827. placementOpposite = getOppositePlacement(placement);
  35828. var popperOffsets = data.offsets.popper;
  35829. var refOffsets = data.offsets.reference;
  35830. // using floor because the reference offsets may contain decimals we are not going to consider here
  35831. var floor = Math.floor;
  35832. 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);
  35833. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35834. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35835. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35836. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35837. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35838. // flip the variation if required
  35839. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35840. // flips variation if reference element overflows boundaries
  35841. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35842. // flips variation if popper content overflows boundaries
  35843. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35844. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35845. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35846. // this boolean to detect any flip loop
  35847. data.flipped = true;
  35848. if (overlapsRef || overflowsBoundaries) {
  35849. placement = flipOrder[index + 1];
  35850. }
  35851. if (flippedVariation) {
  35852. variation = getOppositeVariation(variation);
  35853. }
  35854. data.placement = placement + (variation ? '-' + variation : '');
  35855. // this object contains `position`, we want to preserve it along with
  35856. // any additional property we may add in the future
  35857. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35858. data = runModifiers(data.instance.modifiers, data, 'flip');
  35859. }
  35860. });
  35861. return data;
  35862. }
  35863. /**
  35864. * @function
  35865. * @memberof Modifiers
  35866. * @argument {Object} data - The data object generated by update method
  35867. * @argument {Object} options - Modifiers configuration and options
  35868. * @returns {Object} The data object, properly modified
  35869. */
  35870. function keepTogether(data) {
  35871. var _data$offsets = data.offsets,
  35872. popper = _data$offsets.popper,
  35873. reference = _data$offsets.reference;
  35874. var placement = data.placement.split('-')[0];
  35875. var floor = Math.floor;
  35876. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35877. var side = isVertical ? 'right' : 'bottom';
  35878. var opSide = isVertical ? 'left' : 'top';
  35879. var measurement = isVertical ? 'width' : 'height';
  35880. if (popper[side] < floor(reference[opSide])) {
  35881. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35882. }
  35883. if (popper[opSide] > floor(reference[side])) {
  35884. data.offsets.popper[opSide] = floor(reference[side]);
  35885. }
  35886. return data;
  35887. }
  35888. /**
  35889. * Converts a string containing value + unit into a px value number
  35890. * @function
  35891. * @memberof {modifiers~offset}
  35892. * @private
  35893. * @argument {String} str - Value + unit string
  35894. * @argument {String} measurement - `height` or `width`
  35895. * @argument {Object} popperOffsets
  35896. * @argument {Object} referenceOffsets
  35897. * @returns {Number|String}
  35898. * Value in pixels, or original string if no values were extracted
  35899. */
  35900. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35901. // separate value from unit
  35902. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35903. var value = +split[1];
  35904. var unit = split[2];
  35905. // If it's not a number it's an operator, I guess
  35906. if (!value) {
  35907. return str;
  35908. }
  35909. if (unit.indexOf('%') === 0) {
  35910. var element = void 0;
  35911. switch (unit) {
  35912. case '%p':
  35913. element = popperOffsets;
  35914. break;
  35915. case '%':
  35916. case '%r':
  35917. default:
  35918. element = referenceOffsets;
  35919. }
  35920. var rect = getClientRect(element);
  35921. return rect[measurement] / 100 * value;
  35922. } else if (unit === 'vh' || unit === 'vw') {
  35923. // if is a vh or vw, we calculate the size based on the viewport
  35924. var size = void 0;
  35925. if (unit === 'vh') {
  35926. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35927. } else {
  35928. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35929. }
  35930. return size / 100 * value;
  35931. } else {
  35932. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35933. // if is an implicit unit, it's px, and we return just the value
  35934. return value;
  35935. }
  35936. }
  35937. /**
  35938. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35939. * @function
  35940. * @memberof {modifiers~offset}
  35941. * @private
  35942. * @argument {String} offset
  35943. * @argument {Object} popperOffsets
  35944. * @argument {Object} referenceOffsets
  35945. * @argument {String} basePlacement
  35946. * @returns {Array} a two cells array with x and y offsets in numbers
  35947. */
  35948. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35949. var offsets = [0, 0];
  35950. // Use height if placement is left or right and index is 0 otherwise use width
  35951. // in this way the first offset will use an axis and the second one
  35952. // will use the other one
  35953. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35954. // Split the offset string to obtain a list of values and operands
  35955. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35956. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35957. return frag.trim();
  35958. });
  35959. // Detect if the offset string contains a pair of values or a single one
  35960. // they could be separated by comma or space
  35961. var divider = fragments.indexOf(find(fragments, function (frag) {
  35962. return frag.search(/,|\s/) !== -1;
  35963. }));
  35964. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35965. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35966. }
  35967. // If divider is found, we divide the list of values and operands to divide
  35968. // them by ofset X and Y.
  35969. var splitRegex = /\s*,\s*|\s+/;
  35970. 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];
  35971. // Convert the values with units to absolute pixels to allow our computations
  35972. ops = ops.map(function (op, index) {
  35973. // Most of the units rely on the orientation of the popper
  35974. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35975. var mergeWithPrevious = false;
  35976. return op
  35977. // This aggregates any `+` or `-` sign that aren't considered operators
  35978. // e.g.: 10 + +5 => [10, +, +5]
  35979. .reduce(function (a, b) {
  35980. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35981. a[a.length - 1] = b;
  35982. mergeWithPrevious = true;
  35983. return a;
  35984. } else if (mergeWithPrevious) {
  35985. a[a.length - 1] += b;
  35986. mergeWithPrevious = false;
  35987. return a;
  35988. } else {
  35989. return a.concat(b);
  35990. }
  35991. }, [])
  35992. // Here we convert the string values into number values (in px)
  35993. .map(function (str) {
  35994. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35995. });
  35996. });
  35997. // Loop trough the offsets arrays and execute the operations
  35998. ops.forEach(function (op, index) {
  35999. op.forEach(function (frag, index2) {
  36000. if (isNumeric(frag)) {
  36001. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36002. }
  36003. });
  36004. });
  36005. return offsets;
  36006. }
  36007. /**
  36008. * @function
  36009. * @memberof Modifiers
  36010. * @argument {Object} data - The data object generated by update method
  36011. * @argument {Object} options - Modifiers configuration and options
  36012. * @argument {Number|String} options.offset=0
  36013. * The offset value as described in the modifier description
  36014. * @returns {Object} The data object, properly modified
  36015. */
  36016. function offset(data, _ref) {
  36017. var offset = _ref.offset;
  36018. var placement = data.placement,
  36019. _data$offsets = data.offsets,
  36020. popper = _data$offsets.popper,
  36021. reference = _data$offsets.reference;
  36022. var basePlacement = placement.split('-')[0];
  36023. var offsets = void 0;
  36024. if (isNumeric(+offset)) {
  36025. offsets = [+offset, 0];
  36026. } else {
  36027. offsets = parseOffset(offset, popper, reference, basePlacement);
  36028. }
  36029. if (basePlacement === 'left') {
  36030. popper.top += offsets[0];
  36031. popper.left -= offsets[1];
  36032. } else if (basePlacement === 'right') {
  36033. popper.top += offsets[0];
  36034. popper.left += offsets[1];
  36035. } else if (basePlacement === 'top') {
  36036. popper.left += offsets[0];
  36037. popper.top -= offsets[1];
  36038. } else if (basePlacement === 'bottom') {
  36039. popper.left += offsets[0];
  36040. popper.top += offsets[1];
  36041. }
  36042. data.popper = popper;
  36043. return data;
  36044. }
  36045. /**
  36046. * @function
  36047. * @memberof Modifiers
  36048. * @argument {Object} data - The data object generated by `update` method
  36049. * @argument {Object} options - Modifiers configuration and options
  36050. * @returns {Object} The data object, properly modified
  36051. */
  36052. function preventOverflow(data, options) {
  36053. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36054. // If offsetParent is the reference element, we really want to
  36055. // go one step up and use the next offsetParent as reference to
  36056. // avoid to make this modifier completely useless and look like broken
  36057. if (data.instance.reference === boundariesElement) {
  36058. boundariesElement = getOffsetParent(boundariesElement);
  36059. }
  36060. // NOTE: DOM access here
  36061. // resets the popper's position so that the document size can be calculated excluding
  36062. // the size of the popper element itself
  36063. var transformProp = getSupportedPropertyName('transform');
  36064. var popperStyles = data.instance.popper.style; // assignment to help minification
  36065. var top = popperStyles.top,
  36066. left = popperStyles.left,
  36067. transform = popperStyles[transformProp];
  36068. popperStyles.top = '';
  36069. popperStyles.left = '';
  36070. popperStyles[transformProp] = '';
  36071. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36072. // NOTE: DOM access here
  36073. // restores the original style properties after the offsets have been computed
  36074. popperStyles.top = top;
  36075. popperStyles.left = left;
  36076. popperStyles[transformProp] = transform;
  36077. options.boundaries = boundaries;
  36078. var order = options.priority;
  36079. var popper = data.offsets.popper;
  36080. var check = {
  36081. primary: function primary(placement) {
  36082. var value = popper[placement];
  36083. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36084. value = Math.max(popper[placement], boundaries[placement]);
  36085. }
  36086. return defineProperty({}, placement, value);
  36087. },
  36088. secondary: function secondary(placement) {
  36089. var mainSide = placement === 'right' ? 'left' : 'top';
  36090. var value = popper[mainSide];
  36091. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36092. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36093. }
  36094. return defineProperty({}, mainSide, value);
  36095. }
  36096. };
  36097. order.forEach(function (placement) {
  36098. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36099. popper = _extends({}, popper, check[side](placement));
  36100. });
  36101. data.offsets.popper = popper;
  36102. return data;
  36103. }
  36104. /**
  36105. * @function
  36106. * @memberof Modifiers
  36107. * @argument {Object} data - The data object generated by `update` method
  36108. * @argument {Object} options - Modifiers configuration and options
  36109. * @returns {Object} The data object, properly modified
  36110. */
  36111. function shift(data) {
  36112. var placement = data.placement;
  36113. var basePlacement = placement.split('-')[0];
  36114. var shiftvariation = placement.split('-')[1];
  36115. // if shift shiftvariation is specified, run the modifier
  36116. if (shiftvariation) {
  36117. var _data$offsets = data.offsets,
  36118. reference = _data$offsets.reference,
  36119. popper = _data$offsets.popper;
  36120. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36121. var side = isVertical ? 'left' : 'top';
  36122. var measurement = isVertical ? 'width' : 'height';
  36123. var shiftOffsets = {
  36124. start: defineProperty({}, side, reference[side]),
  36125. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36126. };
  36127. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36128. }
  36129. return data;
  36130. }
  36131. /**
  36132. * @function
  36133. * @memberof Modifiers
  36134. * @argument {Object} data - The data object generated by update method
  36135. * @argument {Object} options - Modifiers configuration and options
  36136. * @returns {Object} The data object, properly modified
  36137. */
  36138. function hide(data) {
  36139. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36140. return data;
  36141. }
  36142. var refRect = data.offsets.reference;
  36143. var bound = find(data.instance.modifiers, function (modifier) {
  36144. return modifier.name === 'preventOverflow';
  36145. }).boundaries;
  36146. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36147. // Avoid unnecessary DOM access if visibility hasn't changed
  36148. if (data.hide === true) {
  36149. return data;
  36150. }
  36151. data.hide = true;
  36152. data.attributes['x-out-of-boundaries'] = '';
  36153. } else {
  36154. // Avoid unnecessary DOM access if visibility hasn't changed
  36155. if (data.hide === false) {
  36156. return data;
  36157. }
  36158. data.hide = false;
  36159. data.attributes['x-out-of-boundaries'] = false;
  36160. }
  36161. return data;
  36162. }
  36163. /**
  36164. * @function
  36165. * @memberof Modifiers
  36166. * @argument {Object} data - The data object generated by `update` method
  36167. * @argument {Object} options - Modifiers configuration and options
  36168. * @returns {Object} The data object, properly modified
  36169. */
  36170. function inner(data) {
  36171. var placement = data.placement;
  36172. var basePlacement = placement.split('-')[0];
  36173. var _data$offsets = data.offsets,
  36174. popper = _data$offsets.popper,
  36175. reference = _data$offsets.reference;
  36176. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36177. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36178. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36179. data.placement = getOppositePlacement(placement);
  36180. data.offsets.popper = getClientRect(popper);
  36181. return data;
  36182. }
  36183. /**
  36184. * Modifier function, each modifier can have a function of this type assigned
  36185. * to its `fn` property.<br />
  36186. * These functions will be called on each update, this means that you must
  36187. * make sure they are performant enough to avoid performance bottlenecks.
  36188. *
  36189. * @function ModifierFn
  36190. * @argument {dataObject} data - The data object generated by `update` method
  36191. * @argument {Object} options - Modifiers configuration and options
  36192. * @returns {dataObject} The data object, properly modified
  36193. */
  36194. /**
  36195. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36196. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36197. * needed by the library.
  36198. *
  36199. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36200. * All the other properties are configurations that could be tweaked.
  36201. * @namespace modifiers
  36202. */
  36203. var modifiers = {
  36204. /**
  36205. * Modifier used to shift the popper on the start or end of its reference
  36206. * element.<br />
  36207. * It will read the variation of the `placement` property.<br />
  36208. * It can be one either `-end` or `-start`.
  36209. * @memberof modifiers
  36210. * @inner
  36211. */
  36212. shift: {
  36213. /** @prop {number} order=100 - Index used to define the order of execution */
  36214. order: 100,
  36215. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36216. enabled: true,
  36217. /** @prop {ModifierFn} */
  36218. fn: shift
  36219. },
  36220. /**
  36221. * The `offset` modifier can shift your popper on both its axis.
  36222. *
  36223. * It accepts the following units:
  36224. * - `px` or unit-less, interpreted as pixels
  36225. * - `%` or `%r`, percentage relative to the length of the reference element
  36226. * - `%p`, percentage relative to the length of the popper element
  36227. * - `vw`, CSS viewport width unit
  36228. * - `vh`, CSS viewport height unit
  36229. *
  36230. * For length is intended the main axis relative to the placement of the popper.<br />
  36231. * This means that if the placement is `top` or `bottom`, the length will be the
  36232. * `width`. In case of `left` or `right`, it will be the `height`.
  36233. *
  36234. * You can provide a single value (as `Number` or `String`), or a pair of values
  36235. * as `String` divided by a comma or one (or more) white spaces.<br />
  36236. * The latter is a deprecated method because it leads to confusion and will be
  36237. * removed in v2.<br />
  36238. * Additionally, it accepts additions and subtractions between different units.
  36239. * Note that multiplications and divisions aren't supported.
  36240. *
  36241. * Valid examples are:
  36242. * ```
  36243. * 10
  36244. * '10%'
  36245. * '10, 10'
  36246. * '10%, 10'
  36247. * '10 + 10%'
  36248. * '10 - 5vh + 3%'
  36249. * '-10px + 5vh, 5px - 6%'
  36250. * ```
  36251. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36252. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36253. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36254. *
  36255. * @memberof modifiers
  36256. * @inner
  36257. */
  36258. offset: {
  36259. /** @prop {number} order=200 - Index used to define the order of execution */
  36260. order: 200,
  36261. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36262. enabled: true,
  36263. /** @prop {ModifierFn} */
  36264. fn: offset,
  36265. /** @prop {Number|String} offset=0
  36266. * The offset value as described in the modifier description
  36267. */
  36268. offset: 0
  36269. },
  36270. /**
  36271. * Modifier used to prevent the popper from being positioned outside the boundary.
  36272. *
  36273. * A scenario exists where the reference itself is not within the boundaries.<br />
  36274. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36275. * In this case we need to decide whether the popper should either:
  36276. *
  36277. * - detach from the reference and remain "trapped" in the boundaries, or
  36278. * - if it should ignore the boundary and "escape with its reference"
  36279. *
  36280. * When `escapeWithReference` is set to`true` and reference is completely
  36281. * outside its boundaries, the popper will overflow (or completely leave)
  36282. * the boundaries in order to remain attached to the edge of the reference.
  36283. *
  36284. * @memberof modifiers
  36285. * @inner
  36286. */
  36287. preventOverflow: {
  36288. /** @prop {number} order=300 - Index used to define the order of execution */
  36289. order: 300,
  36290. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36291. enabled: true,
  36292. /** @prop {ModifierFn} */
  36293. fn: preventOverflow,
  36294. /**
  36295. * @prop {Array} [priority=['left','right','top','bottom']]
  36296. * Popper will try to prevent overflow following these priorities by default,
  36297. * then, it could overflow on the left and on top of the `boundariesElement`
  36298. */
  36299. priority: ['left', 'right', 'top', 'bottom'],
  36300. /**
  36301. * @prop {number} padding=5
  36302. * Amount of pixel used to define a minimum distance between the boundaries
  36303. * and the popper. This makes sure the popper always has a little padding
  36304. * between the edges of its container
  36305. */
  36306. padding: 5,
  36307. /**
  36308. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36309. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36310. * `viewport` or any DOM element.
  36311. */
  36312. boundariesElement: 'scrollParent'
  36313. },
  36314. /**
  36315. * Modifier used to make sure the reference and its popper stay near each other
  36316. * without leaving any gap between the two. Especially useful when the arrow is
  36317. * enabled and you want to ensure that it points to its reference element.
  36318. * It cares only about the first axis. You can still have poppers with margin
  36319. * between the popper and its reference element.
  36320. * @memberof modifiers
  36321. * @inner
  36322. */
  36323. keepTogether: {
  36324. /** @prop {number} order=400 - Index used to define the order of execution */
  36325. order: 400,
  36326. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36327. enabled: true,
  36328. /** @prop {ModifierFn} */
  36329. fn: keepTogether
  36330. },
  36331. /**
  36332. * This modifier is used to move the `arrowElement` of the popper to make
  36333. * sure it is positioned between the reference element and its popper element.
  36334. * It will read the outer size of the `arrowElement` node to detect how many
  36335. * pixels of conjunction are needed.
  36336. *
  36337. * It has no effect if no `arrowElement` is provided.
  36338. * @memberof modifiers
  36339. * @inner
  36340. */
  36341. arrow: {
  36342. /** @prop {number} order=500 - Index used to define the order of execution */
  36343. order: 500,
  36344. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36345. enabled: true,
  36346. /** @prop {ModifierFn} */
  36347. fn: arrow,
  36348. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36349. element: '[x-arrow]'
  36350. },
  36351. /**
  36352. * Modifier used to flip the popper's placement when it starts to overlap its
  36353. * reference element.
  36354. *
  36355. * Requires the `preventOverflow` modifier before it in order to work.
  36356. *
  36357. * **NOTE:** this modifier will interrupt the current update cycle and will
  36358. * restart it if it detects the need to flip the placement.
  36359. * @memberof modifiers
  36360. * @inner
  36361. */
  36362. flip: {
  36363. /** @prop {number} order=600 - Index used to define the order of execution */
  36364. order: 600,
  36365. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36366. enabled: true,
  36367. /** @prop {ModifierFn} */
  36368. fn: flip,
  36369. /**
  36370. * @prop {String|Array} behavior='flip'
  36371. * The behavior used to change the popper's placement. It can be one of
  36372. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36373. * placements (with optional variations)
  36374. */
  36375. behavior: 'flip',
  36376. /**
  36377. * @prop {number} padding=5
  36378. * The popper will flip if it hits the edges of the `boundariesElement`
  36379. */
  36380. padding: 5,
  36381. /**
  36382. * @prop {String|HTMLElement} boundariesElement='viewport'
  36383. * The element which will define the boundaries of the popper position.
  36384. * The popper will never be placed outside of the defined boundaries
  36385. * (except if `keepTogether` is enabled)
  36386. */
  36387. boundariesElement: 'viewport',
  36388. /**
  36389. * @prop {Boolean} flipVariations=false
  36390. * The popper will switch placement variation between `-start` and `-end` when
  36391. * the reference element overlaps its boundaries.
  36392. *
  36393. * The original placement should have a set variation.
  36394. */
  36395. flipVariations: false,
  36396. /**
  36397. * @prop {Boolean} flipVariationsByContent=false
  36398. * The popper will switch placement variation between `-start` and `-end` when
  36399. * the popper element overlaps its reference boundaries.
  36400. *
  36401. * The original placement should have a set variation.
  36402. */
  36403. flipVariationsByContent: false
  36404. },
  36405. /**
  36406. * Modifier used to make the popper flow toward the inner of the reference element.
  36407. * By default, when this modifier is disabled, the popper will be placed outside
  36408. * the reference element.
  36409. * @memberof modifiers
  36410. * @inner
  36411. */
  36412. inner: {
  36413. /** @prop {number} order=700 - Index used to define the order of execution */
  36414. order: 700,
  36415. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36416. enabled: false,
  36417. /** @prop {ModifierFn} */
  36418. fn: inner
  36419. },
  36420. /**
  36421. * Modifier used to hide the popper when its reference element is outside of the
  36422. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36423. * be used to hide with a CSS selector the popper when its reference is
  36424. * out of boundaries.
  36425. *
  36426. * Requires the `preventOverflow` modifier before it in order to work.
  36427. * @memberof modifiers
  36428. * @inner
  36429. */
  36430. hide: {
  36431. /** @prop {number} order=800 - Index used to define the order of execution */
  36432. order: 800,
  36433. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36434. enabled: true,
  36435. /** @prop {ModifierFn} */
  36436. fn: hide
  36437. },
  36438. /**
  36439. * Computes the style that will be applied to the popper element to gets
  36440. * properly positioned.
  36441. *
  36442. * Note that this modifier will not touch the DOM, it just prepares the styles
  36443. * so that `applyStyle` modifier can apply it. This separation is useful
  36444. * in case you need to replace `applyStyle` with a custom implementation.
  36445. *
  36446. * This modifier has `850` as `order` value to maintain backward compatibility
  36447. * with previous versions of Popper.js. Expect the modifiers ordering method
  36448. * to change in future major versions of the library.
  36449. *
  36450. * @memberof modifiers
  36451. * @inner
  36452. */
  36453. computeStyle: {
  36454. /** @prop {number} order=850 - Index used to define the order of execution */
  36455. order: 850,
  36456. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36457. enabled: true,
  36458. /** @prop {ModifierFn} */
  36459. fn: computeStyle,
  36460. /**
  36461. * @prop {Boolean} gpuAcceleration=true
  36462. * If true, it uses the CSS 3D transformation to position the popper.
  36463. * Otherwise, it will use the `top` and `left` properties
  36464. */
  36465. gpuAcceleration: true,
  36466. /**
  36467. * @prop {string} [x='bottom']
  36468. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36469. * Change this if your popper should grow in a direction different from `bottom`
  36470. */
  36471. x: 'bottom',
  36472. /**
  36473. * @prop {string} [x='left']
  36474. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36475. * Change this if your popper should grow in a direction different from `right`
  36476. */
  36477. y: 'right'
  36478. },
  36479. /**
  36480. * Applies the computed styles to the popper element.
  36481. *
  36482. * All the DOM manipulations are limited to this modifier. This is useful in case
  36483. * you want to integrate Popper.js inside a framework or view library and you
  36484. * want to delegate all the DOM manipulations to it.
  36485. *
  36486. * Note that if you disable this modifier, you must make sure the popper element
  36487. * has its position set to `absolute` before Popper.js can do its work!
  36488. *
  36489. * Just disable this modifier and define your own to achieve the desired effect.
  36490. *
  36491. * @memberof modifiers
  36492. * @inner
  36493. */
  36494. applyStyle: {
  36495. /** @prop {number} order=900 - Index used to define the order of execution */
  36496. order: 900,
  36497. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36498. enabled: true,
  36499. /** @prop {ModifierFn} */
  36500. fn: applyStyle,
  36501. /** @prop {Function} */
  36502. onLoad: applyStyleOnLoad,
  36503. /**
  36504. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36505. * @prop {Boolean} gpuAcceleration=true
  36506. * If true, it uses the CSS 3D transformation to position the popper.
  36507. * Otherwise, it will use the `top` and `left` properties
  36508. */
  36509. gpuAcceleration: undefined
  36510. }
  36511. };
  36512. /**
  36513. * The `dataObject` is an object containing all the information used by Popper.js.
  36514. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36515. * @name dataObject
  36516. * @property {Object} data.instance The Popper.js instance
  36517. * @property {String} data.placement Placement applied to popper
  36518. * @property {String} data.originalPlacement Placement originally defined on init
  36519. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36520. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36521. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36522. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36523. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36524. * @property {Object} data.boundaries Offsets of the popper boundaries
  36525. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36526. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36527. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36528. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36529. */
  36530. /**
  36531. * Default options provided to Popper.js constructor.<br />
  36532. * These can be overridden using the `options` argument of Popper.js.<br />
  36533. * To override an option, simply pass an object with the same
  36534. * structure of the `options` object, as the 3rd argument. For example:
  36535. * ```
  36536. * new Popper(ref, pop, {
  36537. * modifiers: {
  36538. * preventOverflow: { enabled: false }
  36539. * }
  36540. * })
  36541. * ```
  36542. * @type {Object}
  36543. * @static
  36544. * @memberof Popper
  36545. */
  36546. var Defaults = {
  36547. /**
  36548. * Popper's placement.
  36549. * @prop {Popper.placements} placement='bottom'
  36550. */
  36551. placement: 'bottom',
  36552. /**
  36553. * Set this to true if you want popper to position it self in 'fixed' mode
  36554. * @prop {Boolean} positionFixed=false
  36555. */
  36556. positionFixed: false,
  36557. /**
  36558. * Whether events (resize, scroll) are initially enabled.
  36559. * @prop {Boolean} eventsEnabled=true
  36560. */
  36561. eventsEnabled: true,
  36562. /**
  36563. * Set to true if you want to automatically remove the popper when
  36564. * you call the `destroy` method.
  36565. * @prop {Boolean} removeOnDestroy=false
  36566. */
  36567. removeOnDestroy: false,
  36568. /**
  36569. * Callback called when the popper is created.<br />
  36570. * By default, it is set to no-op.<br />
  36571. * Access Popper.js instance with `data.instance`.
  36572. * @prop {onCreate}
  36573. */
  36574. onCreate: function onCreate() {},
  36575. /**
  36576. * Callback called when the popper is updated. This callback is not called
  36577. * on the initialization/creation of the popper, but only on subsequent
  36578. * updates.<br />
  36579. * By default, it is set to no-op.<br />
  36580. * Access Popper.js instance with `data.instance`.
  36581. * @prop {onUpdate}
  36582. */
  36583. onUpdate: function onUpdate() {},
  36584. /**
  36585. * List of modifiers used to modify the offsets before they are applied to the popper.
  36586. * They provide most of the functionalities of Popper.js.
  36587. * @prop {modifiers}
  36588. */
  36589. modifiers: modifiers
  36590. };
  36591. /**
  36592. * @callback onCreate
  36593. * @param {dataObject} data
  36594. */
  36595. /**
  36596. * @callback onUpdate
  36597. * @param {dataObject} data
  36598. */
  36599. // Utils
  36600. // Methods
  36601. var Popper = function () {
  36602. /**
  36603. * Creates a new Popper.js instance.
  36604. * @class Popper
  36605. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36606. * @param {Element} popper - The HTML / XML element used as the popper
  36607. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36608. * @return {Object} instance - The generated Popper.js instance
  36609. */
  36610. function Popper(reference, popper) {
  36611. var _this = this;
  36612. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36613. classCallCheck(this, Popper);
  36614. this.scheduleUpdate = function () {
  36615. return requestAnimationFrame(_this.update);
  36616. };
  36617. // make update() debounced, so that it only runs at most once-per-tick
  36618. this.update = debounce(this.update.bind(this));
  36619. // with {} we create a new object with the options inside it
  36620. this.options = _extends({}, Popper.Defaults, options);
  36621. // init state
  36622. this.state = {
  36623. isDestroyed: false,
  36624. isCreated: false,
  36625. scrollParents: []
  36626. };
  36627. // get reference and popper elements (allow jQuery wrappers)
  36628. this.reference = reference && reference.jquery ? reference[0] : reference;
  36629. this.popper = popper && popper.jquery ? popper[0] : popper;
  36630. // Deep merge modifiers options
  36631. this.options.modifiers = {};
  36632. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36633. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36634. });
  36635. // Refactoring modifiers' list (Object => Array)
  36636. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36637. return _extends({
  36638. name: name
  36639. }, _this.options.modifiers[name]);
  36640. })
  36641. // sort the modifiers by order
  36642. .sort(function (a, b) {
  36643. return a.order - b.order;
  36644. });
  36645. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36646. // such code is executed in the same order of its modifier
  36647. // they could add new properties to their options configuration
  36648. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36649. this.modifiers.forEach(function (modifierOptions) {
  36650. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36651. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36652. }
  36653. });
  36654. // fire the first update to position the popper in the right place
  36655. this.update();
  36656. var eventsEnabled = this.options.eventsEnabled;
  36657. if (eventsEnabled) {
  36658. // setup event listeners, they will take care of update the position in specific situations
  36659. this.enableEventListeners();
  36660. }
  36661. this.state.eventsEnabled = eventsEnabled;
  36662. }
  36663. // We can't use class properties because they don't get listed in the
  36664. // class prototype and break stuff like Sinon stubs
  36665. createClass(Popper, [{
  36666. key: 'update',
  36667. value: function update$$1() {
  36668. return update.call(this);
  36669. }
  36670. }, {
  36671. key: 'destroy',
  36672. value: function destroy$$1() {
  36673. return destroy.call(this);
  36674. }
  36675. }, {
  36676. key: 'enableEventListeners',
  36677. value: function enableEventListeners$$1() {
  36678. return enableEventListeners.call(this);
  36679. }
  36680. }, {
  36681. key: 'disableEventListeners',
  36682. value: function disableEventListeners$$1() {
  36683. return disableEventListeners.call(this);
  36684. }
  36685. /**
  36686. * Schedules an update. It will run on the next UI update available.
  36687. * @method scheduleUpdate
  36688. * @memberof Popper
  36689. */
  36690. /**
  36691. * Collection of utilities useful when writing custom modifiers.
  36692. * Starting from version 1.7, this method is available only if you
  36693. * include `popper-utils.js` before `popper.js`.
  36694. *
  36695. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36696. * and will be removed in v2! Use the PopperUtils module directly instead.
  36697. * Due to the high instability of the methods contained in Utils, we can't
  36698. * guarantee them to follow semver. Use them at your own risk!
  36699. * @static
  36700. * @private
  36701. * @type {Object}
  36702. * @deprecated since version 1.8
  36703. * @member Utils
  36704. * @memberof Popper
  36705. */
  36706. }]);
  36707. return Popper;
  36708. }();
  36709. /**
  36710. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36711. * and lets you use it as replacement of a real DOM node.<br />
  36712. * You can use this method to position a popper relatively to a set of coordinates
  36713. * in case you don't have a DOM node to use as reference.
  36714. *
  36715. * ```
  36716. * new Popper(referenceObject, popperNode);
  36717. * ```
  36718. *
  36719. * NB: This feature isn't supported in Internet Explorer 10.
  36720. * @name referenceObject
  36721. * @property {Function} data.getBoundingClientRect
  36722. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36723. * @property {number} data.clientWidth
  36724. * An ES6 getter that will return the width of the virtual reference element.
  36725. * @property {number} data.clientHeight
  36726. * An ES6 getter that will return the height of the virtual reference element.
  36727. */
  36728. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36729. Popper.placements = placements;
  36730. Popper.Defaults = Defaults;
  36731. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36732. //# sourceMappingURL=popper.js.map
  36733. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36734. /***/ }),
  36735. /***/ "./node_modules/process/browser.js":
  36736. /*!*****************************************!*\
  36737. !*** ./node_modules/process/browser.js ***!
  36738. \*****************************************/
  36739. /*! no static exports found */
  36740. /***/ (function(module, exports) {
  36741. // shim for using process in browser
  36742. var process = module.exports = {};
  36743. // cached from whatever global is present so that test runners that stub it
  36744. // don't break things. But we need to wrap it in a try catch in case it is
  36745. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36746. // function because try/catches deoptimize in certain engines.
  36747. var cachedSetTimeout;
  36748. var cachedClearTimeout;
  36749. function defaultSetTimout() {
  36750. throw new Error('setTimeout has not been defined');
  36751. }
  36752. function defaultClearTimeout () {
  36753. throw new Error('clearTimeout has not been defined');
  36754. }
  36755. (function () {
  36756. try {
  36757. if (typeof setTimeout === 'function') {
  36758. cachedSetTimeout = setTimeout;
  36759. } else {
  36760. cachedSetTimeout = defaultSetTimout;
  36761. }
  36762. } catch (e) {
  36763. cachedSetTimeout = defaultSetTimout;
  36764. }
  36765. try {
  36766. if (typeof clearTimeout === 'function') {
  36767. cachedClearTimeout = clearTimeout;
  36768. } else {
  36769. cachedClearTimeout = defaultClearTimeout;
  36770. }
  36771. } catch (e) {
  36772. cachedClearTimeout = defaultClearTimeout;
  36773. }
  36774. } ())
  36775. function runTimeout(fun) {
  36776. if (cachedSetTimeout === setTimeout) {
  36777. //normal enviroments in sane situations
  36778. return setTimeout(fun, 0);
  36779. }
  36780. // if setTimeout wasn't available but was latter defined
  36781. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36782. cachedSetTimeout = setTimeout;
  36783. return setTimeout(fun, 0);
  36784. }
  36785. try {
  36786. // when when somebody has screwed with setTimeout but no I.E. maddness
  36787. return cachedSetTimeout(fun, 0);
  36788. } catch(e){
  36789. try {
  36790. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36791. return cachedSetTimeout.call(null, fun, 0);
  36792. } catch(e){
  36793. // 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
  36794. return cachedSetTimeout.call(this, fun, 0);
  36795. }
  36796. }
  36797. }
  36798. function runClearTimeout(marker) {
  36799. if (cachedClearTimeout === clearTimeout) {
  36800. //normal enviroments in sane situations
  36801. return clearTimeout(marker);
  36802. }
  36803. // if clearTimeout wasn't available but was latter defined
  36804. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36805. cachedClearTimeout = clearTimeout;
  36806. return clearTimeout(marker);
  36807. }
  36808. try {
  36809. // when when somebody has screwed with setTimeout but no I.E. maddness
  36810. return cachedClearTimeout(marker);
  36811. } catch (e){
  36812. try {
  36813. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36814. return cachedClearTimeout.call(null, marker);
  36815. } catch (e){
  36816. // 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.
  36817. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36818. return cachedClearTimeout.call(this, marker);
  36819. }
  36820. }
  36821. }
  36822. var queue = [];
  36823. var draining = false;
  36824. var currentQueue;
  36825. var queueIndex = -1;
  36826. function cleanUpNextTick() {
  36827. if (!draining || !currentQueue) {
  36828. return;
  36829. }
  36830. draining = false;
  36831. if (currentQueue.length) {
  36832. queue = currentQueue.concat(queue);
  36833. } else {
  36834. queueIndex = -1;
  36835. }
  36836. if (queue.length) {
  36837. drainQueue();
  36838. }
  36839. }
  36840. function drainQueue() {
  36841. if (draining) {
  36842. return;
  36843. }
  36844. var timeout = runTimeout(cleanUpNextTick);
  36845. draining = true;
  36846. var len = queue.length;
  36847. while(len) {
  36848. currentQueue = queue;
  36849. queue = [];
  36850. while (++queueIndex < len) {
  36851. if (currentQueue) {
  36852. currentQueue[queueIndex].run();
  36853. }
  36854. }
  36855. queueIndex = -1;
  36856. len = queue.length;
  36857. }
  36858. currentQueue = null;
  36859. draining = false;
  36860. runClearTimeout(timeout);
  36861. }
  36862. process.nextTick = function (fun) {
  36863. var args = new Array(arguments.length - 1);
  36864. if (arguments.length > 1) {
  36865. for (var i = 1; i < arguments.length; i++) {
  36866. args[i - 1] = arguments[i];
  36867. }
  36868. }
  36869. queue.push(new Item(fun, args));
  36870. if (queue.length === 1 && !draining) {
  36871. runTimeout(drainQueue);
  36872. }
  36873. };
  36874. // v8 likes predictible objects
  36875. function Item(fun, array) {
  36876. this.fun = fun;
  36877. this.array = array;
  36878. }
  36879. Item.prototype.run = function () {
  36880. this.fun.apply(null, this.array);
  36881. };
  36882. process.title = 'browser';
  36883. process.browser = true;
  36884. process.env = {};
  36885. process.argv = [];
  36886. process.version = ''; // empty string to avoid regexp issues
  36887. process.versions = {};
  36888. function noop() {}
  36889. process.on = noop;
  36890. process.addListener = noop;
  36891. process.once = noop;
  36892. process.off = noop;
  36893. process.removeListener = noop;
  36894. process.removeAllListeners = noop;
  36895. process.emit = noop;
  36896. process.prependListener = noop;
  36897. process.prependOnceListener = noop;
  36898. process.listeners = function (name) { return [] }
  36899. process.binding = function (name) {
  36900. throw new Error('process.binding is not supported');
  36901. };
  36902. process.cwd = function () { return '/' };
  36903. process.chdir = function (dir) {
  36904. throw new Error('process.chdir is not supported');
  36905. };
  36906. process.umask = function() { return 0; };
  36907. /***/ }),
  36908. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36909. /*!***************************************************!*\
  36910. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36911. \***************************************************/
  36912. /*! no static exports found */
  36913. /***/ (function(module, exports, __webpack_require__) {
  36914. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36915. * Pusher JavaScript Library v5.0.3
  36916. * https://pusher.com/
  36917. *
  36918. * Copyright 2017, Pusher
  36919. * Released under the MIT licence.
  36920. */
  36921. (function webpackUniversalModuleDefinition(root, factory) {
  36922. if(true)
  36923. module.exports = factory();
  36924. else {}
  36925. })(window, function() {
  36926. return /******/ (function(modules) { // webpackBootstrap
  36927. /******/ // The module cache
  36928. /******/ var installedModules = {};
  36929. /******/
  36930. /******/ // The require function
  36931. /******/ function __webpack_require__(moduleId) {
  36932. /******/
  36933. /******/ // Check if module is in cache
  36934. /******/ if(installedModules[moduleId]) {
  36935. /******/ return installedModules[moduleId].exports;
  36936. /******/ }
  36937. /******/ // Create a new module (and put it into the cache)
  36938. /******/ var module = installedModules[moduleId] = {
  36939. /******/ i: moduleId,
  36940. /******/ l: false,
  36941. /******/ exports: {}
  36942. /******/ };
  36943. /******/
  36944. /******/ // Execute the module function
  36945. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36946. /******/
  36947. /******/ // Flag the module as loaded
  36948. /******/ module.l = true;
  36949. /******/
  36950. /******/ // Return the exports of the module
  36951. /******/ return module.exports;
  36952. /******/ }
  36953. /******/
  36954. /******/
  36955. /******/ // expose the modules object (__webpack_modules__)
  36956. /******/ __webpack_require__.m = modules;
  36957. /******/
  36958. /******/ // expose the module cache
  36959. /******/ __webpack_require__.c = installedModules;
  36960. /******/
  36961. /******/ // define getter function for harmony exports
  36962. /******/ __webpack_require__.d = function(exports, name, getter) {
  36963. /******/ if(!__webpack_require__.o(exports, name)) {
  36964. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36965. /******/ }
  36966. /******/ };
  36967. /******/
  36968. /******/ // define __esModule on exports
  36969. /******/ __webpack_require__.r = function(exports) {
  36970. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36971. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36972. /******/ }
  36973. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36974. /******/ };
  36975. /******/
  36976. /******/ // create a fake namespace object
  36977. /******/ // mode & 1: value is a module id, require it
  36978. /******/ // mode & 2: merge all properties of value into the ns
  36979. /******/ // mode & 4: return value when already ns object
  36980. /******/ // mode & 8|1: behave like require
  36981. /******/ __webpack_require__.t = function(value, mode) {
  36982. /******/ if(mode & 1) value = __webpack_require__(value);
  36983. /******/ if(mode & 8) return value;
  36984. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36985. /******/ var ns = Object.create(null);
  36986. /******/ __webpack_require__.r(ns);
  36987. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36988. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36989. /******/ return ns;
  36990. /******/ };
  36991. /******/
  36992. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36993. /******/ __webpack_require__.n = function(module) {
  36994. /******/ var getter = module && module.__esModule ?
  36995. /******/ function getDefault() { return module['default']; } :
  36996. /******/ function getModuleExports() { return module; };
  36997. /******/ __webpack_require__.d(getter, 'a', getter);
  36998. /******/ return getter;
  36999. /******/ };
  37000. /******/
  37001. /******/ // Object.prototype.hasOwnProperty.call
  37002. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37003. /******/
  37004. /******/ // __webpack_public_path__
  37005. /******/ __webpack_require__.p = "";
  37006. /******/
  37007. /******/
  37008. /******/ // Load entry module and return exports
  37009. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37010. /******/ })
  37011. /************************************************************************/
  37012. /******/ ([
  37013. /* 0 */
  37014. /***/ (function(module, exports, __webpack_require__) {
  37015. (function(nacl) {
  37016. 'use strict';
  37017. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37018. // Public domain.
  37019. //
  37020. // Implementation derived from TweetNaCl version 20140427.
  37021. // See for details: http://tweetnacl.cr.yp.to/
  37022. var gf = function(init) {
  37023. var i, r = new Float64Array(16);
  37024. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37025. return r;
  37026. };
  37027. // Pluggable, initialized in high-level API below.
  37028. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37029. var _0 = new Uint8Array(16);
  37030. var _9 = new Uint8Array(32); _9[0] = 9;
  37031. var gf0 = gf(),
  37032. gf1 = gf([1]),
  37033. _121665 = gf([0xdb41, 1]),
  37034. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37035. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37036. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37037. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37038. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37039. function ts64(x, i, h, l) {
  37040. x[i] = (h >> 24) & 0xff;
  37041. x[i+1] = (h >> 16) & 0xff;
  37042. x[i+2] = (h >> 8) & 0xff;
  37043. x[i+3] = h & 0xff;
  37044. x[i+4] = (l >> 24) & 0xff;
  37045. x[i+5] = (l >> 16) & 0xff;
  37046. x[i+6] = (l >> 8) & 0xff;
  37047. x[i+7] = l & 0xff;
  37048. }
  37049. function vn(x, xi, y, yi, n) {
  37050. var i,d = 0;
  37051. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37052. return (1 & ((d - 1) >>> 8)) - 1;
  37053. }
  37054. function crypto_verify_16(x, xi, y, yi) {
  37055. return vn(x,xi,y,yi,16);
  37056. }
  37057. function crypto_verify_32(x, xi, y, yi) {
  37058. return vn(x,xi,y,yi,32);
  37059. }
  37060. function core_salsa20(o, p, k, c) {
  37061. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37062. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37063. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37064. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37065. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37066. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37067. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37068. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37069. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37070. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37071. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37072. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37073. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37074. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37075. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37076. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37077. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37078. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37079. x15 = j15, u;
  37080. for (var i = 0; i < 20; i += 2) {
  37081. u = x0 + x12 | 0;
  37082. x4 ^= u<<7 | u>>>(32-7);
  37083. u = x4 + x0 | 0;
  37084. x8 ^= u<<9 | u>>>(32-9);
  37085. u = x8 + x4 | 0;
  37086. x12 ^= u<<13 | u>>>(32-13);
  37087. u = x12 + x8 | 0;
  37088. x0 ^= u<<18 | u>>>(32-18);
  37089. u = x5 + x1 | 0;
  37090. x9 ^= u<<7 | u>>>(32-7);
  37091. u = x9 + x5 | 0;
  37092. x13 ^= u<<9 | u>>>(32-9);
  37093. u = x13 + x9 | 0;
  37094. x1 ^= u<<13 | u>>>(32-13);
  37095. u = x1 + x13 | 0;
  37096. x5 ^= u<<18 | u>>>(32-18);
  37097. u = x10 + x6 | 0;
  37098. x14 ^= u<<7 | u>>>(32-7);
  37099. u = x14 + x10 | 0;
  37100. x2 ^= u<<9 | u>>>(32-9);
  37101. u = x2 + x14 | 0;
  37102. x6 ^= u<<13 | u>>>(32-13);
  37103. u = x6 + x2 | 0;
  37104. x10 ^= u<<18 | u>>>(32-18);
  37105. u = x15 + x11 | 0;
  37106. x3 ^= u<<7 | u>>>(32-7);
  37107. u = x3 + x15 | 0;
  37108. x7 ^= u<<9 | u>>>(32-9);
  37109. u = x7 + x3 | 0;
  37110. x11 ^= u<<13 | u>>>(32-13);
  37111. u = x11 + x7 | 0;
  37112. x15 ^= u<<18 | u>>>(32-18);
  37113. u = x0 + x3 | 0;
  37114. x1 ^= u<<7 | u>>>(32-7);
  37115. u = x1 + x0 | 0;
  37116. x2 ^= u<<9 | u>>>(32-9);
  37117. u = x2 + x1 | 0;
  37118. x3 ^= u<<13 | u>>>(32-13);
  37119. u = x3 + x2 | 0;
  37120. x0 ^= u<<18 | u>>>(32-18);
  37121. u = x5 + x4 | 0;
  37122. x6 ^= u<<7 | u>>>(32-7);
  37123. u = x6 + x5 | 0;
  37124. x7 ^= u<<9 | u>>>(32-9);
  37125. u = x7 + x6 | 0;
  37126. x4 ^= u<<13 | u>>>(32-13);
  37127. u = x4 + x7 | 0;
  37128. x5 ^= u<<18 | u>>>(32-18);
  37129. u = x10 + x9 | 0;
  37130. x11 ^= u<<7 | u>>>(32-7);
  37131. u = x11 + x10 | 0;
  37132. x8 ^= u<<9 | u>>>(32-9);
  37133. u = x8 + x11 | 0;
  37134. x9 ^= u<<13 | u>>>(32-13);
  37135. u = x9 + x8 | 0;
  37136. x10 ^= u<<18 | u>>>(32-18);
  37137. u = x15 + x14 | 0;
  37138. x12 ^= u<<7 | u>>>(32-7);
  37139. u = x12 + x15 | 0;
  37140. x13 ^= u<<9 | u>>>(32-9);
  37141. u = x13 + x12 | 0;
  37142. x14 ^= u<<13 | u>>>(32-13);
  37143. u = x14 + x13 | 0;
  37144. x15 ^= u<<18 | u>>>(32-18);
  37145. }
  37146. x0 = x0 + j0 | 0;
  37147. x1 = x1 + j1 | 0;
  37148. x2 = x2 + j2 | 0;
  37149. x3 = x3 + j3 | 0;
  37150. x4 = x4 + j4 | 0;
  37151. x5 = x5 + j5 | 0;
  37152. x6 = x6 + j6 | 0;
  37153. x7 = x7 + j7 | 0;
  37154. x8 = x8 + j8 | 0;
  37155. x9 = x9 + j9 | 0;
  37156. x10 = x10 + j10 | 0;
  37157. x11 = x11 + j11 | 0;
  37158. x12 = x12 + j12 | 0;
  37159. x13 = x13 + j13 | 0;
  37160. x14 = x14 + j14 | 0;
  37161. x15 = x15 + j15 | 0;
  37162. o[ 0] = x0 >>> 0 & 0xff;
  37163. o[ 1] = x0 >>> 8 & 0xff;
  37164. o[ 2] = x0 >>> 16 & 0xff;
  37165. o[ 3] = x0 >>> 24 & 0xff;
  37166. o[ 4] = x1 >>> 0 & 0xff;
  37167. o[ 5] = x1 >>> 8 & 0xff;
  37168. o[ 6] = x1 >>> 16 & 0xff;
  37169. o[ 7] = x1 >>> 24 & 0xff;
  37170. o[ 8] = x2 >>> 0 & 0xff;
  37171. o[ 9] = x2 >>> 8 & 0xff;
  37172. o[10] = x2 >>> 16 & 0xff;
  37173. o[11] = x2 >>> 24 & 0xff;
  37174. o[12] = x3 >>> 0 & 0xff;
  37175. o[13] = x3 >>> 8 & 0xff;
  37176. o[14] = x3 >>> 16 & 0xff;
  37177. o[15] = x3 >>> 24 & 0xff;
  37178. o[16] = x4 >>> 0 & 0xff;
  37179. o[17] = x4 >>> 8 & 0xff;
  37180. o[18] = x4 >>> 16 & 0xff;
  37181. o[19] = x4 >>> 24 & 0xff;
  37182. o[20] = x5 >>> 0 & 0xff;
  37183. o[21] = x5 >>> 8 & 0xff;
  37184. o[22] = x5 >>> 16 & 0xff;
  37185. o[23] = x5 >>> 24 & 0xff;
  37186. o[24] = x6 >>> 0 & 0xff;
  37187. o[25] = x6 >>> 8 & 0xff;
  37188. o[26] = x6 >>> 16 & 0xff;
  37189. o[27] = x6 >>> 24 & 0xff;
  37190. o[28] = x7 >>> 0 & 0xff;
  37191. o[29] = x7 >>> 8 & 0xff;
  37192. o[30] = x7 >>> 16 & 0xff;
  37193. o[31] = x7 >>> 24 & 0xff;
  37194. o[32] = x8 >>> 0 & 0xff;
  37195. o[33] = x8 >>> 8 & 0xff;
  37196. o[34] = x8 >>> 16 & 0xff;
  37197. o[35] = x8 >>> 24 & 0xff;
  37198. o[36] = x9 >>> 0 & 0xff;
  37199. o[37] = x9 >>> 8 & 0xff;
  37200. o[38] = x9 >>> 16 & 0xff;
  37201. o[39] = x9 >>> 24 & 0xff;
  37202. o[40] = x10 >>> 0 & 0xff;
  37203. o[41] = x10 >>> 8 & 0xff;
  37204. o[42] = x10 >>> 16 & 0xff;
  37205. o[43] = x10 >>> 24 & 0xff;
  37206. o[44] = x11 >>> 0 & 0xff;
  37207. o[45] = x11 >>> 8 & 0xff;
  37208. o[46] = x11 >>> 16 & 0xff;
  37209. o[47] = x11 >>> 24 & 0xff;
  37210. o[48] = x12 >>> 0 & 0xff;
  37211. o[49] = x12 >>> 8 & 0xff;
  37212. o[50] = x12 >>> 16 & 0xff;
  37213. o[51] = x12 >>> 24 & 0xff;
  37214. o[52] = x13 >>> 0 & 0xff;
  37215. o[53] = x13 >>> 8 & 0xff;
  37216. o[54] = x13 >>> 16 & 0xff;
  37217. o[55] = x13 >>> 24 & 0xff;
  37218. o[56] = x14 >>> 0 & 0xff;
  37219. o[57] = x14 >>> 8 & 0xff;
  37220. o[58] = x14 >>> 16 & 0xff;
  37221. o[59] = x14 >>> 24 & 0xff;
  37222. o[60] = x15 >>> 0 & 0xff;
  37223. o[61] = x15 >>> 8 & 0xff;
  37224. o[62] = x15 >>> 16 & 0xff;
  37225. o[63] = x15 >>> 24 & 0xff;
  37226. }
  37227. function core_hsalsa20(o,p,k,c) {
  37228. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37229. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37230. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37231. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37232. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37233. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37234. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37235. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37236. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37237. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37238. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37239. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37240. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37241. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37242. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37243. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37244. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37245. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37246. x15 = j15, u;
  37247. for (var i = 0; i < 20; i += 2) {
  37248. u = x0 + x12 | 0;
  37249. x4 ^= u<<7 | u>>>(32-7);
  37250. u = x4 + x0 | 0;
  37251. x8 ^= u<<9 | u>>>(32-9);
  37252. u = x8 + x4 | 0;
  37253. x12 ^= u<<13 | u>>>(32-13);
  37254. u = x12 + x8 | 0;
  37255. x0 ^= u<<18 | u>>>(32-18);
  37256. u = x5 + x1 | 0;
  37257. x9 ^= u<<7 | u>>>(32-7);
  37258. u = x9 + x5 | 0;
  37259. x13 ^= u<<9 | u>>>(32-9);
  37260. u = x13 + x9 | 0;
  37261. x1 ^= u<<13 | u>>>(32-13);
  37262. u = x1 + x13 | 0;
  37263. x5 ^= u<<18 | u>>>(32-18);
  37264. u = x10 + x6 | 0;
  37265. x14 ^= u<<7 | u>>>(32-7);
  37266. u = x14 + x10 | 0;
  37267. x2 ^= u<<9 | u>>>(32-9);
  37268. u = x2 + x14 | 0;
  37269. x6 ^= u<<13 | u>>>(32-13);
  37270. u = x6 + x2 | 0;
  37271. x10 ^= u<<18 | u>>>(32-18);
  37272. u = x15 + x11 | 0;
  37273. x3 ^= u<<7 | u>>>(32-7);
  37274. u = x3 + x15 | 0;
  37275. x7 ^= u<<9 | u>>>(32-9);
  37276. u = x7 + x3 | 0;
  37277. x11 ^= u<<13 | u>>>(32-13);
  37278. u = x11 + x7 | 0;
  37279. x15 ^= u<<18 | u>>>(32-18);
  37280. u = x0 + x3 | 0;
  37281. x1 ^= u<<7 | u>>>(32-7);
  37282. u = x1 + x0 | 0;
  37283. x2 ^= u<<9 | u>>>(32-9);
  37284. u = x2 + x1 | 0;
  37285. x3 ^= u<<13 | u>>>(32-13);
  37286. u = x3 + x2 | 0;
  37287. x0 ^= u<<18 | u>>>(32-18);
  37288. u = x5 + x4 | 0;
  37289. x6 ^= u<<7 | u>>>(32-7);
  37290. u = x6 + x5 | 0;
  37291. x7 ^= u<<9 | u>>>(32-9);
  37292. u = x7 + x6 | 0;
  37293. x4 ^= u<<13 | u>>>(32-13);
  37294. u = x4 + x7 | 0;
  37295. x5 ^= u<<18 | u>>>(32-18);
  37296. u = x10 + x9 | 0;
  37297. x11 ^= u<<7 | u>>>(32-7);
  37298. u = x11 + x10 | 0;
  37299. x8 ^= u<<9 | u>>>(32-9);
  37300. u = x8 + x11 | 0;
  37301. x9 ^= u<<13 | u>>>(32-13);
  37302. u = x9 + x8 | 0;
  37303. x10 ^= u<<18 | u>>>(32-18);
  37304. u = x15 + x14 | 0;
  37305. x12 ^= u<<7 | u>>>(32-7);
  37306. u = x12 + x15 | 0;
  37307. x13 ^= u<<9 | u>>>(32-9);
  37308. u = x13 + x12 | 0;
  37309. x14 ^= u<<13 | u>>>(32-13);
  37310. u = x14 + x13 | 0;
  37311. x15 ^= u<<18 | u>>>(32-18);
  37312. }
  37313. o[ 0] = x0 >>> 0 & 0xff;
  37314. o[ 1] = x0 >>> 8 & 0xff;
  37315. o[ 2] = x0 >>> 16 & 0xff;
  37316. o[ 3] = x0 >>> 24 & 0xff;
  37317. o[ 4] = x5 >>> 0 & 0xff;
  37318. o[ 5] = x5 >>> 8 & 0xff;
  37319. o[ 6] = x5 >>> 16 & 0xff;
  37320. o[ 7] = x5 >>> 24 & 0xff;
  37321. o[ 8] = x10 >>> 0 & 0xff;
  37322. o[ 9] = x10 >>> 8 & 0xff;
  37323. o[10] = x10 >>> 16 & 0xff;
  37324. o[11] = x10 >>> 24 & 0xff;
  37325. o[12] = x15 >>> 0 & 0xff;
  37326. o[13] = x15 >>> 8 & 0xff;
  37327. o[14] = x15 >>> 16 & 0xff;
  37328. o[15] = x15 >>> 24 & 0xff;
  37329. o[16] = x6 >>> 0 & 0xff;
  37330. o[17] = x6 >>> 8 & 0xff;
  37331. o[18] = x6 >>> 16 & 0xff;
  37332. o[19] = x6 >>> 24 & 0xff;
  37333. o[20] = x7 >>> 0 & 0xff;
  37334. o[21] = x7 >>> 8 & 0xff;
  37335. o[22] = x7 >>> 16 & 0xff;
  37336. o[23] = x7 >>> 24 & 0xff;
  37337. o[24] = x8 >>> 0 & 0xff;
  37338. o[25] = x8 >>> 8 & 0xff;
  37339. o[26] = x8 >>> 16 & 0xff;
  37340. o[27] = x8 >>> 24 & 0xff;
  37341. o[28] = x9 >>> 0 & 0xff;
  37342. o[29] = x9 >>> 8 & 0xff;
  37343. o[30] = x9 >>> 16 & 0xff;
  37344. o[31] = x9 >>> 24 & 0xff;
  37345. }
  37346. function crypto_core_salsa20(out,inp,k,c) {
  37347. core_salsa20(out,inp,k,c);
  37348. }
  37349. function crypto_core_hsalsa20(out,inp,k,c) {
  37350. core_hsalsa20(out,inp,k,c);
  37351. }
  37352. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37353. // "expand 32-byte k"
  37354. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37355. var z = new Uint8Array(16), x = new Uint8Array(64);
  37356. var u, i;
  37357. for (i = 0; i < 16; i++) z[i] = 0;
  37358. for (i = 0; i < 8; i++) z[i] = n[i];
  37359. while (b >= 64) {
  37360. crypto_core_salsa20(x,z,k,sigma);
  37361. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37362. u = 1;
  37363. for (i = 8; i < 16; i++) {
  37364. u = u + (z[i] & 0xff) | 0;
  37365. z[i] = u & 0xff;
  37366. u >>>= 8;
  37367. }
  37368. b -= 64;
  37369. cpos += 64;
  37370. mpos += 64;
  37371. }
  37372. if (b > 0) {
  37373. crypto_core_salsa20(x,z,k,sigma);
  37374. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37375. }
  37376. return 0;
  37377. }
  37378. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37379. var z = new Uint8Array(16), x = new Uint8Array(64);
  37380. var u, i;
  37381. for (i = 0; i < 16; i++) z[i] = 0;
  37382. for (i = 0; i < 8; i++) z[i] = n[i];
  37383. while (b >= 64) {
  37384. crypto_core_salsa20(x,z,k,sigma);
  37385. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37386. u = 1;
  37387. for (i = 8; i < 16; i++) {
  37388. u = u + (z[i] & 0xff) | 0;
  37389. z[i] = u & 0xff;
  37390. u >>>= 8;
  37391. }
  37392. b -= 64;
  37393. cpos += 64;
  37394. }
  37395. if (b > 0) {
  37396. crypto_core_salsa20(x,z,k,sigma);
  37397. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37398. }
  37399. return 0;
  37400. }
  37401. function crypto_stream(c,cpos,d,n,k) {
  37402. var s = new Uint8Array(32);
  37403. crypto_core_hsalsa20(s,n,k,sigma);
  37404. var sn = new Uint8Array(8);
  37405. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37406. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37407. }
  37408. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37409. var s = new Uint8Array(32);
  37410. crypto_core_hsalsa20(s,n,k,sigma);
  37411. var sn = new Uint8Array(8);
  37412. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37413. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37414. }
  37415. /*
  37416. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37417. * https://github.com/floodyberry/poly1305-donna
  37418. */
  37419. var poly1305 = function(key) {
  37420. this.buffer = new Uint8Array(16);
  37421. this.r = new Uint16Array(10);
  37422. this.h = new Uint16Array(10);
  37423. this.pad = new Uint16Array(8);
  37424. this.leftover = 0;
  37425. this.fin = 0;
  37426. var t0, t1, t2, t3, t4, t5, t6, t7;
  37427. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37428. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37429. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37430. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37431. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37432. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37433. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37434. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37435. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37436. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37437. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37438. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37439. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37440. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37441. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37442. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37443. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37444. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37445. };
  37446. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37447. var hibit = this.fin ? 0 : (1 << 11);
  37448. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37449. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37450. var h0 = this.h[0],
  37451. h1 = this.h[1],
  37452. h2 = this.h[2],
  37453. h3 = this.h[3],
  37454. h4 = this.h[4],
  37455. h5 = this.h[5],
  37456. h6 = this.h[6],
  37457. h7 = this.h[7],
  37458. h8 = this.h[8],
  37459. h9 = this.h[9];
  37460. var r0 = this.r[0],
  37461. r1 = this.r[1],
  37462. r2 = this.r[2],
  37463. r3 = this.r[3],
  37464. r4 = this.r[4],
  37465. r5 = this.r[5],
  37466. r6 = this.r[6],
  37467. r7 = this.r[7],
  37468. r8 = this.r[8],
  37469. r9 = this.r[9];
  37470. while (bytes >= 16) {
  37471. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37472. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37473. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37474. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37475. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37476. h5 += ((t4 >>> 1)) & 0x1fff;
  37477. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37478. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37479. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37480. h9 += ((t7 >>> 5)) | hibit;
  37481. c = 0;
  37482. d0 = c;
  37483. d0 += h0 * r0;
  37484. d0 += h1 * (5 * r9);
  37485. d0 += h2 * (5 * r8);
  37486. d0 += h3 * (5 * r7);
  37487. d0 += h4 * (5 * r6);
  37488. c = (d0 >>> 13); d0 &= 0x1fff;
  37489. d0 += h5 * (5 * r5);
  37490. d0 += h6 * (5 * r4);
  37491. d0 += h7 * (5 * r3);
  37492. d0 += h8 * (5 * r2);
  37493. d0 += h9 * (5 * r1);
  37494. c += (d0 >>> 13); d0 &= 0x1fff;
  37495. d1 = c;
  37496. d1 += h0 * r1;
  37497. d1 += h1 * r0;
  37498. d1 += h2 * (5 * r9);
  37499. d1 += h3 * (5 * r8);
  37500. d1 += h4 * (5 * r7);
  37501. c = (d1 >>> 13); d1 &= 0x1fff;
  37502. d1 += h5 * (5 * r6);
  37503. d1 += h6 * (5 * r5);
  37504. d1 += h7 * (5 * r4);
  37505. d1 += h8 * (5 * r3);
  37506. d1 += h9 * (5 * r2);
  37507. c += (d1 >>> 13); d1 &= 0x1fff;
  37508. d2 = c;
  37509. d2 += h0 * r2;
  37510. d2 += h1 * r1;
  37511. d2 += h2 * r0;
  37512. d2 += h3 * (5 * r9);
  37513. d2 += h4 * (5 * r8);
  37514. c = (d2 >>> 13); d2 &= 0x1fff;
  37515. d2 += h5 * (5 * r7);
  37516. d2 += h6 * (5 * r6);
  37517. d2 += h7 * (5 * r5);
  37518. d2 += h8 * (5 * r4);
  37519. d2 += h9 * (5 * r3);
  37520. c += (d2 >>> 13); d2 &= 0x1fff;
  37521. d3 = c;
  37522. d3 += h0 * r3;
  37523. d3 += h1 * r2;
  37524. d3 += h2 * r1;
  37525. d3 += h3 * r0;
  37526. d3 += h4 * (5 * r9);
  37527. c = (d3 >>> 13); d3 &= 0x1fff;
  37528. d3 += h5 * (5 * r8);
  37529. d3 += h6 * (5 * r7);
  37530. d3 += h7 * (5 * r6);
  37531. d3 += h8 * (5 * r5);
  37532. d3 += h9 * (5 * r4);
  37533. c += (d3 >>> 13); d3 &= 0x1fff;
  37534. d4 = c;
  37535. d4 += h0 * r4;
  37536. d4 += h1 * r3;
  37537. d4 += h2 * r2;
  37538. d4 += h3 * r1;
  37539. d4 += h4 * r0;
  37540. c = (d4 >>> 13); d4 &= 0x1fff;
  37541. d4 += h5 * (5 * r9);
  37542. d4 += h6 * (5 * r8);
  37543. d4 += h7 * (5 * r7);
  37544. d4 += h8 * (5 * r6);
  37545. d4 += h9 * (5 * r5);
  37546. c += (d4 >>> 13); d4 &= 0x1fff;
  37547. d5 = c;
  37548. d5 += h0 * r5;
  37549. d5 += h1 * r4;
  37550. d5 += h2 * r3;
  37551. d5 += h3 * r2;
  37552. d5 += h4 * r1;
  37553. c = (d5 >>> 13); d5 &= 0x1fff;
  37554. d5 += h5 * r0;
  37555. d5 += h6 * (5 * r9);
  37556. d5 += h7 * (5 * r8);
  37557. d5 += h8 * (5 * r7);
  37558. d5 += h9 * (5 * r6);
  37559. c += (d5 >>> 13); d5 &= 0x1fff;
  37560. d6 = c;
  37561. d6 += h0 * r6;
  37562. d6 += h1 * r5;
  37563. d6 += h2 * r4;
  37564. d6 += h3 * r3;
  37565. d6 += h4 * r2;
  37566. c = (d6 >>> 13); d6 &= 0x1fff;
  37567. d6 += h5 * r1;
  37568. d6 += h6 * r0;
  37569. d6 += h7 * (5 * r9);
  37570. d6 += h8 * (5 * r8);
  37571. d6 += h9 * (5 * r7);
  37572. c += (d6 >>> 13); d6 &= 0x1fff;
  37573. d7 = c;
  37574. d7 += h0 * r7;
  37575. d7 += h1 * r6;
  37576. d7 += h2 * r5;
  37577. d7 += h3 * r4;
  37578. d7 += h4 * r3;
  37579. c = (d7 >>> 13); d7 &= 0x1fff;
  37580. d7 += h5 * r2;
  37581. d7 += h6 * r1;
  37582. d7 += h7 * r0;
  37583. d7 += h8 * (5 * r9);
  37584. d7 += h9 * (5 * r8);
  37585. c += (d7 >>> 13); d7 &= 0x1fff;
  37586. d8 = c;
  37587. d8 += h0 * r8;
  37588. d8 += h1 * r7;
  37589. d8 += h2 * r6;
  37590. d8 += h3 * r5;
  37591. d8 += h4 * r4;
  37592. c = (d8 >>> 13); d8 &= 0x1fff;
  37593. d8 += h5 * r3;
  37594. d8 += h6 * r2;
  37595. d8 += h7 * r1;
  37596. d8 += h8 * r0;
  37597. d8 += h9 * (5 * r9);
  37598. c += (d8 >>> 13); d8 &= 0x1fff;
  37599. d9 = c;
  37600. d9 += h0 * r9;
  37601. d9 += h1 * r8;
  37602. d9 += h2 * r7;
  37603. d9 += h3 * r6;
  37604. d9 += h4 * r5;
  37605. c = (d9 >>> 13); d9 &= 0x1fff;
  37606. d9 += h5 * r4;
  37607. d9 += h6 * r3;
  37608. d9 += h7 * r2;
  37609. d9 += h8 * r1;
  37610. d9 += h9 * r0;
  37611. c += (d9 >>> 13); d9 &= 0x1fff;
  37612. c = (((c << 2) + c)) | 0;
  37613. c = (c + d0) | 0;
  37614. d0 = c & 0x1fff;
  37615. c = (c >>> 13);
  37616. d1 += c;
  37617. h0 = d0;
  37618. h1 = d1;
  37619. h2 = d2;
  37620. h3 = d3;
  37621. h4 = d4;
  37622. h5 = d5;
  37623. h6 = d6;
  37624. h7 = d7;
  37625. h8 = d8;
  37626. h9 = d9;
  37627. mpos += 16;
  37628. bytes -= 16;
  37629. }
  37630. this.h[0] = h0;
  37631. this.h[1] = h1;
  37632. this.h[2] = h2;
  37633. this.h[3] = h3;
  37634. this.h[4] = h4;
  37635. this.h[5] = h5;
  37636. this.h[6] = h6;
  37637. this.h[7] = h7;
  37638. this.h[8] = h8;
  37639. this.h[9] = h9;
  37640. };
  37641. poly1305.prototype.finish = function(mac, macpos) {
  37642. var g = new Uint16Array(10);
  37643. var c, mask, f, i;
  37644. if (this.leftover) {
  37645. i = this.leftover;
  37646. this.buffer[i++] = 1;
  37647. for (; i < 16; i++) this.buffer[i] = 0;
  37648. this.fin = 1;
  37649. this.blocks(this.buffer, 0, 16);
  37650. }
  37651. c = this.h[1] >>> 13;
  37652. this.h[1] &= 0x1fff;
  37653. for (i = 2; i < 10; i++) {
  37654. this.h[i] += c;
  37655. c = this.h[i] >>> 13;
  37656. this.h[i] &= 0x1fff;
  37657. }
  37658. this.h[0] += (c * 5);
  37659. c = this.h[0] >>> 13;
  37660. this.h[0] &= 0x1fff;
  37661. this.h[1] += c;
  37662. c = this.h[1] >>> 13;
  37663. this.h[1] &= 0x1fff;
  37664. this.h[2] += c;
  37665. g[0] = this.h[0] + 5;
  37666. c = g[0] >>> 13;
  37667. g[0] &= 0x1fff;
  37668. for (i = 1; i < 10; i++) {
  37669. g[i] = this.h[i] + c;
  37670. c = g[i] >>> 13;
  37671. g[i] &= 0x1fff;
  37672. }
  37673. g[9] -= (1 << 13);
  37674. mask = (c ^ 1) - 1;
  37675. for (i = 0; i < 10; i++) g[i] &= mask;
  37676. mask = ~mask;
  37677. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37678. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37679. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37680. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37681. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37682. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37683. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37684. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37685. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37686. f = this.h[0] + this.pad[0];
  37687. this.h[0] = f & 0xffff;
  37688. for (i = 1; i < 8; i++) {
  37689. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37690. this.h[i] = f & 0xffff;
  37691. }
  37692. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37693. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37694. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37695. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37696. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37697. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37698. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37699. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37700. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37701. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37702. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37703. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37704. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37705. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37706. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37707. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37708. };
  37709. poly1305.prototype.update = function(m, mpos, bytes) {
  37710. var i, want;
  37711. if (this.leftover) {
  37712. want = (16 - this.leftover);
  37713. if (want > bytes)
  37714. want = bytes;
  37715. for (i = 0; i < want; i++)
  37716. this.buffer[this.leftover + i] = m[mpos+i];
  37717. bytes -= want;
  37718. mpos += want;
  37719. this.leftover += want;
  37720. if (this.leftover < 16)
  37721. return;
  37722. this.blocks(this.buffer, 0, 16);
  37723. this.leftover = 0;
  37724. }
  37725. if (bytes >= 16) {
  37726. want = bytes - (bytes % 16);
  37727. this.blocks(m, mpos, want);
  37728. mpos += want;
  37729. bytes -= want;
  37730. }
  37731. if (bytes) {
  37732. for (i = 0; i < bytes; i++)
  37733. this.buffer[this.leftover + i] = m[mpos+i];
  37734. this.leftover += bytes;
  37735. }
  37736. };
  37737. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37738. var s = new poly1305(k);
  37739. s.update(m, mpos, n);
  37740. s.finish(out, outpos);
  37741. return 0;
  37742. }
  37743. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37744. var x = new Uint8Array(16);
  37745. crypto_onetimeauth(x,0,m,mpos,n,k);
  37746. return crypto_verify_16(h,hpos,x,0);
  37747. }
  37748. function crypto_secretbox(c,m,d,n,k) {
  37749. var i;
  37750. if (d < 32) return -1;
  37751. crypto_stream_xor(c,0,m,0,d,n,k);
  37752. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37753. for (i = 0; i < 16; i++) c[i] = 0;
  37754. return 0;
  37755. }
  37756. function crypto_secretbox_open(m,c,d,n,k) {
  37757. var i;
  37758. var x = new Uint8Array(32);
  37759. if (d < 32) return -1;
  37760. crypto_stream(x,0,32,n,k);
  37761. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37762. crypto_stream_xor(m,0,c,0,d,n,k);
  37763. for (i = 0; i < 32; i++) m[i] = 0;
  37764. return 0;
  37765. }
  37766. function set25519(r, a) {
  37767. var i;
  37768. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37769. }
  37770. function car25519(o) {
  37771. var i, v, c = 1;
  37772. for (i = 0; i < 16; i++) {
  37773. v = o[i] + c + 65535;
  37774. c = Math.floor(v / 65536);
  37775. o[i] = v - c * 65536;
  37776. }
  37777. o[0] += c-1 + 37 * (c-1);
  37778. }
  37779. function sel25519(p, q, b) {
  37780. var t, c = ~(b-1);
  37781. for (var i = 0; i < 16; i++) {
  37782. t = c & (p[i] ^ q[i]);
  37783. p[i] ^= t;
  37784. q[i] ^= t;
  37785. }
  37786. }
  37787. function pack25519(o, n) {
  37788. var i, j, b;
  37789. var m = gf(), t = gf();
  37790. for (i = 0; i < 16; i++) t[i] = n[i];
  37791. car25519(t);
  37792. car25519(t);
  37793. car25519(t);
  37794. for (j = 0; j < 2; j++) {
  37795. m[0] = t[0] - 0xffed;
  37796. for (i = 1; i < 15; i++) {
  37797. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37798. m[i-1] &= 0xffff;
  37799. }
  37800. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37801. b = (m[15]>>16) & 1;
  37802. m[14] &= 0xffff;
  37803. sel25519(t, m, 1-b);
  37804. }
  37805. for (i = 0; i < 16; i++) {
  37806. o[2*i] = t[i] & 0xff;
  37807. o[2*i+1] = t[i]>>8;
  37808. }
  37809. }
  37810. function neq25519(a, b) {
  37811. var c = new Uint8Array(32), d = new Uint8Array(32);
  37812. pack25519(c, a);
  37813. pack25519(d, b);
  37814. return crypto_verify_32(c, 0, d, 0);
  37815. }
  37816. function par25519(a) {
  37817. var d = new Uint8Array(32);
  37818. pack25519(d, a);
  37819. return d[0] & 1;
  37820. }
  37821. function unpack25519(o, n) {
  37822. var i;
  37823. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37824. o[15] &= 0x7fff;
  37825. }
  37826. function A(o, a, b) {
  37827. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37828. }
  37829. function Z(o, a, b) {
  37830. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37831. }
  37832. function M(o, a, b) {
  37833. var v, c,
  37834. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37835. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37836. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37837. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37838. b0 = b[0],
  37839. b1 = b[1],
  37840. b2 = b[2],
  37841. b3 = b[3],
  37842. b4 = b[4],
  37843. b5 = b[5],
  37844. b6 = b[6],
  37845. b7 = b[7],
  37846. b8 = b[8],
  37847. b9 = b[9],
  37848. b10 = b[10],
  37849. b11 = b[11],
  37850. b12 = b[12],
  37851. b13 = b[13],
  37852. b14 = b[14],
  37853. b15 = b[15];
  37854. v = a[0];
  37855. t0 += v * b0;
  37856. t1 += v * b1;
  37857. t2 += v * b2;
  37858. t3 += v * b3;
  37859. t4 += v * b4;
  37860. t5 += v * b5;
  37861. t6 += v * b6;
  37862. t7 += v * b7;
  37863. t8 += v * b8;
  37864. t9 += v * b9;
  37865. t10 += v * b10;
  37866. t11 += v * b11;
  37867. t12 += v * b12;
  37868. t13 += v * b13;
  37869. t14 += v * b14;
  37870. t15 += v * b15;
  37871. v = a[1];
  37872. t1 += v * b0;
  37873. t2 += v * b1;
  37874. t3 += v * b2;
  37875. t4 += v * b3;
  37876. t5 += v * b4;
  37877. t6 += v * b5;
  37878. t7 += v * b6;
  37879. t8 += v * b7;
  37880. t9 += v * b8;
  37881. t10 += v * b9;
  37882. t11 += v * b10;
  37883. t12 += v * b11;
  37884. t13 += v * b12;
  37885. t14 += v * b13;
  37886. t15 += v * b14;
  37887. t16 += v * b15;
  37888. v = a[2];
  37889. t2 += v * b0;
  37890. t3 += v * b1;
  37891. t4 += v * b2;
  37892. t5 += v * b3;
  37893. t6 += v * b4;
  37894. t7 += v * b5;
  37895. t8 += v * b6;
  37896. t9 += v * b7;
  37897. t10 += v * b8;
  37898. t11 += v * b9;
  37899. t12 += v * b10;
  37900. t13 += v * b11;
  37901. t14 += v * b12;
  37902. t15 += v * b13;
  37903. t16 += v * b14;
  37904. t17 += v * b15;
  37905. v = a[3];
  37906. t3 += v * b0;
  37907. t4 += v * b1;
  37908. t5 += v * b2;
  37909. t6 += v * b3;
  37910. t7 += v * b4;
  37911. t8 += v * b5;
  37912. t9 += v * b6;
  37913. t10 += v * b7;
  37914. t11 += v * b8;
  37915. t12 += v * b9;
  37916. t13 += v * b10;
  37917. t14 += v * b11;
  37918. t15 += v * b12;
  37919. t16 += v * b13;
  37920. t17 += v * b14;
  37921. t18 += v * b15;
  37922. v = a[4];
  37923. t4 += v * b0;
  37924. t5 += v * b1;
  37925. t6 += v * b2;
  37926. t7 += v * b3;
  37927. t8 += v * b4;
  37928. t9 += v * b5;
  37929. t10 += v * b6;
  37930. t11 += v * b7;
  37931. t12 += v * b8;
  37932. t13 += v * b9;
  37933. t14 += v * b10;
  37934. t15 += v * b11;
  37935. t16 += v * b12;
  37936. t17 += v * b13;
  37937. t18 += v * b14;
  37938. t19 += v * b15;
  37939. v = a[5];
  37940. t5 += v * b0;
  37941. t6 += v * b1;
  37942. t7 += v * b2;
  37943. t8 += v * b3;
  37944. t9 += v * b4;
  37945. t10 += v * b5;
  37946. t11 += v * b6;
  37947. t12 += v * b7;
  37948. t13 += v * b8;
  37949. t14 += v * b9;
  37950. t15 += v * b10;
  37951. t16 += v * b11;
  37952. t17 += v * b12;
  37953. t18 += v * b13;
  37954. t19 += v * b14;
  37955. t20 += v * b15;
  37956. v = a[6];
  37957. t6 += v * b0;
  37958. t7 += v * b1;
  37959. t8 += v * b2;
  37960. t9 += v * b3;
  37961. t10 += v * b4;
  37962. t11 += v * b5;
  37963. t12 += v * b6;
  37964. t13 += v * b7;
  37965. t14 += v * b8;
  37966. t15 += v * b9;
  37967. t16 += v * b10;
  37968. t17 += v * b11;
  37969. t18 += v * b12;
  37970. t19 += v * b13;
  37971. t20 += v * b14;
  37972. t21 += v * b15;
  37973. v = a[7];
  37974. t7 += v * b0;
  37975. t8 += v * b1;
  37976. t9 += v * b2;
  37977. t10 += v * b3;
  37978. t11 += v * b4;
  37979. t12 += v * b5;
  37980. t13 += v * b6;
  37981. t14 += v * b7;
  37982. t15 += v * b8;
  37983. t16 += v * b9;
  37984. t17 += v * b10;
  37985. t18 += v * b11;
  37986. t19 += v * b12;
  37987. t20 += v * b13;
  37988. t21 += v * b14;
  37989. t22 += v * b15;
  37990. v = a[8];
  37991. t8 += v * b0;
  37992. t9 += v * b1;
  37993. t10 += v * b2;
  37994. t11 += v * b3;
  37995. t12 += v * b4;
  37996. t13 += v * b5;
  37997. t14 += v * b6;
  37998. t15 += v * b7;
  37999. t16 += v * b8;
  38000. t17 += v * b9;
  38001. t18 += v * b10;
  38002. t19 += v * b11;
  38003. t20 += v * b12;
  38004. t21 += v * b13;
  38005. t22 += v * b14;
  38006. t23 += v * b15;
  38007. v = a[9];
  38008. t9 += v * b0;
  38009. t10 += v * b1;
  38010. t11 += v * b2;
  38011. t12 += v * b3;
  38012. t13 += v * b4;
  38013. t14 += v * b5;
  38014. t15 += v * b6;
  38015. t16 += v * b7;
  38016. t17 += v * b8;
  38017. t18 += v * b9;
  38018. t19 += v * b10;
  38019. t20 += v * b11;
  38020. t21 += v * b12;
  38021. t22 += v * b13;
  38022. t23 += v * b14;
  38023. t24 += v * b15;
  38024. v = a[10];
  38025. t10 += v * b0;
  38026. t11 += v * b1;
  38027. t12 += v * b2;
  38028. t13 += v * b3;
  38029. t14 += v * b4;
  38030. t15 += v * b5;
  38031. t16 += v * b6;
  38032. t17 += v * b7;
  38033. t18 += v * b8;
  38034. t19 += v * b9;
  38035. t20 += v * b10;
  38036. t21 += v * b11;
  38037. t22 += v * b12;
  38038. t23 += v * b13;
  38039. t24 += v * b14;
  38040. t25 += v * b15;
  38041. v = a[11];
  38042. t11 += v * b0;
  38043. t12 += v * b1;
  38044. t13 += v * b2;
  38045. t14 += v * b3;
  38046. t15 += v * b4;
  38047. t16 += v * b5;
  38048. t17 += v * b6;
  38049. t18 += v * b7;
  38050. t19 += v * b8;
  38051. t20 += v * b9;
  38052. t21 += v * b10;
  38053. t22 += v * b11;
  38054. t23 += v * b12;
  38055. t24 += v * b13;
  38056. t25 += v * b14;
  38057. t26 += v * b15;
  38058. v = a[12];
  38059. t12 += v * b0;
  38060. t13 += v * b1;
  38061. t14 += v * b2;
  38062. t15 += v * b3;
  38063. t16 += v * b4;
  38064. t17 += v * b5;
  38065. t18 += v * b6;
  38066. t19 += v * b7;
  38067. t20 += v * b8;
  38068. t21 += v * b9;
  38069. t22 += v * b10;
  38070. t23 += v * b11;
  38071. t24 += v * b12;
  38072. t25 += v * b13;
  38073. t26 += v * b14;
  38074. t27 += v * b15;
  38075. v = a[13];
  38076. t13 += v * b0;
  38077. t14 += v * b1;
  38078. t15 += v * b2;
  38079. t16 += v * b3;
  38080. t17 += v * b4;
  38081. t18 += v * b5;
  38082. t19 += v * b6;
  38083. t20 += v * b7;
  38084. t21 += v * b8;
  38085. t22 += v * b9;
  38086. t23 += v * b10;
  38087. t24 += v * b11;
  38088. t25 += v * b12;
  38089. t26 += v * b13;
  38090. t27 += v * b14;
  38091. t28 += v * b15;
  38092. v = a[14];
  38093. t14 += v * b0;
  38094. t15 += v * b1;
  38095. t16 += v * b2;
  38096. t17 += v * b3;
  38097. t18 += v * b4;
  38098. t19 += v * b5;
  38099. t20 += v * b6;
  38100. t21 += v * b7;
  38101. t22 += v * b8;
  38102. t23 += v * b9;
  38103. t24 += v * b10;
  38104. t25 += v * b11;
  38105. t26 += v * b12;
  38106. t27 += v * b13;
  38107. t28 += v * b14;
  38108. t29 += v * b15;
  38109. v = a[15];
  38110. t15 += v * b0;
  38111. t16 += v * b1;
  38112. t17 += v * b2;
  38113. t18 += v * b3;
  38114. t19 += v * b4;
  38115. t20 += v * b5;
  38116. t21 += v * b6;
  38117. t22 += v * b7;
  38118. t23 += v * b8;
  38119. t24 += v * b9;
  38120. t25 += v * b10;
  38121. t26 += v * b11;
  38122. t27 += v * b12;
  38123. t28 += v * b13;
  38124. t29 += v * b14;
  38125. t30 += v * b15;
  38126. t0 += 38 * t16;
  38127. t1 += 38 * t17;
  38128. t2 += 38 * t18;
  38129. t3 += 38 * t19;
  38130. t4 += 38 * t20;
  38131. t5 += 38 * t21;
  38132. t6 += 38 * t22;
  38133. t7 += 38 * t23;
  38134. t8 += 38 * t24;
  38135. t9 += 38 * t25;
  38136. t10 += 38 * t26;
  38137. t11 += 38 * t27;
  38138. t12 += 38 * t28;
  38139. t13 += 38 * t29;
  38140. t14 += 38 * t30;
  38141. // t15 left as is
  38142. // first car
  38143. c = 1;
  38144. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38145. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38146. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38147. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38148. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38149. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38150. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38151. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38152. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38153. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38154. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38155. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38156. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38157. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38158. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38159. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38160. t0 += c-1 + 37 * (c-1);
  38161. // second car
  38162. c = 1;
  38163. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38164. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38165. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38166. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38167. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38168. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38169. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38170. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38171. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38172. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38173. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38174. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38175. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38176. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38177. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38178. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38179. t0 += c-1 + 37 * (c-1);
  38180. o[ 0] = t0;
  38181. o[ 1] = t1;
  38182. o[ 2] = t2;
  38183. o[ 3] = t3;
  38184. o[ 4] = t4;
  38185. o[ 5] = t5;
  38186. o[ 6] = t6;
  38187. o[ 7] = t7;
  38188. o[ 8] = t8;
  38189. o[ 9] = t9;
  38190. o[10] = t10;
  38191. o[11] = t11;
  38192. o[12] = t12;
  38193. o[13] = t13;
  38194. o[14] = t14;
  38195. o[15] = t15;
  38196. }
  38197. function S(o, a) {
  38198. M(o, a, a);
  38199. }
  38200. function inv25519(o, i) {
  38201. var c = gf();
  38202. var a;
  38203. for (a = 0; a < 16; a++) c[a] = i[a];
  38204. for (a = 253; a >= 0; a--) {
  38205. S(c, c);
  38206. if(a !== 2 && a !== 4) M(c, c, i);
  38207. }
  38208. for (a = 0; a < 16; a++) o[a] = c[a];
  38209. }
  38210. function pow2523(o, i) {
  38211. var c = gf();
  38212. var a;
  38213. for (a = 0; a < 16; a++) c[a] = i[a];
  38214. for (a = 250; a >= 0; a--) {
  38215. S(c, c);
  38216. if(a !== 1) M(c, c, i);
  38217. }
  38218. for (a = 0; a < 16; a++) o[a] = c[a];
  38219. }
  38220. function crypto_scalarmult(q, n, p) {
  38221. var z = new Uint8Array(32);
  38222. var x = new Float64Array(80), r, i;
  38223. var a = gf(), b = gf(), c = gf(),
  38224. d = gf(), e = gf(), f = gf();
  38225. for (i = 0; i < 31; i++) z[i] = n[i];
  38226. z[31]=(n[31]&127)|64;
  38227. z[0]&=248;
  38228. unpack25519(x,p);
  38229. for (i = 0; i < 16; i++) {
  38230. b[i]=x[i];
  38231. d[i]=a[i]=c[i]=0;
  38232. }
  38233. a[0]=d[0]=1;
  38234. for (i=254; i>=0; --i) {
  38235. r=(z[i>>>3]>>>(i&7))&1;
  38236. sel25519(a,b,r);
  38237. sel25519(c,d,r);
  38238. A(e,a,c);
  38239. Z(a,a,c);
  38240. A(c,b,d);
  38241. Z(b,b,d);
  38242. S(d,e);
  38243. S(f,a);
  38244. M(a,c,a);
  38245. M(c,b,e);
  38246. A(e,a,c);
  38247. Z(a,a,c);
  38248. S(b,a);
  38249. Z(c,d,f);
  38250. M(a,c,_121665);
  38251. A(a,a,d);
  38252. M(c,c,a);
  38253. M(a,d,f);
  38254. M(d,b,x);
  38255. S(b,e);
  38256. sel25519(a,b,r);
  38257. sel25519(c,d,r);
  38258. }
  38259. for (i = 0; i < 16; i++) {
  38260. x[i+16]=a[i];
  38261. x[i+32]=c[i];
  38262. x[i+48]=b[i];
  38263. x[i+64]=d[i];
  38264. }
  38265. var x32 = x.subarray(32);
  38266. var x16 = x.subarray(16);
  38267. inv25519(x32,x32);
  38268. M(x16,x16,x32);
  38269. pack25519(q,x16);
  38270. return 0;
  38271. }
  38272. function crypto_scalarmult_base(q, n) {
  38273. return crypto_scalarmult(q, n, _9);
  38274. }
  38275. function crypto_box_keypair(y, x) {
  38276. randombytes(x, 32);
  38277. return crypto_scalarmult_base(y, x);
  38278. }
  38279. function crypto_box_beforenm(k, y, x) {
  38280. var s = new Uint8Array(32);
  38281. crypto_scalarmult(s, x, y);
  38282. return crypto_core_hsalsa20(k, _0, s, sigma);
  38283. }
  38284. var crypto_box_afternm = crypto_secretbox;
  38285. var crypto_box_open_afternm = crypto_secretbox_open;
  38286. function crypto_box(c, m, d, n, y, x) {
  38287. var k = new Uint8Array(32);
  38288. crypto_box_beforenm(k, y, x);
  38289. return crypto_box_afternm(c, m, d, n, k);
  38290. }
  38291. function crypto_box_open(m, c, d, n, y, x) {
  38292. var k = new Uint8Array(32);
  38293. crypto_box_beforenm(k, y, x);
  38294. return crypto_box_open_afternm(m, c, d, n, k);
  38295. }
  38296. var K = [
  38297. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38298. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38299. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38300. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38301. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38302. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38303. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38304. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38305. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38306. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38307. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38308. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38309. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38310. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38311. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38312. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38313. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38314. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38315. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38316. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38317. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38318. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38319. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38320. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38321. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38322. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38323. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38324. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38325. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38326. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38327. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38328. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38329. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38330. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38331. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38332. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38333. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38334. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38335. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38336. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38337. ];
  38338. function crypto_hashblocks_hl(hh, hl, m, n) {
  38339. var wh = new Int32Array(16), wl = new Int32Array(16),
  38340. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38341. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38342. th, tl, i, j, h, l, a, b, c, d;
  38343. var ah0 = hh[0],
  38344. ah1 = hh[1],
  38345. ah2 = hh[2],
  38346. ah3 = hh[3],
  38347. ah4 = hh[4],
  38348. ah5 = hh[5],
  38349. ah6 = hh[6],
  38350. ah7 = hh[7],
  38351. al0 = hl[0],
  38352. al1 = hl[1],
  38353. al2 = hl[2],
  38354. al3 = hl[3],
  38355. al4 = hl[4],
  38356. al5 = hl[5],
  38357. al6 = hl[6],
  38358. al7 = hl[7];
  38359. var pos = 0;
  38360. while (n >= 128) {
  38361. for (i = 0; i < 16; i++) {
  38362. j = 8 * i + pos;
  38363. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38364. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38365. }
  38366. for (i = 0; i < 80; i++) {
  38367. bh0 = ah0;
  38368. bh1 = ah1;
  38369. bh2 = ah2;
  38370. bh3 = ah3;
  38371. bh4 = ah4;
  38372. bh5 = ah5;
  38373. bh6 = ah6;
  38374. bh7 = ah7;
  38375. bl0 = al0;
  38376. bl1 = al1;
  38377. bl2 = al2;
  38378. bl3 = al3;
  38379. bl4 = al4;
  38380. bl5 = al5;
  38381. bl6 = al6;
  38382. bl7 = al7;
  38383. // add
  38384. h = ah7;
  38385. l = al7;
  38386. a = l & 0xffff; b = l >>> 16;
  38387. c = h & 0xffff; d = h >>> 16;
  38388. // Sigma1
  38389. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38390. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38391. a += l & 0xffff; b += l >>> 16;
  38392. c += h & 0xffff; d += h >>> 16;
  38393. // Ch
  38394. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38395. l = (al4 & al5) ^ (~al4 & al6);
  38396. a += l & 0xffff; b += l >>> 16;
  38397. c += h & 0xffff; d += h >>> 16;
  38398. // K
  38399. h = K[i*2];
  38400. l = K[i*2+1];
  38401. a += l & 0xffff; b += l >>> 16;
  38402. c += h & 0xffff; d += h >>> 16;
  38403. // w
  38404. h = wh[i%16];
  38405. l = wl[i%16];
  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. th = c & 0xffff | d << 16;
  38412. tl = a & 0xffff | b << 16;
  38413. // add
  38414. h = th;
  38415. l = tl;
  38416. a = l & 0xffff; b = l >>> 16;
  38417. c = h & 0xffff; d = h >>> 16;
  38418. // Sigma0
  38419. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38420. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38421. a += l & 0xffff; b += l >>> 16;
  38422. c += h & 0xffff; d += h >>> 16;
  38423. // Maj
  38424. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38425. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38426. a += l & 0xffff; b += l >>> 16;
  38427. c += h & 0xffff; d += h >>> 16;
  38428. b += a >>> 16;
  38429. c += b >>> 16;
  38430. d += c >>> 16;
  38431. bh7 = (c & 0xffff) | (d << 16);
  38432. bl7 = (a & 0xffff) | (b << 16);
  38433. // add
  38434. h = bh3;
  38435. l = bl3;
  38436. a = l & 0xffff; b = l >>> 16;
  38437. c = h & 0xffff; d = h >>> 16;
  38438. h = th;
  38439. l = tl;
  38440. a += l & 0xffff; b += l >>> 16;
  38441. c += h & 0xffff; d += h >>> 16;
  38442. b += a >>> 16;
  38443. c += b >>> 16;
  38444. d += c >>> 16;
  38445. bh3 = (c & 0xffff) | (d << 16);
  38446. bl3 = (a & 0xffff) | (b << 16);
  38447. ah1 = bh0;
  38448. ah2 = bh1;
  38449. ah3 = bh2;
  38450. ah4 = bh3;
  38451. ah5 = bh4;
  38452. ah6 = bh5;
  38453. ah7 = bh6;
  38454. ah0 = bh7;
  38455. al1 = bl0;
  38456. al2 = bl1;
  38457. al3 = bl2;
  38458. al4 = bl3;
  38459. al5 = bl4;
  38460. al6 = bl5;
  38461. al7 = bl6;
  38462. al0 = bl7;
  38463. if (i%16 === 15) {
  38464. for (j = 0; j < 16; j++) {
  38465. // add
  38466. h = wh[j];
  38467. l = wl[j];
  38468. a = l & 0xffff; b = l >>> 16;
  38469. c = h & 0xffff; d = h >>> 16;
  38470. h = wh[(j+9)%16];
  38471. l = wl[(j+9)%16];
  38472. a += l & 0xffff; b += l >>> 16;
  38473. c += h & 0xffff; d += h >>> 16;
  38474. // sigma0
  38475. th = wh[(j+1)%16];
  38476. tl = wl[(j+1)%16];
  38477. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38478. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38479. a += l & 0xffff; b += l >>> 16;
  38480. c += h & 0xffff; d += h >>> 16;
  38481. // sigma1
  38482. th = wh[(j+14)%16];
  38483. tl = wl[(j+14)%16];
  38484. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38485. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38486. a += l & 0xffff; b += l >>> 16;
  38487. c += h & 0xffff; d += h >>> 16;
  38488. b += a >>> 16;
  38489. c += b >>> 16;
  38490. d += c >>> 16;
  38491. wh[j] = (c & 0xffff) | (d << 16);
  38492. wl[j] = (a & 0xffff) | (b << 16);
  38493. }
  38494. }
  38495. }
  38496. // add
  38497. h = ah0;
  38498. l = al0;
  38499. a = l & 0xffff; b = l >>> 16;
  38500. c = h & 0xffff; d = h >>> 16;
  38501. h = hh[0];
  38502. l = hl[0];
  38503. a += l & 0xffff; b += l >>> 16;
  38504. c += h & 0xffff; d += h >>> 16;
  38505. b += a >>> 16;
  38506. c += b >>> 16;
  38507. d += c >>> 16;
  38508. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38509. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38510. h = ah1;
  38511. l = al1;
  38512. a = l & 0xffff; b = l >>> 16;
  38513. c = h & 0xffff; d = h >>> 16;
  38514. h = hh[1];
  38515. l = hl[1];
  38516. a += l & 0xffff; b += l >>> 16;
  38517. c += h & 0xffff; d += h >>> 16;
  38518. b += a >>> 16;
  38519. c += b >>> 16;
  38520. d += c >>> 16;
  38521. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38522. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38523. h = ah2;
  38524. l = al2;
  38525. a = l & 0xffff; b = l >>> 16;
  38526. c = h & 0xffff; d = h >>> 16;
  38527. h = hh[2];
  38528. l = hl[2];
  38529. a += l & 0xffff; b += l >>> 16;
  38530. c += h & 0xffff; d += h >>> 16;
  38531. b += a >>> 16;
  38532. c += b >>> 16;
  38533. d += c >>> 16;
  38534. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38535. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38536. h = ah3;
  38537. l = al3;
  38538. a = l & 0xffff; b = l >>> 16;
  38539. c = h & 0xffff; d = h >>> 16;
  38540. h = hh[3];
  38541. l = hl[3];
  38542. a += l & 0xffff; b += l >>> 16;
  38543. c += h & 0xffff; d += h >>> 16;
  38544. b += a >>> 16;
  38545. c += b >>> 16;
  38546. d += c >>> 16;
  38547. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38548. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38549. h = ah4;
  38550. l = al4;
  38551. a = l & 0xffff; b = l >>> 16;
  38552. c = h & 0xffff; d = h >>> 16;
  38553. h = hh[4];
  38554. l = hl[4];
  38555. a += l & 0xffff; b += l >>> 16;
  38556. c += h & 0xffff; d += h >>> 16;
  38557. b += a >>> 16;
  38558. c += b >>> 16;
  38559. d += c >>> 16;
  38560. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38561. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38562. h = ah5;
  38563. l = al5;
  38564. a = l & 0xffff; b = l >>> 16;
  38565. c = h & 0xffff; d = h >>> 16;
  38566. h = hh[5];
  38567. l = hl[5];
  38568. a += l & 0xffff; b += l >>> 16;
  38569. c += h & 0xffff; d += h >>> 16;
  38570. b += a >>> 16;
  38571. c += b >>> 16;
  38572. d += c >>> 16;
  38573. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38574. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38575. h = ah6;
  38576. l = al6;
  38577. a = l & 0xffff; b = l >>> 16;
  38578. c = h & 0xffff; d = h >>> 16;
  38579. h = hh[6];
  38580. l = hl[6];
  38581. a += l & 0xffff; b += l >>> 16;
  38582. c += h & 0xffff; d += h >>> 16;
  38583. b += a >>> 16;
  38584. c += b >>> 16;
  38585. d += c >>> 16;
  38586. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38587. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38588. h = ah7;
  38589. l = al7;
  38590. a = l & 0xffff; b = l >>> 16;
  38591. c = h & 0xffff; d = h >>> 16;
  38592. h = hh[7];
  38593. l = hl[7];
  38594. a += l & 0xffff; b += l >>> 16;
  38595. c += h & 0xffff; d += h >>> 16;
  38596. b += a >>> 16;
  38597. c += b >>> 16;
  38598. d += c >>> 16;
  38599. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38600. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38601. pos += 128;
  38602. n -= 128;
  38603. }
  38604. return n;
  38605. }
  38606. function crypto_hash(out, m, n) {
  38607. var hh = new Int32Array(8),
  38608. hl = new Int32Array(8),
  38609. x = new Uint8Array(256),
  38610. i, b = n;
  38611. hh[0] = 0x6a09e667;
  38612. hh[1] = 0xbb67ae85;
  38613. hh[2] = 0x3c6ef372;
  38614. hh[3] = 0xa54ff53a;
  38615. hh[4] = 0x510e527f;
  38616. hh[5] = 0x9b05688c;
  38617. hh[6] = 0x1f83d9ab;
  38618. hh[7] = 0x5be0cd19;
  38619. hl[0] = 0xf3bcc908;
  38620. hl[1] = 0x84caa73b;
  38621. hl[2] = 0xfe94f82b;
  38622. hl[3] = 0x5f1d36f1;
  38623. hl[4] = 0xade682d1;
  38624. hl[5] = 0x2b3e6c1f;
  38625. hl[6] = 0xfb41bd6b;
  38626. hl[7] = 0x137e2179;
  38627. crypto_hashblocks_hl(hh, hl, m, n);
  38628. n %= 128;
  38629. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38630. x[n] = 128;
  38631. n = 256-128*(n<112?1:0);
  38632. x[n-9] = 0;
  38633. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38634. crypto_hashblocks_hl(hh, hl, x, n);
  38635. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38636. return 0;
  38637. }
  38638. function add(p, q) {
  38639. var a = gf(), b = gf(), c = gf(),
  38640. d = gf(), e = gf(), f = gf(),
  38641. g = gf(), h = gf(), t = gf();
  38642. Z(a, p[1], p[0]);
  38643. Z(t, q[1], q[0]);
  38644. M(a, a, t);
  38645. A(b, p[0], p[1]);
  38646. A(t, q[0], q[1]);
  38647. M(b, b, t);
  38648. M(c, p[3], q[3]);
  38649. M(c, c, D2);
  38650. M(d, p[2], q[2]);
  38651. A(d, d, d);
  38652. Z(e, b, a);
  38653. Z(f, d, c);
  38654. A(g, d, c);
  38655. A(h, b, a);
  38656. M(p[0], e, f);
  38657. M(p[1], h, g);
  38658. M(p[2], g, f);
  38659. M(p[3], e, h);
  38660. }
  38661. function cswap(p, q, b) {
  38662. var i;
  38663. for (i = 0; i < 4; i++) {
  38664. sel25519(p[i], q[i], b);
  38665. }
  38666. }
  38667. function pack(r, p) {
  38668. var tx = gf(), ty = gf(), zi = gf();
  38669. inv25519(zi, p[2]);
  38670. M(tx, p[0], zi);
  38671. M(ty, p[1], zi);
  38672. pack25519(r, ty);
  38673. r[31] ^= par25519(tx) << 7;
  38674. }
  38675. function scalarmult(p, q, s) {
  38676. var b, i;
  38677. set25519(p[0], gf0);
  38678. set25519(p[1], gf1);
  38679. set25519(p[2], gf1);
  38680. set25519(p[3], gf0);
  38681. for (i = 255; i >= 0; --i) {
  38682. b = (s[(i/8)|0] >> (i&7)) & 1;
  38683. cswap(p, q, b);
  38684. add(q, p);
  38685. add(p, p);
  38686. cswap(p, q, b);
  38687. }
  38688. }
  38689. function scalarbase(p, s) {
  38690. var q = [gf(), gf(), gf(), gf()];
  38691. set25519(q[0], X);
  38692. set25519(q[1], Y);
  38693. set25519(q[2], gf1);
  38694. M(q[3], X, Y);
  38695. scalarmult(p, q, s);
  38696. }
  38697. function crypto_sign_keypair(pk, sk, seeded) {
  38698. var d = new Uint8Array(64);
  38699. var p = [gf(), gf(), gf(), gf()];
  38700. var i;
  38701. if (!seeded) randombytes(sk, 32);
  38702. crypto_hash(d, sk, 32);
  38703. d[0] &= 248;
  38704. d[31] &= 127;
  38705. d[31] |= 64;
  38706. scalarbase(p, d);
  38707. pack(pk, p);
  38708. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38709. return 0;
  38710. }
  38711. 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]);
  38712. function modL(r, x) {
  38713. var carry, i, j, k;
  38714. for (i = 63; i >= 32; --i) {
  38715. carry = 0;
  38716. for (j = i - 32, k = i - 12; j < k; ++j) {
  38717. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38718. carry = (x[j] + 128) >> 8;
  38719. x[j] -= carry * 256;
  38720. }
  38721. x[j] += carry;
  38722. x[i] = 0;
  38723. }
  38724. carry = 0;
  38725. for (j = 0; j < 32; j++) {
  38726. x[j] += carry - (x[31] >> 4) * L[j];
  38727. carry = x[j] >> 8;
  38728. x[j] &= 255;
  38729. }
  38730. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38731. for (i = 0; i < 32; i++) {
  38732. x[i+1] += x[i] >> 8;
  38733. r[i] = x[i] & 255;
  38734. }
  38735. }
  38736. function reduce(r) {
  38737. var x = new Float64Array(64), i;
  38738. for (i = 0; i < 64; i++) x[i] = r[i];
  38739. for (i = 0; i < 64; i++) r[i] = 0;
  38740. modL(r, x);
  38741. }
  38742. // Note: difference from C - smlen returned, not passed as argument.
  38743. function crypto_sign(sm, m, n, sk) {
  38744. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38745. var i, j, x = new Float64Array(64);
  38746. var p = [gf(), gf(), gf(), gf()];
  38747. crypto_hash(d, sk, 32);
  38748. d[0] &= 248;
  38749. d[31] &= 127;
  38750. d[31] |= 64;
  38751. var smlen = n + 64;
  38752. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38753. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38754. crypto_hash(r, sm.subarray(32), n+32);
  38755. reduce(r);
  38756. scalarbase(p, r);
  38757. pack(sm, p);
  38758. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38759. crypto_hash(h, sm, n + 64);
  38760. reduce(h);
  38761. for (i = 0; i < 64; i++) x[i] = 0;
  38762. for (i = 0; i < 32; i++) x[i] = r[i];
  38763. for (i = 0; i < 32; i++) {
  38764. for (j = 0; j < 32; j++) {
  38765. x[i+j] += h[i] * d[j];
  38766. }
  38767. }
  38768. modL(sm.subarray(32), x);
  38769. return smlen;
  38770. }
  38771. function unpackneg(r, p) {
  38772. var t = gf(), chk = gf(), num = gf(),
  38773. den = gf(), den2 = gf(), den4 = gf(),
  38774. den6 = gf();
  38775. set25519(r[2], gf1);
  38776. unpack25519(r[1], p);
  38777. S(num, r[1]);
  38778. M(den, num, D);
  38779. Z(num, num, r[2]);
  38780. A(den, r[2], den);
  38781. S(den2, den);
  38782. S(den4, den2);
  38783. M(den6, den4, den2);
  38784. M(t, den6, num);
  38785. M(t, t, den);
  38786. pow2523(t, t);
  38787. M(t, t, num);
  38788. M(t, t, den);
  38789. M(t, t, den);
  38790. M(r[0], t, den);
  38791. S(chk, r[0]);
  38792. M(chk, chk, den);
  38793. if (neq25519(chk, num)) M(r[0], r[0], I);
  38794. S(chk, r[0]);
  38795. M(chk, chk, den);
  38796. if (neq25519(chk, num)) return -1;
  38797. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38798. M(r[3], r[0], r[1]);
  38799. return 0;
  38800. }
  38801. function crypto_sign_open(m, sm, n, pk) {
  38802. var i, mlen;
  38803. var t = new Uint8Array(32), h = new Uint8Array(64);
  38804. var p = [gf(), gf(), gf(), gf()],
  38805. q = [gf(), gf(), gf(), gf()];
  38806. mlen = -1;
  38807. if (n < 64) return -1;
  38808. if (unpackneg(q, pk)) return -1;
  38809. for (i = 0; i < n; i++) m[i] = sm[i];
  38810. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38811. crypto_hash(h, m, n);
  38812. reduce(h);
  38813. scalarmult(p, q, h);
  38814. scalarbase(q, sm.subarray(32));
  38815. add(p, q);
  38816. pack(t, p);
  38817. n -= 64;
  38818. if (crypto_verify_32(sm, 0, t, 0)) {
  38819. for (i = 0; i < n; i++) m[i] = 0;
  38820. return -1;
  38821. }
  38822. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38823. mlen = n;
  38824. return mlen;
  38825. }
  38826. var crypto_secretbox_KEYBYTES = 32,
  38827. crypto_secretbox_NONCEBYTES = 24,
  38828. crypto_secretbox_ZEROBYTES = 32,
  38829. crypto_secretbox_BOXZEROBYTES = 16,
  38830. crypto_scalarmult_BYTES = 32,
  38831. crypto_scalarmult_SCALARBYTES = 32,
  38832. crypto_box_PUBLICKEYBYTES = 32,
  38833. crypto_box_SECRETKEYBYTES = 32,
  38834. crypto_box_BEFORENMBYTES = 32,
  38835. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38836. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38837. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38838. crypto_sign_BYTES = 64,
  38839. crypto_sign_PUBLICKEYBYTES = 32,
  38840. crypto_sign_SECRETKEYBYTES = 64,
  38841. crypto_sign_SEEDBYTES = 32,
  38842. crypto_hash_BYTES = 64;
  38843. nacl.lowlevel = {
  38844. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38845. crypto_stream_xor: crypto_stream_xor,
  38846. crypto_stream: crypto_stream,
  38847. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38848. crypto_stream_salsa20: crypto_stream_salsa20,
  38849. crypto_onetimeauth: crypto_onetimeauth,
  38850. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38851. crypto_verify_16: crypto_verify_16,
  38852. crypto_verify_32: crypto_verify_32,
  38853. crypto_secretbox: crypto_secretbox,
  38854. crypto_secretbox_open: crypto_secretbox_open,
  38855. crypto_scalarmult: crypto_scalarmult,
  38856. crypto_scalarmult_base: crypto_scalarmult_base,
  38857. crypto_box_beforenm: crypto_box_beforenm,
  38858. crypto_box_afternm: crypto_box_afternm,
  38859. crypto_box: crypto_box,
  38860. crypto_box_open: crypto_box_open,
  38861. crypto_box_keypair: crypto_box_keypair,
  38862. crypto_hash: crypto_hash,
  38863. crypto_sign: crypto_sign,
  38864. crypto_sign_keypair: crypto_sign_keypair,
  38865. crypto_sign_open: crypto_sign_open,
  38866. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38867. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38868. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38869. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38870. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38871. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38872. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38873. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38874. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38875. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38876. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38877. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38878. crypto_sign_BYTES: crypto_sign_BYTES,
  38879. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38880. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38881. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38882. crypto_hash_BYTES: crypto_hash_BYTES
  38883. };
  38884. /* High-level API */
  38885. function checkLengths(k, n) {
  38886. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38887. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38888. }
  38889. function checkBoxLengths(pk, sk) {
  38890. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38891. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38892. }
  38893. function checkArrayTypes() {
  38894. for (var i = 0; i < arguments.length; i++) {
  38895. if (!(arguments[i] instanceof Uint8Array))
  38896. throw new TypeError('unexpected type, use Uint8Array');
  38897. }
  38898. }
  38899. function cleanup(arr) {
  38900. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38901. }
  38902. nacl.randomBytes = function(n) {
  38903. var b = new Uint8Array(n);
  38904. randombytes(b, n);
  38905. return b;
  38906. };
  38907. nacl.secretbox = function(msg, nonce, key) {
  38908. checkArrayTypes(msg, nonce, key);
  38909. checkLengths(key, nonce);
  38910. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38911. var c = new Uint8Array(m.length);
  38912. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38913. crypto_secretbox(c, m, m.length, nonce, key);
  38914. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38915. };
  38916. nacl.secretbox.open = function(box, nonce, key) {
  38917. checkArrayTypes(box, nonce, key);
  38918. checkLengths(key, nonce);
  38919. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38920. var m = new Uint8Array(c.length);
  38921. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38922. if (c.length < 32) return null;
  38923. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38924. return m.subarray(crypto_secretbox_ZEROBYTES);
  38925. };
  38926. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38927. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38928. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38929. nacl.scalarMult = function(n, p) {
  38930. checkArrayTypes(n, p);
  38931. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38932. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38933. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38934. crypto_scalarmult(q, n, p);
  38935. return q;
  38936. };
  38937. nacl.scalarMult.base = function(n) {
  38938. checkArrayTypes(n);
  38939. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38940. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38941. crypto_scalarmult_base(q, n);
  38942. return q;
  38943. };
  38944. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38945. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38946. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38947. var k = nacl.box.before(publicKey, secretKey);
  38948. return nacl.secretbox(msg, nonce, k);
  38949. };
  38950. nacl.box.before = function(publicKey, secretKey) {
  38951. checkArrayTypes(publicKey, secretKey);
  38952. checkBoxLengths(publicKey, secretKey);
  38953. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38954. crypto_box_beforenm(k, publicKey, secretKey);
  38955. return k;
  38956. };
  38957. nacl.box.after = nacl.secretbox;
  38958. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38959. var k = nacl.box.before(publicKey, secretKey);
  38960. return nacl.secretbox.open(msg, nonce, k);
  38961. };
  38962. nacl.box.open.after = nacl.secretbox.open;
  38963. nacl.box.keyPair = function() {
  38964. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38965. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38966. crypto_box_keypair(pk, sk);
  38967. return {publicKey: pk, secretKey: sk};
  38968. };
  38969. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38970. checkArrayTypes(secretKey);
  38971. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38972. throw new Error('bad secret key size');
  38973. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38974. crypto_scalarmult_base(pk, secretKey);
  38975. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38976. };
  38977. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38978. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38979. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38980. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38981. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38982. nacl.sign = function(msg, secretKey) {
  38983. checkArrayTypes(msg, secretKey);
  38984. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38985. throw new Error('bad secret key size');
  38986. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38987. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38988. return signedMsg;
  38989. };
  38990. nacl.sign.open = function(signedMsg, publicKey) {
  38991. checkArrayTypes(signedMsg, publicKey);
  38992. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38993. throw new Error('bad public key size');
  38994. var tmp = new Uint8Array(signedMsg.length);
  38995. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38996. if (mlen < 0) return null;
  38997. var m = new Uint8Array(mlen);
  38998. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38999. return m;
  39000. };
  39001. nacl.sign.detached = function(msg, secretKey) {
  39002. var signedMsg = nacl.sign(msg, secretKey);
  39003. var sig = new Uint8Array(crypto_sign_BYTES);
  39004. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39005. return sig;
  39006. };
  39007. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39008. checkArrayTypes(msg, sig, publicKey);
  39009. if (sig.length !== crypto_sign_BYTES)
  39010. throw new Error('bad signature size');
  39011. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39012. throw new Error('bad public key size');
  39013. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39014. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39015. var i;
  39016. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39017. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39018. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39019. };
  39020. nacl.sign.keyPair = function() {
  39021. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39022. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39023. crypto_sign_keypair(pk, sk);
  39024. return {publicKey: pk, secretKey: sk};
  39025. };
  39026. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39027. checkArrayTypes(secretKey);
  39028. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39029. throw new Error('bad secret key size');
  39030. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39031. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39032. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39033. };
  39034. nacl.sign.keyPair.fromSeed = function(seed) {
  39035. checkArrayTypes(seed);
  39036. if (seed.length !== crypto_sign_SEEDBYTES)
  39037. throw new Error('bad seed size');
  39038. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39039. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39040. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39041. crypto_sign_keypair(pk, sk, true);
  39042. return {publicKey: pk, secretKey: sk};
  39043. };
  39044. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39045. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39046. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39047. nacl.sign.signatureLength = crypto_sign_BYTES;
  39048. nacl.hash = function(msg) {
  39049. checkArrayTypes(msg);
  39050. var h = new Uint8Array(crypto_hash_BYTES);
  39051. crypto_hash(h, msg, msg.length);
  39052. return h;
  39053. };
  39054. nacl.hash.hashLength = crypto_hash_BYTES;
  39055. nacl.verify = function(x, y) {
  39056. checkArrayTypes(x, y);
  39057. // Zero length arguments are considered not equal.
  39058. if (x.length === 0 || y.length === 0) return false;
  39059. if (x.length !== y.length) return false;
  39060. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39061. };
  39062. nacl.setPRNG = function(fn) {
  39063. randombytes = fn;
  39064. };
  39065. (function() {
  39066. // Initialize PRNG if environment provides CSPRNG.
  39067. // If not, methods calling randombytes will throw.
  39068. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39069. if (crypto && crypto.getRandomValues) {
  39070. // Browsers.
  39071. var QUOTA = 65536;
  39072. nacl.setPRNG(function(x, n) {
  39073. var i, v = new Uint8Array(n);
  39074. for (i = 0; i < n; i += QUOTA) {
  39075. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39076. }
  39077. for (i = 0; i < n; i++) x[i] = v[i];
  39078. cleanup(v);
  39079. });
  39080. } else if (true) {
  39081. // Node.js.
  39082. crypto = __webpack_require__(3);
  39083. if (crypto && crypto.randomBytes) {
  39084. nacl.setPRNG(function(x, n) {
  39085. var i, v = crypto.randomBytes(n);
  39086. for (i = 0; i < n; i++) x[i] = v[i];
  39087. cleanup(v);
  39088. });
  39089. }
  39090. }
  39091. })();
  39092. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39093. /***/ }),
  39094. /* 1 */
  39095. /***/ (function(module, exports, __webpack_require__) {
  39096. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39097. // Public domain.
  39098. (function(root, f) {
  39099. 'use strict';
  39100. if ( true && module.exports) module.exports = f();
  39101. else if (root.nacl) root.nacl.util = f();
  39102. else {
  39103. root.nacl = {};
  39104. root.nacl.util = f();
  39105. }
  39106. }(this, function() {
  39107. 'use strict';
  39108. var util = {};
  39109. function validateBase64(s) {
  39110. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39111. throw new TypeError('invalid encoding');
  39112. }
  39113. }
  39114. util.decodeUTF8 = function(s) {
  39115. if (typeof s !== 'string') throw new TypeError('expected string');
  39116. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39117. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39118. return b;
  39119. };
  39120. util.encodeUTF8 = function(arr) {
  39121. var i, s = [];
  39122. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39123. return decodeURIComponent(escape(s.join('')));
  39124. };
  39125. if (typeof atob === 'undefined') {
  39126. // Node.js
  39127. if (typeof Buffer.from !== 'undefined') {
  39128. // Node v6 and later
  39129. util.encodeBase64 = function (arr) { // v6 and later
  39130. return Buffer.from(arr).toString('base64');
  39131. };
  39132. util.decodeBase64 = function (s) {
  39133. validateBase64(s);
  39134. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39135. };
  39136. } else {
  39137. // Node earlier than v6
  39138. util.encodeBase64 = function (arr) { // v6 and later
  39139. return (new Buffer(arr)).toString('base64');
  39140. };
  39141. util.decodeBase64 = function(s) {
  39142. validateBase64(s);
  39143. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39144. };
  39145. }
  39146. } else {
  39147. // Browsers
  39148. util.encodeBase64 = function(arr) {
  39149. var i, s = [], len = arr.length;
  39150. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39151. return btoa(s.join(''));
  39152. };
  39153. util.decodeBase64 = function(s) {
  39154. validateBase64(s);
  39155. var i, d = atob(s), b = new Uint8Array(d.length);
  39156. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39157. return b;
  39158. };
  39159. }
  39160. return util;
  39161. }));
  39162. /***/ }),
  39163. /* 2 */
  39164. /***/ (function(module, exports, __webpack_require__) {
  39165. // required so we don't have to do require('pusher').default etc.
  39166. module.exports = __webpack_require__(4).default;
  39167. /***/ }),
  39168. /* 3 */
  39169. /***/ (function(module, exports) {
  39170. /* (ignored) */
  39171. /***/ }),
  39172. /* 4 */
  39173. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39174. "use strict";
  39175. __webpack_require__.r(__webpack_exports__);
  39176. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39177. var ScriptReceiverFactory = (function () {
  39178. function ScriptReceiverFactory(prefix, name) {
  39179. this.lastId = 0;
  39180. this.prefix = prefix;
  39181. this.name = name;
  39182. }
  39183. ScriptReceiverFactory.prototype.create = function (callback) {
  39184. this.lastId++;
  39185. var number = this.lastId;
  39186. var id = this.prefix + number;
  39187. var name = this.name + "[" + number + "]";
  39188. var called = false;
  39189. var callbackWrapper = function () {
  39190. if (!called) {
  39191. callback.apply(null, arguments);
  39192. called = true;
  39193. }
  39194. };
  39195. this[number] = callbackWrapper;
  39196. return { number: number, id: id, name: name, callback: callbackWrapper };
  39197. };
  39198. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39199. delete this[receiver.number];
  39200. };
  39201. return ScriptReceiverFactory;
  39202. }());
  39203. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39204. // CONCATENATED MODULE: ./src/core/defaults.ts
  39205. var Defaults = {
  39206. VERSION: "5.0.3",
  39207. PROTOCOL: 7,
  39208. host: 'ws.pusherapp.com',
  39209. ws_port: 80,
  39210. wss_port: 443,
  39211. ws_path: '',
  39212. sockjs_host: 'sockjs.pusher.com',
  39213. sockjs_http_port: 80,
  39214. sockjs_https_port: 443,
  39215. sockjs_path: '/pusher',
  39216. stats_host: 'stats.pusher.com',
  39217. channel_auth_endpoint: '/pusher/auth',
  39218. channel_auth_transport: 'ajax',
  39219. activity_timeout: 120000,
  39220. pong_timeout: 30000,
  39221. unavailable_timeout: 10000,
  39222. cdn_http: "http://js.pusher.com",
  39223. cdn_https: "https://js.pusher.com",
  39224. dependency_suffix: ""
  39225. };
  39226. /* harmony default export */ var defaults = (Defaults);
  39227. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39228. var dependency_loader_DependencyLoader = (function () {
  39229. function DependencyLoader(options) {
  39230. this.options = options;
  39231. this.receivers = options.receivers || ScriptReceivers;
  39232. this.loading = {};
  39233. }
  39234. DependencyLoader.prototype.load = function (name, options, callback) {
  39235. var self = this;
  39236. if (self.loading[name] && self.loading[name].length > 0) {
  39237. self.loading[name].push(callback);
  39238. }
  39239. else {
  39240. self.loading[name] = [callback];
  39241. var request = runtime.createScriptRequest(self.getPath(name, options));
  39242. var receiver = self.receivers.create(function (error) {
  39243. self.receivers.remove(receiver);
  39244. if (self.loading[name]) {
  39245. var callbacks = self.loading[name];
  39246. delete self.loading[name];
  39247. var successCallback = function (wasSuccessful) {
  39248. if (!wasSuccessful) {
  39249. request.cleanup();
  39250. }
  39251. };
  39252. for (var i = 0; i < callbacks.length; i++) {
  39253. callbacks[i](error, successCallback);
  39254. }
  39255. }
  39256. });
  39257. request.send(receiver);
  39258. }
  39259. };
  39260. DependencyLoader.prototype.getRoot = function (options) {
  39261. var cdn;
  39262. var protocol = runtime.getDocument().location.protocol;
  39263. if ((options && options.useTLS) || protocol === "https:") {
  39264. cdn = this.options.cdn_https;
  39265. }
  39266. else {
  39267. cdn = this.options.cdn_http;
  39268. }
  39269. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39270. };
  39271. DependencyLoader.prototype.getPath = function (name, options) {
  39272. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39273. };
  39274. ;
  39275. return DependencyLoader;
  39276. }());
  39277. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39278. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39279. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39280. var Dependencies = new dependency_loader({
  39281. cdn_http: defaults.cdn_http,
  39282. cdn_https: defaults.cdn_https,
  39283. version: defaults.VERSION,
  39284. suffix: defaults.dependency_suffix,
  39285. receivers: DependenciesReceivers
  39286. });
  39287. // CONCATENATED MODULE: ./src/core/base64.ts
  39288. function encode(s) {
  39289. return btoa(utob(s));
  39290. }
  39291. var fromCharCode = String.fromCharCode;
  39292. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39293. var b64tab = {};
  39294. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39295. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39296. }
  39297. var cb_utob = function (c) {
  39298. var cc = c.charCodeAt(0);
  39299. return cc < 0x80
  39300. ? c
  39301. : cc < 0x800
  39302. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39303. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39304. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39305. fromCharCode(0x80 | (cc & 0x3f));
  39306. };
  39307. var utob = function (u) {
  39308. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39309. };
  39310. var cb_encode = function (ccc) {
  39311. var padlen = [0, 2, 1][ccc.length % 3];
  39312. var ord = (ccc.charCodeAt(0) << 16) |
  39313. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39314. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39315. var chars = [
  39316. b64chars.charAt(ord >>> 18),
  39317. b64chars.charAt((ord >>> 12) & 63),
  39318. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39319. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39320. ];
  39321. return chars.join('');
  39322. };
  39323. var btoa = window.btoa ||
  39324. function (b) {
  39325. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39326. };
  39327. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39328. var Timer = (function () {
  39329. function Timer(set, clear, delay, callback) {
  39330. var _this = this;
  39331. this.clear = clear;
  39332. this.timer = set(function () {
  39333. if (_this.timer) {
  39334. _this.timer = callback(_this.timer);
  39335. }
  39336. }, delay);
  39337. }
  39338. Timer.prototype.isRunning = function () {
  39339. return this.timer !== null;
  39340. };
  39341. Timer.prototype.ensureAborted = function () {
  39342. if (this.timer) {
  39343. this.clear(this.timer);
  39344. this.timer = null;
  39345. }
  39346. };
  39347. return Timer;
  39348. }());
  39349. /* harmony default export */ var abstract_timer = (Timer);
  39350. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39351. var __extends = (undefined && undefined.__extends) || (function () {
  39352. var extendStatics = function (d, b) {
  39353. extendStatics = Object.setPrototypeOf ||
  39354. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39355. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39356. return extendStatics(d, b);
  39357. };
  39358. return function (d, b) {
  39359. extendStatics(d, b);
  39360. function __() { this.constructor = d; }
  39361. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39362. };
  39363. })();
  39364. function timers_clearTimeout(timer) {
  39365. window.clearTimeout(timer);
  39366. }
  39367. function timers_clearInterval(timer) {
  39368. window.clearInterval(timer);
  39369. }
  39370. var OneOffTimer = (function (_super) {
  39371. __extends(OneOffTimer, _super);
  39372. function OneOffTimer(delay, callback) {
  39373. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39374. callback();
  39375. return null;
  39376. }) || this;
  39377. }
  39378. return OneOffTimer;
  39379. }(abstract_timer));
  39380. var PeriodicTimer = (function (_super) {
  39381. __extends(PeriodicTimer, _super);
  39382. function PeriodicTimer(delay, callback) {
  39383. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39384. callback();
  39385. return timer;
  39386. }) || this;
  39387. }
  39388. return PeriodicTimer;
  39389. }(abstract_timer));
  39390. // CONCATENATED MODULE: ./src/core/util.ts
  39391. var Util = {
  39392. now: function () {
  39393. if (Date.now) {
  39394. return Date.now();
  39395. }
  39396. else {
  39397. return new Date().valueOf();
  39398. }
  39399. },
  39400. defer: function (callback) {
  39401. return new OneOffTimer(0, callback);
  39402. },
  39403. method: function (name) {
  39404. var args = [];
  39405. for (var _i = 1; _i < arguments.length; _i++) {
  39406. args[_i - 1] = arguments[_i];
  39407. }
  39408. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39409. return function (object) {
  39410. return object[name].apply(object, boundArguments.concat(arguments));
  39411. };
  39412. }
  39413. };
  39414. /* harmony default export */ var util = (Util);
  39415. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39416. function extend(target) {
  39417. var sources = [];
  39418. for (var _i = 1; _i < arguments.length; _i++) {
  39419. sources[_i - 1] = arguments[_i];
  39420. }
  39421. for (var i = 0; i < sources.length; i++) {
  39422. var extensions = sources[i];
  39423. for (var property in extensions) {
  39424. if (extensions[property] && extensions[property].constructor &&
  39425. extensions[property].constructor === Object) {
  39426. target[property] = extend(target[property] || {}, extensions[property]);
  39427. }
  39428. else {
  39429. target[property] = extensions[property];
  39430. }
  39431. }
  39432. }
  39433. return target;
  39434. }
  39435. function stringify() {
  39436. var m = ["Pusher"];
  39437. for (var i = 0; i < arguments.length; i++) {
  39438. if (typeof arguments[i] === "string") {
  39439. m.push(arguments[i]);
  39440. }
  39441. else {
  39442. m.push(safeJSONStringify(arguments[i]));
  39443. }
  39444. }
  39445. return m.join(" : ");
  39446. }
  39447. function arrayIndexOf(array, item) {
  39448. var nativeIndexOf = Array.prototype.indexOf;
  39449. if (array === null) {
  39450. return -1;
  39451. }
  39452. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39453. return array.indexOf(item);
  39454. }
  39455. for (var i = 0, l = array.length; i < l; i++) {
  39456. if (array[i] === item) {
  39457. return i;
  39458. }
  39459. }
  39460. return -1;
  39461. }
  39462. function objectApply(object, f) {
  39463. for (var key in object) {
  39464. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39465. f(object[key], key, object);
  39466. }
  39467. }
  39468. }
  39469. function keys(object) {
  39470. var keys = [];
  39471. objectApply(object, function (_, key) {
  39472. keys.push(key);
  39473. });
  39474. return keys;
  39475. }
  39476. function values(object) {
  39477. var values = [];
  39478. objectApply(object, function (value) {
  39479. values.push(value);
  39480. });
  39481. return values;
  39482. }
  39483. function apply(array, f, context) {
  39484. for (var i = 0; i < array.length; i++) {
  39485. f.call(context || window, array[i], i, array);
  39486. }
  39487. }
  39488. function map(array, f) {
  39489. var result = [];
  39490. for (var i = 0; i < array.length; i++) {
  39491. result.push(f(array[i], i, array, result));
  39492. }
  39493. return result;
  39494. }
  39495. function mapObject(object, f) {
  39496. var result = {};
  39497. objectApply(object, function (value, key) {
  39498. result[key] = f(value);
  39499. });
  39500. return result;
  39501. }
  39502. function filter(array, test) {
  39503. test = test || function (value) { return !!value; };
  39504. var result = [];
  39505. for (var i = 0; i < array.length; i++) {
  39506. if (test(array[i], i, array, result)) {
  39507. result.push(array[i]);
  39508. }
  39509. }
  39510. return result;
  39511. }
  39512. function filterObject(object, test) {
  39513. var result = {};
  39514. objectApply(object, function (value, key) {
  39515. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39516. result[key] = value;
  39517. }
  39518. });
  39519. return result;
  39520. }
  39521. function flatten(object) {
  39522. var result = [];
  39523. objectApply(object, function (value, key) {
  39524. result.push([key, value]);
  39525. });
  39526. return result;
  39527. }
  39528. function any(array, test) {
  39529. for (var i = 0; i < array.length; i++) {
  39530. if (test(array[i], i, array)) {
  39531. return true;
  39532. }
  39533. }
  39534. return false;
  39535. }
  39536. function collections_all(array, test) {
  39537. for (var i = 0; i < array.length; i++) {
  39538. if (!test(array[i], i, array)) {
  39539. return false;
  39540. }
  39541. }
  39542. return true;
  39543. }
  39544. function encodeParamsObject(data) {
  39545. return mapObject(data, function (value) {
  39546. if (typeof value === "object") {
  39547. value = safeJSONStringify(value);
  39548. }
  39549. return encodeURIComponent(encode(value.toString()));
  39550. });
  39551. }
  39552. function buildQueryString(data) {
  39553. var params = filterObject(data, function (value) {
  39554. return value !== undefined;
  39555. });
  39556. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39557. return query;
  39558. }
  39559. function decycleObject(object) {
  39560. var objects = [], paths = [];
  39561. return (function derez(value, path) {
  39562. var i, name, nu;
  39563. switch (typeof value) {
  39564. case 'object':
  39565. if (!value) {
  39566. return null;
  39567. }
  39568. for (i = 0; i < objects.length; i += 1) {
  39569. if (objects[i] === value) {
  39570. return { $ref: paths[i] };
  39571. }
  39572. }
  39573. objects.push(value);
  39574. paths.push(path);
  39575. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39576. nu = [];
  39577. for (i = 0; i < value.length; i += 1) {
  39578. nu[i] = derez(value[i], path + '[' + i + ']');
  39579. }
  39580. }
  39581. else {
  39582. nu = {};
  39583. for (name in value) {
  39584. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39585. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39586. }
  39587. }
  39588. }
  39589. return nu;
  39590. case 'number':
  39591. case 'string':
  39592. case 'boolean':
  39593. return value;
  39594. }
  39595. }(object, '$'));
  39596. }
  39597. function safeJSONStringify(source) {
  39598. try {
  39599. return JSON.stringify(source);
  39600. }
  39601. catch (e) {
  39602. return JSON.stringify(decycleObject(source));
  39603. }
  39604. }
  39605. // CONCATENATED MODULE: ./src/core/logger.ts
  39606. var logger_Logger = (function () {
  39607. function Logger() {
  39608. this.globalLog = function (message) {
  39609. if (window.console && window.console.log) {
  39610. window.console.log(message);
  39611. }
  39612. };
  39613. }
  39614. Logger.prototype.debug = function () {
  39615. var args = [];
  39616. for (var _i = 0; _i < arguments.length; _i++) {
  39617. args[_i] = arguments[_i];
  39618. }
  39619. this.log(this.globalLog, args);
  39620. };
  39621. Logger.prototype.warn = function () {
  39622. var args = [];
  39623. for (var _i = 0; _i < arguments.length; _i++) {
  39624. args[_i] = arguments[_i];
  39625. }
  39626. this.log(this.globalLogWarn, args);
  39627. };
  39628. Logger.prototype.error = function () {
  39629. var args = [];
  39630. for (var _i = 0; _i < arguments.length; _i++) {
  39631. args[_i] = arguments[_i];
  39632. }
  39633. this.log(this.globalLogError, args);
  39634. };
  39635. Logger.prototype.globalLogWarn = function (message) {
  39636. if (window.console && window.console.warn) {
  39637. window.console.warn(message);
  39638. }
  39639. else {
  39640. this.globalLog(message);
  39641. }
  39642. };
  39643. Logger.prototype.globalLogError = function (message) {
  39644. if (window.console && window.console.error) {
  39645. window.console.error(message);
  39646. }
  39647. else {
  39648. this.globalLogWarn(message);
  39649. }
  39650. };
  39651. Logger.prototype.log = function (defaultLoggingFunction) {
  39652. var args = [];
  39653. for (var _i = 1; _i < arguments.length; _i++) {
  39654. args[_i - 1] = arguments[_i];
  39655. }
  39656. var message = stringify.apply(this, arguments);
  39657. if (core_pusher.log) {
  39658. core_pusher.log(message);
  39659. }
  39660. else if (core_pusher.logToConsole) {
  39661. var log = defaultLoggingFunction.bind(this);
  39662. log(message);
  39663. }
  39664. };
  39665. return Logger;
  39666. }());
  39667. /* harmony default export */ var logger = (new logger_Logger());
  39668. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39669. var urlStore = {
  39670. baseUrl: "https://pusher.com",
  39671. urls: {
  39672. authenticationEndpoint: {
  39673. path: "/docs/authenticating_users",
  39674. },
  39675. javascriptQuickStart: {
  39676. path: "/docs/javascript_quick_start"
  39677. },
  39678. triggeringClientEvents: {
  39679. path: "/docs/client_api_guide/client_events#trigger-events"
  39680. }
  39681. }
  39682. };
  39683. var buildLogSuffix = function (key) {
  39684. var urlPrefix = "See:";
  39685. var urlObj = urlStore.urls[key];
  39686. if (!urlObj)
  39687. return "";
  39688. var url;
  39689. if (urlObj.fullUrl) {
  39690. url = urlObj.fullUrl;
  39691. }
  39692. else if (urlObj.path) {
  39693. url = urlStore.baseUrl + urlObj.path;
  39694. }
  39695. if (!url)
  39696. return "";
  39697. return urlPrefix + " " + url;
  39698. };
  39699. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39700. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39701. var ajax = function (context, socketId, callback) {
  39702. var self = this, xhr;
  39703. xhr = runtime.createXHR();
  39704. xhr.open("POST", self.options.authEndpoint, true);
  39705. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39706. for (var headerName in this.authOptions.headers) {
  39707. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39708. }
  39709. xhr.onreadystatechange = function () {
  39710. if (xhr.readyState === 4) {
  39711. if (xhr.status === 200) {
  39712. var data, parsed = false;
  39713. try {
  39714. data = JSON.parse(xhr.responseText);
  39715. parsed = true;
  39716. }
  39717. catch (e) {
  39718. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39719. }
  39720. if (parsed) {
  39721. callback(false, data);
  39722. }
  39723. }
  39724. else {
  39725. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39726. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39727. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39728. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39729. callback(true, xhr.status);
  39730. }
  39731. }
  39732. };
  39733. xhr.send(this.composeQuery(socketId));
  39734. return xhr;
  39735. };
  39736. /* harmony default export */ var xhr_auth = (ajax);
  39737. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39738. var jsonp = function (context, socketId, callback) {
  39739. if (this.authOptions.headers !== undefined) {
  39740. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39741. }
  39742. var callbackName = context.nextAuthCallbackID.toString();
  39743. context.nextAuthCallbackID++;
  39744. var document = context.getDocument();
  39745. var script = document.createElement("script");
  39746. context.auth_callbacks[callbackName] = function (data) {
  39747. callback(false, data);
  39748. };
  39749. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39750. script.src = this.options.authEndpoint +
  39751. '?callback=' +
  39752. encodeURIComponent(callback_name) +
  39753. '&' +
  39754. this.composeQuery(socketId);
  39755. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39756. head.insertBefore(script, head.firstChild);
  39757. };
  39758. /* harmony default export */ var jsonp_auth = (jsonp);
  39759. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39760. var ScriptRequest = (function () {
  39761. function ScriptRequest(src) {
  39762. this.src = src;
  39763. }
  39764. ScriptRequest.prototype.send = function (receiver) {
  39765. var self = this;
  39766. var errorString = "Error loading " + self.src;
  39767. self.script = document.createElement("script");
  39768. self.script.id = receiver.id;
  39769. self.script.src = self.src;
  39770. self.script.type = "text/javascript";
  39771. self.script.charset = "UTF-8";
  39772. if (self.script.addEventListener) {
  39773. self.script.onerror = function () {
  39774. receiver.callback(errorString);
  39775. };
  39776. self.script.onload = function () {
  39777. receiver.callback(null);
  39778. };
  39779. }
  39780. else {
  39781. self.script.onreadystatechange = function () {
  39782. if (self.script.readyState === 'loaded' ||
  39783. self.script.readyState === 'complete') {
  39784. receiver.callback(null);
  39785. }
  39786. };
  39787. }
  39788. if (self.script.async === undefined && document.attachEvent &&
  39789. /opera/i.test(navigator.userAgent)) {
  39790. self.errorScript = document.createElement("script");
  39791. self.errorScript.id = receiver.id + "_error";
  39792. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39793. self.script.async = self.errorScript.async = false;
  39794. }
  39795. else {
  39796. self.script.async = true;
  39797. }
  39798. var head = document.getElementsByTagName('head')[0];
  39799. head.insertBefore(self.script, head.firstChild);
  39800. if (self.errorScript) {
  39801. head.insertBefore(self.errorScript, self.script.nextSibling);
  39802. }
  39803. };
  39804. ScriptRequest.prototype.cleanup = function () {
  39805. if (this.script) {
  39806. this.script.onload = this.script.onerror = null;
  39807. this.script.onreadystatechange = null;
  39808. }
  39809. if (this.script && this.script.parentNode) {
  39810. this.script.parentNode.removeChild(this.script);
  39811. }
  39812. if (this.errorScript && this.errorScript.parentNode) {
  39813. this.errorScript.parentNode.removeChild(this.errorScript);
  39814. }
  39815. this.script = null;
  39816. this.errorScript = null;
  39817. };
  39818. return ScriptRequest;
  39819. }());
  39820. /* harmony default export */ var script_request = (ScriptRequest);
  39821. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39822. var jsonp_request_JSONPRequest = (function () {
  39823. function JSONPRequest(url, data) {
  39824. this.url = url;
  39825. this.data = data;
  39826. }
  39827. JSONPRequest.prototype.send = function (receiver) {
  39828. if (this.request) {
  39829. return;
  39830. }
  39831. var query = buildQueryString(this.data);
  39832. var url = this.url + "/" + receiver.number + "?" + query;
  39833. this.request = runtime.createScriptRequest(url);
  39834. this.request.send(receiver);
  39835. };
  39836. JSONPRequest.prototype.cleanup = function () {
  39837. if (this.request) {
  39838. this.request.cleanup();
  39839. }
  39840. };
  39841. return JSONPRequest;
  39842. }());
  39843. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39844. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39845. var getAgent = function (sender, useTLS) {
  39846. return function (data, callback) {
  39847. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39848. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39849. var request = runtime.createJSONPRequest(url, data);
  39850. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39851. ScriptReceivers.remove(receiver);
  39852. request.cleanup();
  39853. if (result && result.host) {
  39854. sender.host = result.host;
  39855. }
  39856. if (callback) {
  39857. callback(error, result);
  39858. }
  39859. });
  39860. request.send(receiver);
  39861. };
  39862. };
  39863. var jsonp_timeline_jsonp = {
  39864. name: 'jsonp',
  39865. getAgent: getAgent
  39866. };
  39867. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39868. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39869. function getGenericURL(baseScheme, params, path) {
  39870. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39871. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39872. return scheme + "://" + host + path;
  39873. }
  39874. function getGenericPath(key, queryString) {
  39875. var path = "/app/" + key;
  39876. var query = "?protocol=" + defaults.PROTOCOL +
  39877. "&client=js" +
  39878. "&version=" + defaults.VERSION +
  39879. (queryString ? ("&" + queryString) : "");
  39880. return path + query;
  39881. }
  39882. var ws = {
  39883. getInitial: function (key, params) {
  39884. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39885. return getGenericURL("ws", params, path);
  39886. }
  39887. };
  39888. var http = {
  39889. getInitial: function (key, params) {
  39890. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39891. return getGenericURL("http", params, path);
  39892. }
  39893. };
  39894. var sockjs = {
  39895. getInitial: function (key, params) {
  39896. return getGenericURL("http", params, params.httpPath || "/pusher");
  39897. },
  39898. getPath: function (key, params) {
  39899. return getGenericPath(key);
  39900. }
  39901. };
  39902. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39903. var callback_registry_CallbackRegistry = (function () {
  39904. function CallbackRegistry() {
  39905. this._callbacks = {};
  39906. }
  39907. CallbackRegistry.prototype.get = function (name) {
  39908. return this._callbacks[prefix(name)];
  39909. };
  39910. CallbackRegistry.prototype.add = function (name, callback, context) {
  39911. var prefixedEventName = prefix(name);
  39912. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39913. this._callbacks[prefixedEventName].push({
  39914. fn: callback,
  39915. context: context
  39916. });
  39917. };
  39918. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39919. if (!name && !callback && !context) {
  39920. this._callbacks = {};
  39921. return;
  39922. }
  39923. var names = name ? [prefix(name)] : keys(this._callbacks);
  39924. if (callback || context) {
  39925. this.removeCallback(names, callback, context);
  39926. }
  39927. else {
  39928. this.removeAllCallbacks(names);
  39929. }
  39930. };
  39931. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39932. apply(names, function (name) {
  39933. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39934. return (callback && callback !== binding.fn) ||
  39935. (context && context !== binding.context);
  39936. });
  39937. if (this._callbacks[name].length === 0) {
  39938. delete this._callbacks[name];
  39939. }
  39940. }, this);
  39941. };
  39942. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39943. apply(names, function (name) {
  39944. delete this._callbacks[name];
  39945. }, this);
  39946. };
  39947. return CallbackRegistry;
  39948. }());
  39949. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39950. function prefix(name) {
  39951. return "_" + name;
  39952. }
  39953. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39954. var dispatcher_Dispatcher = (function () {
  39955. function Dispatcher(failThrough) {
  39956. this.callbacks = new callback_registry();
  39957. this.global_callbacks = [];
  39958. this.failThrough = failThrough;
  39959. }
  39960. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39961. this.callbacks.add(eventName, callback, context);
  39962. return this;
  39963. };
  39964. Dispatcher.prototype.bind_global = function (callback) {
  39965. this.global_callbacks.push(callback);
  39966. return this;
  39967. };
  39968. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39969. this.callbacks.remove(eventName, callback, context);
  39970. return this;
  39971. };
  39972. Dispatcher.prototype.unbind_global = function (callback) {
  39973. if (!callback) {
  39974. this.global_callbacks = [];
  39975. return this;
  39976. }
  39977. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39978. return this;
  39979. };
  39980. Dispatcher.prototype.unbind_all = function () {
  39981. this.unbind();
  39982. this.unbind_global();
  39983. return this;
  39984. };
  39985. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39986. for (var i = 0; i < this.global_callbacks.length; i++) {
  39987. this.global_callbacks[i](eventName, data);
  39988. }
  39989. var callbacks = this.callbacks.get(eventName);
  39990. var args = [];
  39991. if (metadata) {
  39992. args.push(data, metadata);
  39993. }
  39994. else if (data) {
  39995. args.push(data);
  39996. }
  39997. if (callbacks && callbacks.length > 0) {
  39998. for (var i = 0; i < callbacks.length; i++) {
  39999. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40000. }
  40001. }
  40002. else if (this.failThrough) {
  40003. this.failThrough(eventName, data);
  40004. }
  40005. return this;
  40006. };
  40007. return Dispatcher;
  40008. }());
  40009. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40010. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40011. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40012. var extendStatics = function (d, b) {
  40013. extendStatics = Object.setPrototypeOf ||
  40014. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40015. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40016. return extendStatics(d, b);
  40017. };
  40018. return function (d, b) {
  40019. extendStatics(d, b);
  40020. function __() { this.constructor = d; }
  40021. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40022. };
  40023. })();
  40024. var transport_connection_TransportConnection = (function (_super) {
  40025. transport_connection_extends(TransportConnection, _super);
  40026. function TransportConnection(hooks, name, priority, key, options) {
  40027. var _this = _super.call(this) || this;
  40028. _this.initialize = runtime.transportConnectionInitializer;
  40029. _this.hooks = hooks;
  40030. _this.name = name;
  40031. _this.priority = priority;
  40032. _this.key = key;
  40033. _this.options = options;
  40034. _this.state = "new";
  40035. _this.timeline = options.timeline;
  40036. _this.activityTimeout = options.activityTimeout;
  40037. _this.id = _this.timeline.generateUniqueID();
  40038. return _this;
  40039. }
  40040. TransportConnection.prototype.handlesActivityChecks = function () {
  40041. return Boolean(this.hooks.handlesActivityChecks);
  40042. };
  40043. TransportConnection.prototype.supportsPing = function () {
  40044. return Boolean(this.hooks.supportsPing);
  40045. };
  40046. TransportConnection.prototype.connect = function () {
  40047. var _this = this;
  40048. if (this.socket || this.state !== "initialized") {
  40049. return false;
  40050. }
  40051. var url = this.hooks.urls.getInitial(this.key, this.options);
  40052. try {
  40053. this.socket = this.hooks.getSocket(url, this.options);
  40054. }
  40055. catch (e) {
  40056. util.defer(function () {
  40057. _this.onError(e);
  40058. _this.changeState("closed");
  40059. });
  40060. return false;
  40061. }
  40062. this.bindListeners();
  40063. logger.debug("Connecting", { transport: this.name, url: url });
  40064. this.changeState("connecting");
  40065. return true;
  40066. };
  40067. TransportConnection.prototype.close = function () {
  40068. if (this.socket) {
  40069. this.socket.close();
  40070. return true;
  40071. }
  40072. else {
  40073. return false;
  40074. }
  40075. };
  40076. TransportConnection.prototype.send = function (data) {
  40077. var _this = this;
  40078. if (this.state === "open") {
  40079. util.defer(function () {
  40080. if (_this.socket) {
  40081. _this.socket.send(data);
  40082. }
  40083. });
  40084. return true;
  40085. }
  40086. else {
  40087. return false;
  40088. }
  40089. };
  40090. TransportConnection.prototype.ping = function () {
  40091. if (this.state === "open" && this.supportsPing()) {
  40092. this.socket.ping();
  40093. }
  40094. };
  40095. TransportConnection.prototype.onOpen = function () {
  40096. if (this.hooks.beforeOpen) {
  40097. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40098. }
  40099. this.changeState("open");
  40100. this.socket.onopen = undefined;
  40101. };
  40102. TransportConnection.prototype.onError = function (error) {
  40103. this.emit("error", { type: 'WebSocketError', error: error });
  40104. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40105. };
  40106. TransportConnection.prototype.onClose = function (closeEvent) {
  40107. if (closeEvent) {
  40108. this.changeState("closed", {
  40109. code: closeEvent.code,
  40110. reason: closeEvent.reason,
  40111. wasClean: closeEvent.wasClean
  40112. });
  40113. }
  40114. else {
  40115. this.changeState("closed");
  40116. }
  40117. this.unbindListeners();
  40118. this.socket = undefined;
  40119. };
  40120. TransportConnection.prototype.onMessage = function (message) {
  40121. this.emit("message", message);
  40122. };
  40123. TransportConnection.prototype.onActivity = function () {
  40124. this.emit("activity");
  40125. };
  40126. TransportConnection.prototype.bindListeners = function () {
  40127. var _this = this;
  40128. this.socket.onopen = function () {
  40129. _this.onOpen();
  40130. };
  40131. this.socket.onerror = function (error) {
  40132. _this.onError(error);
  40133. };
  40134. this.socket.onclose = function (closeEvent) {
  40135. _this.onClose(closeEvent);
  40136. };
  40137. this.socket.onmessage = function (message) {
  40138. _this.onMessage(message);
  40139. };
  40140. if (this.supportsPing()) {
  40141. this.socket.onactivity = function () { _this.onActivity(); };
  40142. }
  40143. };
  40144. TransportConnection.prototype.unbindListeners = function () {
  40145. if (this.socket) {
  40146. this.socket.onopen = undefined;
  40147. this.socket.onerror = undefined;
  40148. this.socket.onclose = undefined;
  40149. this.socket.onmessage = undefined;
  40150. if (this.supportsPing()) {
  40151. this.socket.onactivity = undefined;
  40152. }
  40153. }
  40154. };
  40155. TransportConnection.prototype.changeState = function (state, params) {
  40156. this.state = state;
  40157. this.timeline.info(this.buildTimelineMessage({
  40158. state: state,
  40159. params: params
  40160. }));
  40161. this.emit(state, params);
  40162. };
  40163. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40164. return extend({ cid: this.id }, message);
  40165. };
  40166. return TransportConnection;
  40167. }(dispatcher));
  40168. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40169. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40170. var transport_Transport = (function () {
  40171. function Transport(hooks) {
  40172. this.hooks = hooks;
  40173. }
  40174. Transport.prototype.isSupported = function (environment) {
  40175. return this.hooks.isSupported(environment);
  40176. };
  40177. Transport.prototype.createConnection = function (name, priority, key, options) {
  40178. return new transport_connection(this.hooks, name, priority, key, options);
  40179. };
  40180. return Transport;
  40181. }());
  40182. /* harmony default export */ var transports_transport = (transport_Transport);
  40183. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40184. var WSTransport = new transports_transport({
  40185. urls: ws,
  40186. handlesActivityChecks: false,
  40187. supportsPing: false,
  40188. isInitialized: function () {
  40189. return Boolean(runtime.getWebSocketAPI());
  40190. },
  40191. isSupported: function () {
  40192. return Boolean(runtime.getWebSocketAPI());
  40193. },
  40194. getSocket: function (url) {
  40195. return runtime.createWebSocket(url);
  40196. }
  40197. });
  40198. var httpConfiguration = {
  40199. urls: http,
  40200. handlesActivityChecks: false,
  40201. supportsPing: true,
  40202. isInitialized: function () {
  40203. return true;
  40204. }
  40205. };
  40206. var streamingConfiguration = extend({ getSocket: function (url) {
  40207. return runtime.HTTPFactory.createStreamingSocket(url);
  40208. }
  40209. }, httpConfiguration);
  40210. var pollingConfiguration = extend({ getSocket: function (url) {
  40211. return runtime.HTTPFactory.createPollingSocket(url);
  40212. }
  40213. }, httpConfiguration);
  40214. var xhrConfiguration = {
  40215. isSupported: function () {
  40216. return runtime.isXHRSupported();
  40217. }
  40218. };
  40219. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40220. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40221. var Transports = {
  40222. ws: WSTransport,
  40223. xhr_streaming: XHRStreamingTransport,
  40224. xhr_polling: XHRPollingTransport
  40225. };
  40226. /* harmony default export */ var transports = (Transports);
  40227. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40228. var SockJSTransport = new transports_transport({
  40229. file: "sockjs",
  40230. urls: sockjs,
  40231. handlesActivityChecks: true,
  40232. supportsPing: false,
  40233. isSupported: function () {
  40234. return true;
  40235. },
  40236. isInitialized: function () {
  40237. return window.SockJS !== undefined;
  40238. },
  40239. getSocket: function (url, options) {
  40240. return new window.SockJS(url, null, {
  40241. js_path: Dependencies.getPath("sockjs", {
  40242. useTLS: options.useTLS
  40243. }),
  40244. ignore_null_origin: options.ignoreNullOrigin
  40245. });
  40246. },
  40247. beforeOpen: function (socket, path) {
  40248. socket.send(JSON.stringify({
  40249. path: path
  40250. }));
  40251. }
  40252. });
  40253. var xdrConfiguration = {
  40254. isSupported: function (environment) {
  40255. var yes = runtime.isXDRSupported(environment.useTLS);
  40256. return yes;
  40257. }
  40258. };
  40259. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40260. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40261. transports.xdr_streaming = XDRStreamingTransport;
  40262. transports.xdr_polling = XDRPollingTransport;
  40263. transports.sockjs = SockJSTransport;
  40264. /* harmony default export */ var transports_transports = (transports);
  40265. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40266. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40267. var extendStatics = function (d, b) {
  40268. extendStatics = Object.setPrototypeOf ||
  40269. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40270. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40271. return extendStatics(d, b);
  40272. };
  40273. return function (d, b) {
  40274. extendStatics(d, b);
  40275. function __() { this.constructor = d; }
  40276. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40277. };
  40278. })();
  40279. var NetInfo = (function (_super) {
  40280. net_info_extends(NetInfo, _super);
  40281. function NetInfo() {
  40282. var _this = _super.call(this) || this;
  40283. var self = _this;
  40284. if (window.addEventListener !== undefined) {
  40285. window.addEventListener("online", function () {
  40286. self.emit('online');
  40287. }, false);
  40288. window.addEventListener("offline", function () {
  40289. self.emit('offline');
  40290. }, false);
  40291. }
  40292. return _this;
  40293. }
  40294. NetInfo.prototype.isOnline = function () {
  40295. if (window.navigator.onLine === undefined) {
  40296. return true;
  40297. }
  40298. else {
  40299. return window.navigator.onLine;
  40300. }
  40301. };
  40302. return NetInfo;
  40303. }(dispatcher));
  40304. var net_info_Network = new NetInfo();
  40305. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40306. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40307. function AssistantToTheTransportManager(manager, transport, options) {
  40308. this.manager = manager;
  40309. this.transport = transport;
  40310. this.minPingDelay = options.minPingDelay;
  40311. this.maxPingDelay = options.maxPingDelay;
  40312. this.pingDelay = undefined;
  40313. }
  40314. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40315. var _this = this;
  40316. options = extend({}, options, {
  40317. activityTimeout: this.pingDelay
  40318. });
  40319. var connection = this.transport.createConnection(name, priority, key, options);
  40320. var openTimestamp = null;
  40321. var onOpen = function () {
  40322. connection.unbind("open", onOpen);
  40323. connection.bind("closed", onClosed);
  40324. openTimestamp = util.now();
  40325. };
  40326. var onClosed = function (closeEvent) {
  40327. connection.unbind("closed", onClosed);
  40328. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40329. _this.manager.reportDeath();
  40330. }
  40331. else if (!closeEvent.wasClean && openTimestamp) {
  40332. var lifespan = util.now() - openTimestamp;
  40333. if (lifespan < 2 * _this.maxPingDelay) {
  40334. _this.manager.reportDeath();
  40335. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40336. }
  40337. }
  40338. };
  40339. connection.bind("open", onOpen);
  40340. return connection;
  40341. };
  40342. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40343. return this.manager.isAlive() && this.transport.isSupported(environment);
  40344. };
  40345. return AssistantToTheTransportManager;
  40346. }());
  40347. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40348. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40349. var Protocol = {
  40350. decodeMessage: function (messageEvent) {
  40351. try {
  40352. var messageData = JSON.parse(messageEvent.data);
  40353. var pusherEventData = messageData.data;
  40354. if (typeof pusherEventData === 'string') {
  40355. try {
  40356. pusherEventData = JSON.parse(messageData.data);
  40357. }
  40358. catch (e) { }
  40359. }
  40360. var pusherEvent = {
  40361. event: messageData.event,
  40362. channel: messageData.channel,
  40363. data: pusherEventData,
  40364. };
  40365. if (messageData.user_id) {
  40366. pusherEvent.user_id = messageData.user_id;
  40367. }
  40368. return pusherEvent;
  40369. }
  40370. catch (e) {
  40371. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40372. }
  40373. },
  40374. encodeMessage: function (event) {
  40375. return JSON.stringify(event);
  40376. },
  40377. processHandshake: function (messageEvent) {
  40378. var message = Protocol.decodeMessage(messageEvent);
  40379. if (message.event === "pusher:connection_established") {
  40380. if (!message.data.activity_timeout) {
  40381. throw "No activity timeout specified in handshake";
  40382. }
  40383. return {
  40384. action: "connected",
  40385. id: message.data.socket_id,
  40386. activityTimeout: message.data.activity_timeout * 1000
  40387. };
  40388. }
  40389. else if (message.event === "pusher:error") {
  40390. return {
  40391. action: this.getCloseAction(message.data),
  40392. error: this.getCloseError(message.data)
  40393. };
  40394. }
  40395. else {
  40396. throw "Invalid handshake";
  40397. }
  40398. },
  40399. getCloseAction: function (closeEvent) {
  40400. if (closeEvent.code < 4000) {
  40401. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40402. return "backoff";
  40403. }
  40404. else {
  40405. return null;
  40406. }
  40407. }
  40408. else if (closeEvent.code === 4000) {
  40409. return "tls_only";
  40410. }
  40411. else if (closeEvent.code < 4100) {
  40412. return "refused";
  40413. }
  40414. else if (closeEvent.code < 4200) {
  40415. return "backoff";
  40416. }
  40417. else if (closeEvent.code < 4300) {
  40418. return "retry";
  40419. }
  40420. else {
  40421. return "refused";
  40422. }
  40423. },
  40424. getCloseError: function (closeEvent) {
  40425. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40426. return {
  40427. type: 'PusherError',
  40428. data: {
  40429. code: closeEvent.code,
  40430. message: closeEvent.reason || closeEvent.message
  40431. }
  40432. };
  40433. }
  40434. else {
  40435. return null;
  40436. }
  40437. }
  40438. };
  40439. /* harmony default export */ var protocol_protocol = (Protocol);
  40440. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40441. var connection_extends = (undefined && undefined.__extends) || (function () {
  40442. var extendStatics = function (d, b) {
  40443. extendStatics = Object.setPrototypeOf ||
  40444. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40445. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40446. return extendStatics(d, b);
  40447. };
  40448. return function (d, b) {
  40449. extendStatics(d, b);
  40450. function __() { this.constructor = d; }
  40451. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40452. };
  40453. })();
  40454. var connection_Connection = (function (_super) {
  40455. connection_extends(Connection, _super);
  40456. function Connection(id, transport) {
  40457. var _this = _super.call(this) || this;
  40458. _this.id = id;
  40459. _this.transport = transport;
  40460. _this.activityTimeout = transport.activityTimeout;
  40461. _this.bindListeners();
  40462. return _this;
  40463. }
  40464. Connection.prototype.handlesActivityChecks = function () {
  40465. return this.transport.handlesActivityChecks();
  40466. };
  40467. Connection.prototype.send = function (data) {
  40468. return this.transport.send(data);
  40469. };
  40470. Connection.prototype.send_event = function (name, data, channel) {
  40471. var event = { event: name, data: data };
  40472. if (channel) {
  40473. event.channel = channel;
  40474. }
  40475. logger.debug('Event sent', event);
  40476. return this.send(protocol_protocol.encodeMessage(event));
  40477. };
  40478. Connection.prototype.ping = function () {
  40479. if (this.transport.supportsPing()) {
  40480. this.transport.ping();
  40481. }
  40482. else {
  40483. this.send_event('pusher:ping', {});
  40484. }
  40485. };
  40486. Connection.prototype.close = function () {
  40487. this.transport.close();
  40488. };
  40489. Connection.prototype.bindListeners = function () {
  40490. var _this = this;
  40491. var listeners = {
  40492. message: function (messageEvent) {
  40493. var pusherEvent;
  40494. try {
  40495. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40496. }
  40497. catch (e) {
  40498. _this.emit('error', {
  40499. type: 'MessageParseError',
  40500. error: e,
  40501. data: messageEvent.data
  40502. });
  40503. }
  40504. if (pusherEvent !== undefined) {
  40505. logger.debug('Event recd', pusherEvent);
  40506. switch (pusherEvent.event) {
  40507. case 'pusher:error':
  40508. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40509. break;
  40510. case 'pusher:ping':
  40511. _this.emit("ping");
  40512. break;
  40513. case 'pusher:pong':
  40514. _this.emit("pong");
  40515. break;
  40516. }
  40517. _this.emit('message', pusherEvent);
  40518. }
  40519. },
  40520. activity: function () {
  40521. _this.emit("activity");
  40522. },
  40523. error: function (error) {
  40524. _this.emit("error", { type: "WebSocketError", error: error });
  40525. },
  40526. closed: function (closeEvent) {
  40527. unbindListeners();
  40528. if (closeEvent && closeEvent.code) {
  40529. _this.handleCloseEvent(closeEvent);
  40530. }
  40531. _this.transport = null;
  40532. _this.emit("closed");
  40533. }
  40534. };
  40535. var unbindListeners = function () {
  40536. objectApply(listeners, function (listener, event) {
  40537. _this.transport.unbind(event, listener);
  40538. });
  40539. };
  40540. objectApply(listeners, function (listener, event) {
  40541. _this.transport.bind(event, listener);
  40542. });
  40543. };
  40544. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40545. var action = protocol_protocol.getCloseAction(closeEvent);
  40546. var error = protocol_protocol.getCloseError(closeEvent);
  40547. if (error) {
  40548. this.emit('error', error);
  40549. }
  40550. if (action) {
  40551. this.emit(action, { action: action, error: error });
  40552. }
  40553. };
  40554. return Connection;
  40555. }(dispatcher));
  40556. /* harmony default export */ var connection_connection = (connection_Connection);
  40557. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40558. var handshake_Handshake = (function () {
  40559. function Handshake(transport, callback) {
  40560. this.transport = transport;
  40561. this.callback = callback;
  40562. this.bindListeners();
  40563. }
  40564. Handshake.prototype.close = function () {
  40565. this.unbindListeners();
  40566. this.transport.close();
  40567. };
  40568. Handshake.prototype.bindListeners = function () {
  40569. var _this = this;
  40570. this.onMessage = function (m) {
  40571. _this.unbindListeners();
  40572. var result;
  40573. try {
  40574. result = protocol_protocol.processHandshake(m);
  40575. }
  40576. catch (e) {
  40577. _this.finish("error", { error: e });
  40578. _this.transport.close();
  40579. return;
  40580. }
  40581. if (result.action === "connected") {
  40582. _this.finish("connected", {
  40583. connection: new connection_connection(result.id, _this.transport),
  40584. activityTimeout: result.activityTimeout
  40585. });
  40586. }
  40587. else {
  40588. _this.finish(result.action, { error: result.error });
  40589. _this.transport.close();
  40590. }
  40591. };
  40592. this.onClosed = function (closeEvent) {
  40593. _this.unbindListeners();
  40594. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40595. var error = protocol_protocol.getCloseError(closeEvent);
  40596. _this.finish(action, { error: error });
  40597. };
  40598. this.transport.bind("message", this.onMessage);
  40599. this.transport.bind("closed", this.onClosed);
  40600. };
  40601. Handshake.prototype.unbindListeners = function () {
  40602. this.transport.unbind("message", this.onMessage);
  40603. this.transport.unbind("closed", this.onClosed);
  40604. };
  40605. Handshake.prototype.finish = function (action, params) {
  40606. this.callback(extend({ transport: this.transport, action: action }, params));
  40607. };
  40608. return Handshake;
  40609. }());
  40610. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40611. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40612. var pusher_authorizer_PusherAuthorizer = (function () {
  40613. function PusherAuthorizer(channel, options) {
  40614. this.channel = channel;
  40615. var authTransport = options.authTransport;
  40616. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40617. throw "'" + authTransport + "' is not a recognized auth transport";
  40618. }
  40619. this.type = authTransport;
  40620. this.options = options;
  40621. this.authOptions = (options || {}).auth || {};
  40622. }
  40623. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40624. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40625. '&channel_name=' + encodeURIComponent(this.channel.name);
  40626. for (var i in this.authOptions.params) {
  40627. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40628. }
  40629. return query;
  40630. };
  40631. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40632. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40633. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40634. };
  40635. return PusherAuthorizer;
  40636. }());
  40637. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40638. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40639. var timeline_sender_TimelineSender = (function () {
  40640. function TimelineSender(timeline, options) {
  40641. this.timeline = timeline;
  40642. this.options = options || {};
  40643. }
  40644. TimelineSender.prototype.send = function (useTLS, callback) {
  40645. if (this.timeline.isEmpty()) {
  40646. return;
  40647. }
  40648. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40649. };
  40650. return TimelineSender;
  40651. }());
  40652. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40653. // CONCATENATED MODULE: ./src/core/errors.ts
  40654. var errors_extends = (undefined && undefined.__extends) || (function () {
  40655. var extendStatics = function (d, b) {
  40656. extendStatics = Object.setPrototypeOf ||
  40657. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40658. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40659. return extendStatics(d, b);
  40660. };
  40661. return function (d, b) {
  40662. extendStatics(d, b);
  40663. function __() { this.constructor = d; }
  40664. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40665. };
  40666. })();
  40667. var BadEventName = (function (_super) {
  40668. errors_extends(BadEventName, _super);
  40669. function BadEventName(msg) {
  40670. var _newTarget = this.constructor;
  40671. var _this = _super.call(this, msg) || this;
  40672. Object.setPrototypeOf(_this, _newTarget.prototype);
  40673. return _this;
  40674. }
  40675. return BadEventName;
  40676. }(Error));
  40677. var RequestTimedOut = (function (_super) {
  40678. errors_extends(RequestTimedOut, _super);
  40679. function RequestTimedOut(msg) {
  40680. var _newTarget = this.constructor;
  40681. var _this = _super.call(this, msg) || this;
  40682. Object.setPrototypeOf(_this, _newTarget.prototype);
  40683. return _this;
  40684. }
  40685. return RequestTimedOut;
  40686. }(Error));
  40687. var TransportPriorityTooLow = (function (_super) {
  40688. errors_extends(TransportPriorityTooLow, _super);
  40689. function TransportPriorityTooLow(msg) {
  40690. var _newTarget = this.constructor;
  40691. var _this = _super.call(this, msg) || this;
  40692. Object.setPrototypeOf(_this, _newTarget.prototype);
  40693. return _this;
  40694. }
  40695. return TransportPriorityTooLow;
  40696. }(Error));
  40697. var TransportClosed = (function (_super) {
  40698. errors_extends(TransportClosed, _super);
  40699. function TransportClosed(msg) {
  40700. var _newTarget = this.constructor;
  40701. var _this = _super.call(this, msg) || this;
  40702. Object.setPrototypeOf(_this, _newTarget.prototype);
  40703. return _this;
  40704. }
  40705. return TransportClosed;
  40706. }(Error));
  40707. var UnsupportedFeature = (function (_super) {
  40708. errors_extends(UnsupportedFeature, _super);
  40709. function UnsupportedFeature(msg) {
  40710. var _newTarget = this.constructor;
  40711. var _this = _super.call(this, msg) || this;
  40712. Object.setPrototypeOf(_this, _newTarget.prototype);
  40713. return _this;
  40714. }
  40715. return UnsupportedFeature;
  40716. }(Error));
  40717. var UnsupportedTransport = (function (_super) {
  40718. errors_extends(UnsupportedTransport, _super);
  40719. function UnsupportedTransport(msg) {
  40720. var _newTarget = this.constructor;
  40721. var _this = _super.call(this, msg) || this;
  40722. Object.setPrototypeOf(_this, _newTarget.prototype);
  40723. return _this;
  40724. }
  40725. return UnsupportedTransport;
  40726. }(Error));
  40727. var UnsupportedStrategy = (function (_super) {
  40728. errors_extends(UnsupportedStrategy, _super);
  40729. function UnsupportedStrategy(msg) {
  40730. var _newTarget = this.constructor;
  40731. var _this = _super.call(this, msg) || this;
  40732. Object.setPrototypeOf(_this, _newTarget.prototype);
  40733. return _this;
  40734. }
  40735. return UnsupportedStrategy;
  40736. }(Error));
  40737. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40738. var channel_extends = (undefined && undefined.__extends) || (function () {
  40739. var extendStatics = function (d, b) {
  40740. extendStatics = Object.setPrototypeOf ||
  40741. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40742. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40743. return extendStatics(d, b);
  40744. };
  40745. return function (d, b) {
  40746. extendStatics(d, b);
  40747. function __() { this.constructor = d; }
  40748. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40749. };
  40750. })();
  40751. var channel_Channel = (function (_super) {
  40752. channel_extends(Channel, _super);
  40753. function Channel(name, pusher) {
  40754. var _this = _super.call(this, function (event, data) {
  40755. logger.debug('No callbacks on ' + name + ' for ' + event);
  40756. }) || this;
  40757. _this.name = name;
  40758. _this.pusher = pusher;
  40759. _this.subscribed = false;
  40760. _this.subscriptionPending = false;
  40761. _this.subscriptionCancelled = false;
  40762. return _this;
  40763. }
  40764. Channel.prototype.authorize = function (socketId, callback) {
  40765. return callback(false, {});
  40766. };
  40767. Channel.prototype.trigger = function (event, data) {
  40768. if (event.indexOf("client-") !== 0) {
  40769. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40770. }
  40771. if (!this.subscribed) {
  40772. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40773. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40774. }
  40775. return this.pusher.send_event(event, data, this.name);
  40776. };
  40777. Channel.prototype.disconnect = function () {
  40778. this.subscribed = false;
  40779. this.subscriptionPending = false;
  40780. };
  40781. Channel.prototype.handleEvent = function (event) {
  40782. var eventName = event.event;
  40783. var data = event.data;
  40784. if (eventName === "pusher_internal:subscription_succeeded") {
  40785. this.handleSubscriptionSucceededEvent(event);
  40786. }
  40787. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40788. var metadata = {};
  40789. this.emit(eventName, data, metadata);
  40790. }
  40791. };
  40792. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40793. this.subscriptionPending = false;
  40794. this.subscribed = true;
  40795. if (this.subscriptionCancelled) {
  40796. this.pusher.unsubscribe(this.name);
  40797. }
  40798. else {
  40799. this.emit("pusher:subscription_succeeded", event.data);
  40800. }
  40801. };
  40802. Channel.prototype.subscribe = function () {
  40803. var _this = this;
  40804. if (this.subscribed) {
  40805. return;
  40806. }
  40807. this.subscriptionPending = true;
  40808. this.subscriptionCancelled = false;
  40809. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40810. if (error) {
  40811. logger.error(data);
  40812. _this.emit('pusher:subscription_error', data);
  40813. }
  40814. else {
  40815. _this.pusher.send_event('pusher:subscribe', {
  40816. auth: data.auth,
  40817. channel_data: data.channel_data,
  40818. channel: _this.name
  40819. });
  40820. }
  40821. });
  40822. };
  40823. Channel.prototype.unsubscribe = function () {
  40824. this.subscribed = false;
  40825. this.pusher.send_event('pusher:unsubscribe', {
  40826. channel: this.name
  40827. });
  40828. };
  40829. Channel.prototype.cancelSubscription = function () {
  40830. this.subscriptionCancelled = true;
  40831. };
  40832. Channel.prototype.reinstateSubscription = function () {
  40833. this.subscriptionCancelled = false;
  40834. };
  40835. return Channel;
  40836. }(dispatcher));
  40837. /* harmony default export */ var channels_channel = (channel_Channel);
  40838. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40839. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40840. var extendStatics = function (d, b) {
  40841. extendStatics = Object.setPrototypeOf ||
  40842. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40843. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40844. return extendStatics(d, b);
  40845. };
  40846. return function (d, b) {
  40847. extendStatics(d, b);
  40848. function __() { this.constructor = d; }
  40849. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40850. };
  40851. })();
  40852. var private_channel_PrivateChannel = (function (_super) {
  40853. private_channel_extends(PrivateChannel, _super);
  40854. function PrivateChannel() {
  40855. return _super !== null && _super.apply(this, arguments) || this;
  40856. }
  40857. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40858. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40859. return authorizer.authorize(socketId, callback);
  40860. };
  40861. return PrivateChannel;
  40862. }(channels_channel));
  40863. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40864. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40865. var members_Members = (function () {
  40866. function Members() {
  40867. this.reset();
  40868. }
  40869. Members.prototype.get = function (id) {
  40870. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40871. return {
  40872. id: id,
  40873. info: this.members[id]
  40874. };
  40875. }
  40876. else {
  40877. return null;
  40878. }
  40879. };
  40880. Members.prototype.each = function (callback) {
  40881. var _this = this;
  40882. objectApply(this.members, function (member, id) {
  40883. callback(_this.get(id));
  40884. });
  40885. };
  40886. Members.prototype.setMyID = function (id) {
  40887. this.myID = id;
  40888. };
  40889. Members.prototype.onSubscription = function (subscriptionData) {
  40890. this.members = subscriptionData.presence.hash;
  40891. this.count = subscriptionData.presence.count;
  40892. this.me = this.get(this.myID);
  40893. };
  40894. Members.prototype.addMember = function (memberData) {
  40895. if (this.get(memberData.user_id) === null) {
  40896. this.count++;
  40897. }
  40898. this.members[memberData.user_id] = memberData.user_info;
  40899. return this.get(memberData.user_id);
  40900. };
  40901. Members.prototype.removeMember = function (memberData) {
  40902. var member = this.get(memberData.user_id);
  40903. if (member) {
  40904. delete this.members[memberData.user_id];
  40905. this.count--;
  40906. }
  40907. return member;
  40908. };
  40909. Members.prototype.reset = function () {
  40910. this.members = {};
  40911. this.count = 0;
  40912. this.myID = null;
  40913. this.me = null;
  40914. };
  40915. return Members;
  40916. }());
  40917. /* harmony default export */ var members = (members_Members);
  40918. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40919. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40920. var extendStatics = function (d, b) {
  40921. extendStatics = Object.setPrototypeOf ||
  40922. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40923. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40924. return extendStatics(d, b);
  40925. };
  40926. return function (d, b) {
  40927. extendStatics(d, b);
  40928. function __() { this.constructor = d; }
  40929. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40930. };
  40931. })();
  40932. var presence_channel_PresenceChannel = (function (_super) {
  40933. presence_channel_extends(PresenceChannel, _super);
  40934. function PresenceChannel(name, pusher) {
  40935. var _this = _super.call(this, name, pusher) || this;
  40936. _this.members = new members();
  40937. return _this;
  40938. }
  40939. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40940. var _this = this;
  40941. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40942. if (!error) {
  40943. if (authData.channel_data === undefined) {
  40944. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40945. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40946. ("expected 'channel_data' field. " + suffix));
  40947. callback("Invalid auth response");
  40948. return;
  40949. }
  40950. var channelData = JSON.parse(authData.channel_data);
  40951. _this.members.setMyID(channelData.user_id);
  40952. }
  40953. callback(error, authData);
  40954. });
  40955. };
  40956. PresenceChannel.prototype.handleEvent = function (event) {
  40957. var eventName = event.event;
  40958. if (eventName.indexOf("pusher_internal:") === 0) {
  40959. this.handleInternalEvent(event);
  40960. }
  40961. else {
  40962. var data = event.data;
  40963. var metadata = {};
  40964. if (event.user_id) {
  40965. metadata.user_id = event.user_id;
  40966. }
  40967. this.emit(eventName, data, metadata);
  40968. }
  40969. };
  40970. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40971. var eventName = event.event;
  40972. var data = event.data;
  40973. switch (eventName) {
  40974. case "pusher_internal:subscription_succeeded":
  40975. this.handleSubscriptionSucceededEvent(event);
  40976. break;
  40977. case "pusher_internal:member_added":
  40978. var addedMember = this.members.addMember(data);
  40979. this.emit('pusher:member_added', addedMember);
  40980. break;
  40981. case "pusher_internal:member_removed":
  40982. var removedMember = this.members.removeMember(data);
  40983. if (removedMember) {
  40984. this.emit('pusher:member_removed', removedMember);
  40985. }
  40986. break;
  40987. }
  40988. };
  40989. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40990. this.subscriptionPending = false;
  40991. this.subscribed = true;
  40992. if (this.subscriptionCancelled) {
  40993. this.pusher.unsubscribe(this.name);
  40994. }
  40995. else {
  40996. this.members.onSubscription(event.data);
  40997. this.emit("pusher:subscription_succeeded", this.members);
  40998. }
  40999. };
  41000. PresenceChannel.prototype.disconnect = function () {
  41001. this.members.reset();
  41002. _super.prototype.disconnect.call(this);
  41003. };
  41004. return PresenceChannel;
  41005. }(private_channel));
  41006. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41007. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41008. var nacl_fast = __webpack_require__(0);
  41009. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41010. var nacl_util = __webpack_require__(1);
  41011. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41012. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41013. var extendStatics = function (d, b) {
  41014. extendStatics = Object.setPrototypeOf ||
  41015. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41016. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41017. return extendStatics(d, b);
  41018. };
  41019. return function (d, b) {
  41020. extendStatics(d, b);
  41021. function __() { this.constructor = d; }
  41022. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41023. };
  41024. })();
  41025. var encrypted_channel_EncryptedChannel = (function (_super) {
  41026. encrypted_channel_extends(EncryptedChannel, _super);
  41027. function EncryptedChannel() {
  41028. var _this = _super !== null && _super.apply(this, arguments) || this;
  41029. _this.key = null;
  41030. return _this;
  41031. }
  41032. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41033. var _this = this;
  41034. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41035. if (error) {
  41036. callback(true, authData);
  41037. return;
  41038. }
  41039. var sharedSecret = authData["shared_secret"];
  41040. if (!sharedSecret) {
  41041. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41042. callback(true, errorMsg);
  41043. return;
  41044. }
  41045. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41046. delete authData["shared_secret"];
  41047. callback(false, authData);
  41048. });
  41049. };
  41050. EncryptedChannel.prototype.trigger = function (event, data) {
  41051. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41052. };
  41053. EncryptedChannel.prototype.handleEvent = function (event) {
  41054. var eventName = event.event;
  41055. var data = event.data;
  41056. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41057. _super.prototype.handleEvent.call(this, event);
  41058. return;
  41059. }
  41060. this.handleEncryptedEvent(eventName, data);
  41061. };
  41062. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41063. var _this = this;
  41064. if (!this.key) {
  41065. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41066. return;
  41067. }
  41068. if (!data.ciphertext || !data.nonce) {
  41069. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41070. return;
  41071. }
  41072. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41073. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41074. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41075. return;
  41076. }
  41077. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41078. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41079. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41080. return;
  41081. }
  41082. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41083. if (bytes === null) {
  41084. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41085. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41086. if (error) {
  41087. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41088. return;
  41089. }
  41090. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41091. if (bytes === null) {
  41092. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41093. return;
  41094. }
  41095. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41096. return;
  41097. });
  41098. return;
  41099. }
  41100. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41101. };
  41102. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41103. try {
  41104. this.emit(eventName, JSON.parse(data));
  41105. }
  41106. catch (e) {
  41107. this.emit(eventName, data);
  41108. }
  41109. return this;
  41110. };
  41111. return EncryptedChannel;
  41112. }(private_channel));
  41113. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41114. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41115. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41116. var extendStatics = function (d, b) {
  41117. extendStatics = Object.setPrototypeOf ||
  41118. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41119. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41120. return extendStatics(d, b);
  41121. };
  41122. return function (d, b) {
  41123. extendStatics(d, b);
  41124. function __() { this.constructor = d; }
  41125. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41126. };
  41127. })();
  41128. var connection_manager_ConnectionManager = (function (_super) {
  41129. connection_manager_extends(ConnectionManager, _super);
  41130. function ConnectionManager(key, options) {
  41131. var _this = _super.call(this) || this;
  41132. _this.key = key;
  41133. _this.options = options || {};
  41134. _this.state = "initialized";
  41135. _this.connection = null;
  41136. _this.usingTLS = !!options.useTLS;
  41137. _this.timeline = _this.options.timeline;
  41138. _this.errorCallbacks = _this.buildErrorCallbacks();
  41139. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41140. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41141. var Network = runtime.getNetwork();
  41142. Network.bind("online", function () {
  41143. _this.timeline.info({ netinfo: "online" });
  41144. if (_this.state === "connecting" || _this.state === "unavailable") {
  41145. _this.retryIn(0);
  41146. }
  41147. });
  41148. Network.bind("offline", function () {
  41149. _this.timeline.info({ netinfo: "offline" });
  41150. if (_this.connection) {
  41151. _this.sendActivityCheck();
  41152. }
  41153. });
  41154. _this.updateStrategy();
  41155. return _this;
  41156. }
  41157. ConnectionManager.prototype.connect = function () {
  41158. if (this.connection || this.runner) {
  41159. return;
  41160. }
  41161. if (!this.strategy.isSupported()) {
  41162. this.updateState("failed");
  41163. return;
  41164. }
  41165. this.updateState("connecting");
  41166. this.startConnecting();
  41167. this.setUnavailableTimer();
  41168. };
  41169. ;
  41170. ConnectionManager.prototype.send = function (data) {
  41171. if (this.connection) {
  41172. return this.connection.send(data);
  41173. }
  41174. else {
  41175. return false;
  41176. }
  41177. };
  41178. ;
  41179. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41180. if (this.connection) {
  41181. return this.connection.send_event(name, data, channel);
  41182. }
  41183. else {
  41184. return false;
  41185. }
  41186. };
  41187. ;
  41188. ConnectionManager.prototype.disconnect = function () {
  41189. this.disconnectInternally();
  41190. this.updateState("disconnected");
  41191. };
  41192. ;
  41193. ConnectionManager.prototype.isUsingTLS = function () {
  41194. return this.usingTLS;
  41195. };
  41196. ;
  41197. ConnectionManager.prototype.startConnecting = function () {
  41198. var _this = this;
  41199. var callback = function (error, handshake) {
  41200. if (error) {
  41201. _this.runner = _this.strategy.connect(0, callback);
  41202. }
  41203. else {
  41204. if (handshake.action === "error") {
  41205. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41206. _this.timeline.error({ handshakeError: handshake.error });
  41207. }
  41208. else {
  41209. _this.abortConnecting();
  41210. _this.handshakeCallbacks[handshake.action](handshake);
  41211. }
  41212. }
  41213. };
  41214. this.runner = this.strategy.connect(0, callback);
  41215. };
  41216. ;
  41217. ConnectionManager.prototype.abortConnecting = function () {
  41218. if (this.runner) {
  41219. this.runner.abort();
  41220. this.runner = null;
  41221. }
  41222. };
  41223. ;
  41224. ConnectionManager.prototype.disconnectInternally = function () {
  41225. this.abortConnecting();
  41226. this.clearRetryTimer();
  41227. this.clearUnavailableTimer();
  41228. if (this.connection) {
  41229. var connection = this.abandonConnection();
  41230. connection.close();
  41231. }
  41232. };
  41233. ;
  41234. ConnectionManager.prototype.updateStrategy = function () {
  41235. this.strategy = this.options.getStrategy({
  41236. key: this.key,
  41237. timeline: this.timeline,
  41238. useTLS: this.usingTLS
  41239. });
  41240. };
  41241. ;
  41242. ConnectionManager.prototype.retryIn = function (delay) {
  41243. var _this = this;
  41244. this.timeline.info({ action: "retry", delay: delay });
  41245. if (delay > 0) {
  41246. this.emit("connecting_in", Math.round(delay / 1000));
  41247. }
  41248. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41249. _this.disconnectInternally();
  41250. _this.connect();
  41251. });
  41252. };
  41253. ;
  41254. ConnectionManager.prototype.clearRetryTimer = function () {
  41255. if (this.retryTimer) {
  41256. this.retryTimer.ensureAborted();
  41257. this.retryTimer = null;
  41258. }
  41259. };
  41260. ;
  41261. ConnectionManager.prototype.setUnavailableTimer = function () {
  41262. var _this = this;
  41263. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41264. _this.updateState("unavailable");
  41265. });
  41266. };
  41267. ;
  41268. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41269. if (this.unavailableTimer) {
  41270. this.unavailableTimer.ensureAborted();
  41271. }
  41272. };
  41273. ;
  41274. ConnectionManager.prototype.sendActivityCheck = function () {
  41275. var _this = this;
  41276. this.stopActivityCheck();
  41277. this.connection.ping();
  41278. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41279. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41280. _this.retryIn(0);
  41281. });
  41282. };
  41283. ;
  41284. ConnectionManager.prototype.resetActivityCheck = function () {
  41285. var _this = this;
  41286. this.stopActivityCheck();
  41287. if (this.connection && !this.connection.handlesActivityChecks()) {
  41288. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41289. _this.sendActivityCheck();
  41290. });
  41291. }
  41292. };
  41293. ;
  41294. ConnectionManager.prototype.stopActivityCheck = function () {
  41295. if (this.activityTimer) {
  41296. this.activityTimer.ensureAborted();
  41297. }
  41298. };
  41299. ;
  41300. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41301. var _this = this;
  41302. return extend({}, errorCallbacks, {
  41303. message: function (message) {
  41304. _this.resetActivityCheck();
  41305. _this.emit('message', message);
  41306. },
  41307. ping: function () {
  41308. _this.send_event('pusher:pong', {});
  41309. },
  41310. activity: function () {
  41311. _this.resetActivityCheck();
  41312. },
  41313. error: function (error) {
  41314. _this.emit("error", { type: "WebSocketError", error: error });
  41315. },
  41316. closed: function () {
  41317. _this.abandonConnection();
  41318. if (_this.shouldRetry()) {
  41319. _this.retryIn(1000);
  41320. }
  41321. }
  41322. });
  41323. };
  41324. ;
  41325. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41326. var _this = this;
  41327. return extend({}, errorCallbacks, {
  41328. connected: function (handshake) {
  41329. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41330. _this.clearUnavailableTimer();
  41331. _this.setConnection(handshake.connection);
  41332. _this.socket_id = _this.connection.id;
  41333. _this.updateState("connected", { socket_id: _this.socket_id });
  41334. }
  41335. });
  41336. };
  41337. ;
  41338. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41339. var _this = this;
  41340. var withErrorEmitted = function (callback) {
  41341. return function (result) {
  41342. if (result.error) {
  41343. _this.emit("error", { type: "WebSocketError", error: result.error });
  41344. }
  41345. callback(result);
  41346. };
  41347. };
  41348. return {
  41349. tls_only: withErrorEmitted(function () {
  41350. _this.usingTLS = true;
  41351. _this.updateStrategy();
  41352. _this.retryIn(0);
  41353. }),
  41354. refused: withErrorEmitted(function () {
  41355. _this.disconnect();
  41356. }),
  41357. backoff: withErrorEmitted(function () {
  41358. _this.retryIn(1000);
  41359. }),
  41360. retry: withErrorEmitted(function () {
  41361. _this.retryIn(0);
  41362. })
  41363. };
  41364. };
  41365. ;
  41366. ConnectionManager.prototype.setConnection = function (connection) {
  41367. this.connection = connection;
  41368. for (var event in this.connectionCallbacks) {
  41369. this.connection.bind(event, this.connectionCallbacks[event]);
  41370. }
  41371. this.resetActivityCheck();
  41372. };
  41373. ;
  41374. ConnectionManager.prototype.abandonConnection = function () {
  41375. if (!this.connection) {
  41376. return;
  41377. }
  41378. this.stopActivityCheck();
  41379. for (var event in this.connectionCallbacks) {
  41380. this.connection.unbind(event, this.connectionCallbacks[event]);
  41381. }
  41382. var connection = this.connection;
  41383. this.connection = null;
  41384. return connection;
  41385. };
  41386. ConnectionManager.prototype.updateState = function (newState, data) {
  41387. var previousState = this.state;
  41388. this.state = newState;
  41389. if (previousState !== newState) {
  41390. var newStateDescription = newState;
  41391. if (newStateDescription === "connected") {
  41392. newStateDescription += " with new socket ID " + data.socket_id;
  41393. }
  41394. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41395. this.timeline.info({ state: newState, params: data });
  41396. this.emit('state_change', { previous: previousState, current: newState });
  41397. this.emit(newState, data);
  41398. }
  41399. };
  41400. ConnectionManager.prototype.shouldRetry = function () {
  41401. return this.state === "connecting" || this.state === "connected";
  41402. };
  41403. return ConnectionManager;
  41404. }(dispatcher));
  41405. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41406. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41407. var channels_Channels = (function () {
  41408. function Channels() {
  41409. this.channels = {};
  41410. }
  41411. Channels.prototype.add = function (name, pusher) {
  41412. if (!this.channels[name]) {
  41413. this.channels[name] = createChannel(name, pusher);
  41414. }
  41415. return this.channels[name];
  41416. };
  41417. Channels.prototype.all = function () {
  41418. return values(this.channels);
  41419. };
  41420. Channels.prototype.find = function (name) {
  41421. return this.channels[name];
  41422. };
  41423. Channels.prototype.remove = function (name) {
  41424. var channel = this.channels[name];
  41425. delete this.channels[name];
  41426. return channel;
  41427. };
  41428. Channels.prototype.disconnect = function () {
  41429. objectApply(this.channels, function (channel) {
  41430. channel.disconnect();
  41431. });
  41432. };
  41433. return Channels;
  41434. }());
  41435. /* harmony default export */ var channels = (channels_Channels);
  41436. function createChannel(name, pusher) {
  41437. if (name.indexOf('private-encrypted-') === 0) {
  41438. if (false) { var errorMsg; }
  41439. return factory.createEncryptedChannel(name, pusher);
  41440. }
  41441. else if (name.indexOf('private-') === 0) {
  41442. return factory.createPrivateChannel(name, pusher);
  41443. }
  41444. else if (name.indexOf('presence-') === 0) {
  41445. return factory.createPresenceChannel(name, pusher);
  41446. }
  41447. else {
  41448. return factory.createChannel(name, pusher);
  41449. }
  41450. }
  41451. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41452. var Factory = {
  41453. createChannels: function () {
  41454. return new channels();
  41455. },
  41456. createConnectionManager: function (key, options) {
  41457. return new connection_manager(key, options);
  41458. },
  41459. createChannel: function (name, pusher) {
  41460. return new channels_channel(name, pusher);
  41461. },
  41462. createPrivateChannel: function (name, pusher) {
  41463. return new private_channel(name, pusher);
  41464. },
  41465. createPresenceChannel: function (name, pusher) {
  41466. return new presence_channel(name, pusher);
  41467. },
  41468. createEncryptedChannel: function (name, pusher) {
  41469. return new encrypted_channel(name, pusher);
  41470. },
  41471. createTimelineSender: function (timeline, options) {
  41472. return new timeline_sender(timeline, options);
  41473. },
  41474. createAuthorizer: function (channel, options) {
  41475. if (options.authorizer) {
  41476. return options.authorizer(channel, options);
  41477. }
  41478. return new pusher_authorizer(channel, options);
  41479. },
  41480. createHandshake: function (transport, callback) {
  41481. return new connection_handshake(transport, callback);
  41482. },
  41483. createAssistantToTheTransportManager: function (manager, transport, options) {
  41484. return new assistant_to_the_transport_manager(manager, transport, options);
  41485. }
  41486. };
  41487. /* harmony default export */ var factory = (Factory);
  41488. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41489. var transport_manager_TransportManager = (function () {
  41490. function TransportManager(options) {
  41491. this.options = options || {};
  41492. this.livesLeft = this.options.lives || Infinity;
  41493. }
  41494. TransportManager.prototype.getAssistant = function (transport) {
  41495. return factory.createAssistantToTheTransportManager(this, transport, {
  41496. minPingDelay: this.options.minPingDelay,
  41497. maxPingDelay: this.options.maxPingDelay
  41498. });
  41499. };
  41500. TransportManager.prototype.isAlive = function () {
  41501. return this.livesLeft > 0;
  41502. };
  41503. TransportManager.prototype.reportDeath = function () {
  41504. this.livesLeft -= 1;
  41505. };
  41506. return TransportManager;
  41507. }());
  41508. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41509. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41510. var sequential_strategy_SequentialStrategy = (function () {
  41511. function SequentialStrategy(strategies, options) {
  41512. this.strategies = strategies;
  41513. this.loop = Boolean(options.loop);
  41514. this.failFast = Boolean(options.failFast);
  41515. this.timeout = options.timeout;
  41516. this.timeoutLimit = options.timeoutLimit;
  41517. }
  41518. SequentialStrategy.prototype.isSupported = function () {
  41519. return any(this.strategies, util.method("isSupported"));
  41520. };
  41521. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41522. var _this = this;
  41523. var strategies = this.strategies;
  41524. var current = 0;
  41525. var timeout = this.timeout;
  41526. var runner = null;
  41527. var tryNextStrategy = function (error, handshake) {
  41528. if (handshake) {
  41529. callback(null, handshake);
  41530. }
  41531. else {
  41532. current = current + 1;
  41533. if (_this.loop) {
  41534. current = current % strategies.length;
  41535. }
  41536. if (current < strategies.length) {
  41537. if (timeout) {
  41538. timeout = timeout * 2;
  41539. if (_this.timeoutLimit) {
  41540. timeout = Math.min(timeout, _this.timeoutLimit);
  41541. }
  41542. }
  41543. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41544. }
  41545. else {
  41546. callback(true);
  41547. }
  41548. }
  41549. };
  41550. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41551. return {
  41552. abort: function () {
  41553. runner.abort();
  41554. },
  41555. forceMinPriority: function (p) {
  41556. minPriority = p;
  41557. if (runner) {
  41558. runner.forceMinPriority(p);
  41559. }
  41560. }
  41561. };
  41562. };
  41563. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41564. var timer = null;
  41565. var runner = null;
  41566. if (options.timeout > 0) {
  41567. timer = new OneOffTimer(options.timeout, function () {
  41568. runner.abort();
  41569. callback(true);
  41570. });
  41571. }
  41572. runner = strategy.connect(minPriority, function (error, handshake) {
  41573. if (error && timer && timer.isRunning() && !options.failFast) {
  41574. return;
  41575. }
  41576. if (timer) {
  41577. timer.ensureAborted();
  41578. }
  41579. callback(error, handshake);
  41580. });
  41581. return {
  41582. abort: function () {
  41583. if (timer) {
  41584. timer.ensureAborted();
  41585. }
  41586. runner.abort();
  41587. },
  41588. forceMinPriority: function (p) {
  41589. runner.forceMinPriority(p);
  41590. }
  41591. };
  41592. };
  41593. return SequentialStrategy;
  41594. }());
  41595. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41596. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41597. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41598. function BestConnectedEverStrategy(strategies) {
  41599. this.strategies = strategies;
  41600. }
  41601. BestConnectedEverStrategy.prototype.isSupported = function () {
  41602. return any(this.strategies, util.method("isSupported"));
  41603. };
  41604. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41605. return connect(this.strategies, minPriority, function (i, runners) {
  41606. return function (error, handshake) {
  41607. runners[i].error = error;
  41608. if (error) {
  41609. if (allRunnersFailed(runners)) {
  41610. callback(true);
  41611. }
  41612. return;
  41613. }
  41614. apply(runners, function (runner) {
  41615. runner.forceMinPriority(handshake.transport.priority);
  41616. });
  41617. callback(null, handshake);
  41618. };
  41619. });
  41620. };
  41621. return BestConnectedEverStrategy;
  41622. }());
  41623. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41624. function connect(strategies, minPriority, callbackBuilder) {
  41625. var runners = map(strategies, function (strategy, i, _, rs) {
  41626. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41627. });
  41628. return {
  41629. abort: function () {
  41630. apply(runners, abortRunner);
  41631. },
  41632. forceMinPriority: function (p) {
  41633. apply(runners, function (runner) {
  41634. runner.forceMinPriority(p);
  41635. });
  41636. }
  41637. };
  41638. }
  41639. function allRunnersFailed(runners) {
  41640. return collections_all(runners, function (runner) {
  41641. return Boolean(runner.error);
  41642. });
  41643. }
  41644. function abortRunner(runner) {
  41645. if (!runner.error && !runner.aborted) {
  41646. runner.abort();
  41647. runner.aborted = true;
  41648. }
  41649. }
  41650. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41651. var cached_strategy_CachedStrategy = (function () {
  41652. function CachedStrategy(strategy, transports, options) {
  41653. this.strategy = strategy;
  41654. this.transports = transports;
  41655. this.ttl = options.ttl || 1800 * 1000;
  41656. this.usingTLS = options.useTLS;
  41657. this.timeline = options.timeline;
  41658. }
  41659. CachedStrategy.prototype.isSupported = function () {
  41660. return this.strategy.isSupported();
  41661. };
  41662. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41663. var usingTLS = this.usingTLS;
  41664. var info = fetchTransportCache(usingTLS);
  41665. var strategies = [this.strategy];
  41666. if (info && info.timestamp + this.ttl >= util.now()) {
  41667. var transport = this.transports[info.transport];
  41668. if (transport) {
  41669. this.timeline.info({
  41670. cached: true,
  41671. transport: info.transport,
  41672. latency: info.latency
  41673. });
  41674. strategies.push(new sequential_strategy([transport], {
  41675. timeout: info.latency * 2 + 1000,
  41676. failFast: true
  41677. }));
  41678. }
  41679. }
  41680. var startTimestamp = util.now();
  41681. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41682. if (error) {
  41683. flushTransportCache(usingTLS);
  41684. if (strategies.length > 0) {
  41685. startTimestamp = util.now();
  41686. runner = strategies.pop().connect(minPriority, cb);
  41687. }
  41688. else {
  41689. callback(error);
  41690. }
  41691. }
  41692. else {
  41693. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41694. callback(null, handshake);
  41695. }
  41696. });
  41697. return {
  41698. abort: function () {
  41699. runner.abort();
  41700. },
  41701. forceMinPriority: function (p) {
  41702. minPriority = p;
  41703. if (runner) {
  41704. runner.forceMinPriority(p);
  41705. }
  41706. }
  41707. };
  41708. };
  41709. return CachedStrategy;
  41710. }());
  41711. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41712. function getTransportCacheKey(usingTLS) {
  41713. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41714. }
  41715. function fetchTransportCache(usingTLS) {
  41716. var storage = runtime.getLocalStorage();
  41717. if (storage) {
  41718. try {
  41719. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41720. if (serializedCache) {
  41721. return JSON.parse(serializedCache);
  41722. }
  41723. }
  41724. catch (e) {
  41725. flushTransportCache(usingTLS);
  41726. }
  41727. }
  41728. return null;
  41729. }
  41730. function storeTransportCache(usingTLS, transport, latency) {
  41731. var storage = runtime.getLocalStorage();
  41732. if (storage) {
  41733. try {
  41734. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41735. timestamp: util.now(),
  41736. transport: transport,
  41737. latency: latency
  41738. });
  41739. }
  41740. catch (e) {
  41741. }
  41742. }
  41743. }
  41744. function flushTransportCache(usingTLS) {
  41745. var storage = runtime.getLocalStorage();
  41746. if (storage) {
  41747. try {
  41748. delete storage[getTransportCacheKey(usingTLS)];
  41749. }
  41750. catch (e) {
  41751. }
  41752. }
  41753. }
  41754. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41755. var delayed_strategy_DelayedStrategy = (function () {
  41756. function DelayedStrategy(strategy, _a) {
  41757. var number = _a.delay;
  41758. this.strategy = strategy;
  41759. this.options = { delay: number };
  41760. }
  41761. DelayedStrategy.prototype.isSupported = function () {
  41762. return this.strategy.isSupported();
  41763. };
  41764. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41765. var strategy = this.strategy;
  41766. var runner;
  41767. var timer = new OneOffTimer(this.options.delay, function () {
  41768. runner = strategy.connect(minPriority, callback);
  41769. });
  41770. return {
  41771. abort: function () {
  41772. timer.ensureAborted();
  41773. if (runner) {
  41774. runner.abort();
  41775. }
  41776. },
  41777. forceMinPriority: function (p) {
  41778. minPriority = p;
  41779. if (runner) {
  41780. runner.forceMinPriority(p);
  41781. }
  41782. }
  41783. };
  41784. };
  41785. return DelayedStrategy;
  41786. }());
  41787. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41788. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41789. var IfStrategy = (function () {
  41790. function IfStrategy(test, trueBranch, falseBranch) {
  41791. this.test = test;
  41792. this.trueBranch = trueBranch;
  41793. this.falseBranch = falseBranch;
  41794. }
  41795. IfStrategy.prototype.isSupported = function () {
  41796. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41797. return branch.isSupported();
  41798. };
  41799. IfStrategy.prototype.connect = function (minPriority, callback) {
  41800. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41801. return branch.connect(minPriority, callback);
  41802. };
  41803. return IfStrategy;
  41804. }());
  41805. /* harmony default export */ var if_strategy = (IfStrategy);
  41806. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41807. var FirstConnectedStrategy = (function () {
  41808. function FirstConnectedStrategy(strategy) {
  41809. this.strategy = strategy;
  41810. }
  41811. FirstConnectedStrategy.prototype.isSupported = function () {
  41812. return this.strategy.isSupported();
  41813. };
  41814. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41815. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41816. if (handshake) {
  41817. runner.abort();
  41818. }
  41819. callback(error, handshake);
  41820. });
  41821. return runner;
  41822. };
  41823. return FirstConnectedStrategy;
  41824. }());
  41825. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41826. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41827. function testSupportsStrategy(strategy) {
  41828. return function () {
  41829. return strategy.isSupported();
  41830. };
  41831. }
  41832. var getDefaultStrategy = function (config, defineTransport) {
  41833. var definedTransports = {};
  41834. function defineTransportStrategy(name, type, priority, options, manager) {
  41835. var transport = defineTransport(config, name, type, priority, options, manager);
  41836. definedTransports[name] = transport;
  41837. return transport;
  41838. }
  41839. var ws_options = {
  41840. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41841. hostTLS: config.wsHost + ":" + config.wssPort,
  41842. httpPath: config.wsPath
  41843. };
  41844. var wss_options = extend({}, ws_options, {
  41845. useTLS: true
  41846. });
  41847. var sockjs_options = {
  41848. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41849. hostTLS: config.httpHost + ":" + config.httpsPort,
  41850. httpPath: config.httpPath
  41851. };
  41852. var timeouts = {
  41853. loop: true,
  41854. timeout: 15000,
  41855. timeoutLimit: 60000
  41856. };
  41857. var ws_manager = new transport_manager({
  41858. lives: 2,
  41859. minPingDelay: 10000,
  41860. maxPingDelay: config.activity_timeout
  41861. });
  41862. var streaming_manager = new transport_manager({
  41863. lives: 2,
  41864. minPingDelay: 10000,
  41865. maxPingDelay: config.activity_timeout
  41866. });
  41867. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41868. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41869. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41870. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41871. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41872. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41873. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41874. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41875. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41876. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41877. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41878. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41879. 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);
  41880. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41881. var wsStrategy;
  41882. if (config.useTLS) {
  41883. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41884. }
  41885. else {
  41886. wsStrategy = new best_connected_ever_strategy([
  41887. ws_loop,
  41888. new delayed_strategy(wss_loop, { delay: 2000 }),
  41889. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41890. ]);
  41891. }
  41892. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41893. ttl: 1800000,
  41894. timeline: config.timeline,
  41895. useTLS: config.useTLS
  41896. });
  41897. };
  41898. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41899. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41900. /* harmony default export */ var transport_connection_initializer = (function () {
  41901. var self = this;
  41902. self.timeline.info(self.buildTimelineMessage({
  41903. transport: self.name + (self.options.useTLS ? "s" : "")
  41904. }));
  41905. if (self.hooks.isInitialized()) {
  41906. self.changeState("initialized");
  41907. }
  41908. else if (self.hooks.file) {
  41909. self.changeState("initializing");
  41910. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41911. if (self.hooks.isInitialized()) {
  41912. self.changeState("initialized");
  41913. callback(true);
  41914. }
  41915. else {
  41916. if (error) {
  41917. self.onError(error);
  41918. }
  41919. self.onClose();
  41920. callback(false);
  41921. }
  41922. });
  41923. }
  41924. else {
  41925. self.onClose();
  41926. }
  41927. });
  41928. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41929. var http_xdomain_request_hooks = {
  41930. getRequest: function (socket) {
  41931. var xdr = new window.XDomainRequest();
  41932. xdr.ontimeout = function () {
  41933. socket.emit("error", new RequestTimedOut());
  41934. socket.close();
  41935. };
  41936. xdr.onerror = function (e) {
  41937. socket.emit("error", e);
  41938. socket.close();
  41939. };
  41940. xdr.onprogress = function () {
  41941. if (xdr.responseText && xdr.responseText.length > 0) {
  41942. socket.onChunk(200, xdr.responseText);
  41943. }
  41944. };
  41945. xdr.onload = function () {
  41946. if (xdr.responseText && xdr.responseText.length > 0) {
  41947. socket.onChunk(200, xdr.responseText);
  41948. }
  41949. socket.emit("finished", 200);
  41950. socket.close();
  41951. };
  41952. return xdr;
  41953. },
  41954. abortRequest: function (xdr) {
  41955. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41956. xdr.abort();
  41957. }
  41958. };
  41959. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41960. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41961. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41962. var extendStatics = function (d, b) {
  41963. extendStatics = Object.setPrototypeOf ||
  41964. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41965. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41966. return extendStatics(d, b);
  41967. };
  41968. return function (d, b) {
  41969. extendStatics(d, b);
  41970. function __() { this.constructor = d; }
  41971. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41972. };
  41973. })();
  41974. var MAX_BUFFER_LENGTH = 256 * 1024;
  41975. var http_request_HTTPRequest = (function (_super) {
  41976. http_request_extends(HTTPRequest, _super);
  41977. function HTTPRequest(hooks, method, url) {
  41978. var _this = _super.call(this) || this;
  41979. _this.hooks = hooks;
  41980. _this.method = method;
  41981. _this.url = url;
  41982. return _this;
  41983. }
  41984. HTTPRequest.prototype.start = function (payload) {
  41985. var _this = this;
  41986. this.position = 0;
  41987. this.xhr = this.hooks.getRequest(this);
  41988. this.unloader = function () {
  41989. _this.close();
  41990. };
  41991. runtime.addUnloadListener(this.unloader);
  41992. this.xhr.open(this.method, this.url, true);
  41993. if (this.xhr.setRequestHeader) {
  41994. this.xhr.setRequestHeader("Content-Type", "application/json");
  41995. }
  41996. this.xhr.send(payload);
  41997. };
  41998. HTTPRequest.prototype.close = function () {
  41999. if (this.unloader) {
  42000. runtime.removeUnloadListener(this.unloader);
  42001. this.unloader = null;
  42002. }
  42003. if (this.xhr) {
  42004. this.hooks.abortRequest(this.xhr);
  42005. this.xhr = null;
  42006. }
  42007. };
  42008. HTTPRequest.prototype.onChunk = function (status, data) {
  42009. while (true) {
  42010. var chunk = this.advanceBuffer(data);
  42011. if (chunk) {
  42012. this.emit("chunk", { status: status, data: chunk });
  42013. }
  42014. else {
  42015. break;
  42016. }
  42017. }
  42018. if (this.isBufferTooLong(data)) {
  42019. this.emit("buffer_too_long");
  42020. }
  42021. };
  42022. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42023. var unreadData = buffer.slice(this.position);
  42024. var endOfLinePosition = unreadData.indexOf("\n");
  42025. if (endOfLinePosition !== -1) {
  42026. this.position += endOfLinePosition + 1;
  42027. return unreadData.slice(0, endOfLinePosition);
  42028. }
  42029. else {
  42030. return null;
  42031. }
  42032. };
  42033. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42034. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42035. };
  42036. return HTTPRequest;
  42037. }(dispatcher));
  42038. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42039. // CONCATENATED MODULE: ./src/core/http/state.ts
  42040. var State;
  42041. (function (State) {
  42042. State[State["CONNECTING"] = 0] = "CONNECTING";
  42043. State[State["OPEN"] = 1] = "OPEN";
  42044. State[State["CLOSED"] = 3] = "CLOSED";
  42045. })(State || (State = {}));
  42046. /* harmony default export */ var state = (State);
  42047. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42048. var autoIncrement = 1;
  42049. var http_socket_HTTPSocket = (function () {
  42050. function HTTPSocket(hooks, url) {
  42051. this.hooks = hooks;
  42052. this.session = randomNumber(1000) + "/" + randomString(8);
  42053. this.location = getLocation(url);
  42054. this.readyState = state.CONNECTING;
  42055. this.openStream();
  42056. }
  42057. HTTPSocket.prototype.send = function (payload) {
  42058. return this.sendRaw(JSON.stringify([payload]));
  42059. };
  42060. HTTPSocket.prototype.ping = function () {
  42061. this.hooks.sendHeartbeat(this);
  42062. };
  42063. HTTPSocket.prototype.close = function (code, reason) {
  42064. this.onClose(code, reason, true);
  42065. };
  42066. HTTPSocket.prototype.sendRaw = function (payload) {
  42067. if (this.readyState === state.OPEN) {
  42068. try {
  42069. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42070. return true;
  42071. }
  42072. catch (e) {
  42073. return false;
  42074. }
  42075. }
  42076. else {
  42077. return false;
  42078. }
  42079. };
  42080. HTTPSocket.prototype.reconnect = function () {
  42081. this.closeStream();
  42082. this.openStream();
  42083. };
  42084. ;
  42085. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42086. this.closeStream();
  42087. this.readyState = state.CLOSED;
  42088. if (this.onclose) {
  42089. this.onclose({
  42090. code: code,
  42091. reason: reason,
  42092. wasClean: wasClean
  42093. });
  42094. }
  42095. };
  42096. HTTPSocket.prototype.onChunk = function (chunk) {
  42097. if (chunk.status !== 200) {
  42098. return;
  42099. }
  42100. if (this.readyState === state.OPEN) {
  42101. this.onActivity();
  42102. }
  42103. var payload;
  42104. var type = chunk.data.slice(0, 1);
  42105. switch (type) {
  42106. case 'o':
  42107. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42108. this.onOpen(payload);
  42109. break;
  42110. case 'a':
  42111. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42112. for (var i = 0; i < payload.length; i++) {
  42113. this.onEvent(payload[i]);
  42114. }
  42115. break;
  42116. case 'm':
  42117. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42118. this.onEvent(payload);
  42119. break;
  42120. case 'h':
  42121. this.hooks.onHeartbeat(this);
  42122. break;
  42123. case 'c':
  42124. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42125. this.onClose(payload[0], payload[1], true);
  42126. break;
  42127. }
  42128. };
  42129. HTTPSocket.prototype.onOpen = function (options) {
  42130. if (this.readyState === state.CONNECTING) {
  42131. if (options && options.hostname) {
  42132. this.location.base = replaceHost(this.location.base, options.hostname);
  42133. }
  42134. this.readyState = state.OPEN;
  42135. if (this.onopen) {
  42136. this.onopen();
  42137. }
  42138. }
  42139. else {
  42140. this.onClose(1006, "Server lost session", true);
  42141. }
  42142. };
  42143. HTTPSocket.prototype.onEvent = function (event) {
  42144. if (this.readyState === state.OPEN && this.onmessage) {
  42145. this.onmessage({ data: event });
  42146. }
  42147. };
  42148. HTTPSocket.prototype.onActivity = function () {
  42149. if (this.onactivity) {
  42150. this.onactivity();
  42151. }
  42152. };
  42153. HTTPSocket.prototype.onError = function (error) {
  42154. if (this.onerror) {
  42155. this.onerror(error);
  42156. }
  42157. };
  42158. HTTPSocket.prototype.openStream = function () {
  42159. var _this = this;
  42160. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42161. this.stream.bind("chunk", function (chunk) {
  42162. _this.onChunk(chunk);
  42163. });
  42164. this.stream.bind("finished", function (status) {
  42165. _this.hooks.onFinished(_this, status);
  42166. });
  42167. this.stream.bind("buffer_too_long", function () {
  42168. _this.reconnect();
  42169. });
  42170. try {
  42171. this.stream.start();
  42172. }
  42173. catch (error) {
  42174. util.defer(function () {
  42175. _this.onError(error);
  42176. _this.onClose(1006, "Could not start streaming", false);
  42177. });
  42178. }
  42179. };
  42180. HTTPSocket.prototype.closeStream = function () {
  42181. if (this.stream) {
  42182. this.stream.unbind_all();
  42183. this.stream.close();
  42184. this.stream = null;
  42185. }
  42186. };
  42187. return HTTPSocket;
  42188. }());
  42189. function getLocation(url) {
  42190. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42191. return {
  42192. base: parts[1],
  42193. queryString: parts[2]
  42194. };
  42195. }
  42196. function getSendURL(url, session) {
  42197. return url.base + "/" + session + "/xhr_send";
  42198. }
  42199. function getUniqueURL(url) {
  42200. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42201. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42202. }
  42203. function replaceHost(url, hostname) {
  42204. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42205. return urlParts[1] + hostname + urlParts[3];
  42206. }
  42207. function randomNumber(max) {
  42208. return Math.floor(Math.random() * max);
  42209. }
  42210. function randomString(length) {
  42211. var result = [];
  42212. for (var i = 0; i < length; i++) {
  42213. result.push(randomNumber(32).toString(32));
  42214. }
  42215. return result.join('');
  42216. }
  42217. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42218. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42219. var http_streaming_socket_hooks = {
  42220. getReceiveURL: function (url, session) {
  42221. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42222. },
  42223. onHeartbeat: function (socket) {
  42224. socket.sendRaw("[]");
  42225. },
  42226. sendHeartbeat: function (socket) {
  42227. socket.sendRaw("[]");
  42228. },
  42229. onFinished: function (socket, status) {
  42230. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42231. }
  42232. };
  42233. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42234. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42235. var http_polling_socket_hooks = {
  42236. getReceiveURL: function (url, session) {
  42237. return url.base + "/" + session + "/xhr" + url.queryString;
  42238. },
  42239. onHeartbeat: function () {
  42240. },
  42241. sendHeartbeat: function (socket) {
  42242. socket.sendRaw("[]");
  42243. },
  42244. onFinished: function (socket, status) {
  42245. if (status === 200) {
  42246. socket.reconnect();
  42247. }
  42248. else {
  42249. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42250. }
  42251. }
  42252. };
  42253. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42254. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42255. var http_xhr_request_hooks = {
  42256. getRequest: function (socket) {
  42257. var Constructor = runtime.getXHRAPI();
  42258. var xhr = new Constructor();
  42259. xhr.onreadystatechange = xhr.onprogress = function () {
  42260. switch (xhr.readyState) {
  42261. case 3:
  42262. if (xhr.responseText && xhr.responseText.length > 0) {
  42263. socket.onChunk(xhr.status, xhr.responseText);
  42264. }
  42265. break;
  42266. case 4:
  42267. if (xhr.responseText && xhr.responseText.length > 0) {
  42268. socket.onChunk(xhr.status, xhr.responseText);
  42269. }
  42270. socket.emit("finished", xhr.status);
  42271. socket.close();
  42272. break;
  42273. }
  42274. };
  42275. return xhr;
  42276. },
  42277. abortRequest: function (xhr) {
  42278. xhr.onreadystatechange = null;
  42279. xhr.abort();
  42280. }
  42281. };
  42282. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42283. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42284. var HTTP = {
  42285. createStreamingSocket: function (url) {
  42286. return this.createSocket(http_streaming_socket, url);
  42287. },
  42288. createPollingSocket: function (url) {
  42289. return this.createSocket(http_polling_socket, url);
  42290. },
  42291. createSocket: function (hooks, url) {
  42292. return new http_socket(hooks, url);
  42293. },
  42294. createXHR: function (method, url) {
  42295. return this.createRequest(http_xhr_request, method, url);
  42296. },
  42297. createRequest: function (hooks, method, url) {
  42298. return new http_request(hooks, method, url);
  42299. }
  42300. };
  42301. /* harmony default export */ var http_http = (HTTP);
  42302. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42303. http_http.createXDR = function (method, url) {
  42304. return this.createRequest(http_xdomain_request, method, url);
  42305. };
  42306. /* harmony default export */ var web_http_http = (http_http);
  42307. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42308. var Runtime = {
  42309. nextAuthCallbackID: 1,
  42310. auth_callbacks: {},
  42311. ScriptReceivers: ScriptReceivers,
  42312. DependenciesReceivers: DependenciesReceivers,
  42313. getDefaultStrategy: default_strategy,
  42314. Transports: transports_transports,
  42315. transportConnectionInitializer: transport_connection_initializer,
  42316. HTTPFactory: web_http_http,
  42317. TimelineTransport: jsonp_timeline,
  42318. getXHRAPI: function () {
  42319. return window.XMLHttpRequest;
  42320. },
  42321. getWebSocketAPI: function () {
  42322. return window.WebSocket || window.MozWebSocket;
  42323. },
  42324. setup: function (PusherClass) {
  42325. var _this = this;
  42326. window.Pusher = PusherClass;
  42327. var initializeOnDocumentBody = function () {
  42328. _this.onDocumentBody(PusherClass.ready);
  42329. };
  42330. if (!window.JSON) {
  42331. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42332. }
  42333. else {
  42334. initializeOnDocumentBody();
  42335. }
  42336. },
  42337. getDocument: function () {
  42338. return document;
  42339. },
  42340. getProtocol: function () {
  42341. return this.getDocument().location.protocol;
  42342. },
  42343. getAuthorizers: function () {
  42344. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42345. },
  42346. onDocumentBody: function (callback) {
  42347. var _this = this;
  42348. if (document.body) {
  42349. callback();
  42350. }
  42351. else {
  42352. setTimeout(function () {
  42353. _this.onDocumentBody(callback);
  42354. }, 0);
  42355. }
  42356. },
  42357. createJSONPRequest: function (url, data) {
  42358. return new jsonp_request(url, data);
  42359. },
  42360. createScriptRequest: function (src) {
  42361. return new script_request(src);
  42362. },
  42363. getLocalStorage: function () {
  42364. try {
  42365. return window.localStorage;
  42366. }
  42367. catch (e) {
  42368. return undefined;
  42369. }
  42370. },
  42371. createXHR: function () {
  42372. if (this.getXHRAPI()) {
  42373. return this.createXMLHttpRequest();
  42374. }
  42375. else {
  42376. return this.createMicrosoftXHR();
  42377. }
  42378. },
  42379. createXMLHttpRequest: function () {
  42380. var Constructor = this.getXHRAPI();
  42381. return new Constructor();
  42382. },
  42383. createMicrosoftXHR: function () {
  42384. return new ActiveXObject("Microsoft.XMLHTTP");
  42385. },
  42386. getNetwork: function () {
  42387. return net_info_Network;
  42388. },
  42389. createWebSocket: function (url) {
  42390. var Constructor = this.getWebSocketAPI();
  42391. return new Constructor(url);
  42392. },
  42393. createSocketRequest: function (method, url) {
  42394. if (this.isXHRSupported()) {
  42395. return this.HTTPFactory.createXHR(method, url);
  42396. }
  42397. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42398. return this.HTTPFactory.createXDR(method, url);
  42399. }
  42400. else {
  42401. throw "Cross-origin HTTP requests are not supported";
  42402. }
  42403. },
  42404. isXHRSupported: function () {
  42405. var Constructor = this.getXHRAPI();
  42406. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42407. },
  42408. isXDRSupported: function (useTLS) {
  42409. var protocol = useTLS ? "https:" : "http:";
  42410. var documentProtocol = this.getProtocol();
  42411. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42412. },
  42413. addUnloadListener: function (listener) {
  42414. if (window.addEventListener !== undefined) {
  42415. window.addEventListener("unload", listener, false);
  42416. }
  42417. else if (window.attachEvent !== undefined) {
  42418. window.attachEvent("onunload", listener);
  42419. }
  42420. },
  42421. removeUnloadListener: function (listener) {
  42422. if (window.addEventListener !== undefined) {
  42423. window.removeEventListener("unload", listener, false);
  42424. }
  42425. else if (window.detachEvent !== undefined) {
  42426. window.detachEvent("onunload", listener);
  42427. }
  42428. }
  42429. };
  42430. /* harmony default export */ var runtime = (Runtime);
  42431. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42432. var TimelineLevel;
  42433. (function (TimelineLevel) {
  42434. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42435. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42436. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42437. })(TimelineLevel || (TimelineLevel = {}));
  42438. /* harmony default export */ var timeline_level = (TimelineLevel);
  42439. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42440. var timeline_Timeline = (function () {
  42441. function Timeline(key, session, options) {
  42442. this.key = key;
  42443. this.session = session;
  42444. this.events = [];
  42445. this.options = options || {};
  42446. this.sent = 0;
  42447. this.uniqueID = 0;
  42448. }
  42449. Timeline.prototype.log = function (level, event) {
  42450. if (level <= this.options.level) {
  42451. this.events.push(extend({}, event, { timestamp: util.now() }));
  42452. if (this.options.limit && this.events.length > this.options.limit) {
  42453. this.events.shift();
  42454. }
  42455. }
  42456. };
  42457. Timeline.prototype.error = function (event) {
  42458. this.log(timeline_level.ERROR, event);
  42459. };
  42460. Timeline.prototype.info = function (event) {
  42461. this.log(timeline_level.INFO, event);
  42462. };
  42463. Timeline.prototype.debug = function (event) {
  42464. this.log(timeline_level.DEBUG, event);
  42465. };
  42466. Timeline.prototype.isEmpty = function () {
  42467. return this.events.length === 0;
  42468. };
  42469. Timeline.prototype.send = function (sendfn, callback) {
  42470. var _this = this;
  42471. var data = extend({
  42472. session: this.session,
  42473. bundle: this.sent + 1,
  42474. key: this.key,
  42475. lib: "js",
  42476. version: this.options.version,
  42477. cluster: this.options.cluster,
  42478. features: this.options.features,
  42479. timeline: this.events
  42480. }, this.options.params);
  42481. this.events = [];
  42482. sendfn(data, function (error, result) {
  42483. if (!error) {
  42484. _this.sent++;
  42485. }
  42486. if (callback) {
  42487. callback(error, result);
  42488. }
  42489. });
  42490. return true;
  42491. };
  42492. Timeline.prototype.generateUniqueID = function () {
  42493. this.uniqueID++;
  42494. return this.uniqueID;
  42495. };
  42496. return Timeline;
  42497. }());
  42498. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42499. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42500. var transport_strategy_TransportStrategy = (function () {
  42501. function TransportStrategy(name, priority, transport, options) {
  42502. this.name = name;
  42503. this.priority = priority;
  42504. this.transport = transport;
  42505. this.options = options || {};
  42506. }
  42507. TransportStrategy.prototype.isSupported = function () {
  42508. return this.transport.isSupported({
  42509. useTLS: this.options.useTLS
  42510. });
  42511. };
  42512. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42513. var _this = this;
  42514. if (!this.isSupported()) {
  42515. return failAttempt(new UnsupportedStrategy(), callback);
  42516. }
  42517. else if (this.priority < minPriority) {
  42518. return failAttempt(new TransportPriorityTooLow(), callback);
  42519. }
  42520. var connected = false;
  42521. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42522. var handshake = null;
  42523. var onInitialized = function () {
  42524. transport.unbind("initialized", onInitialized);
  42525. transport.connect();
  42526. };
  42527. var onOpen = function () {
  42528. handshake = factory.createHandshake(transport, function (result) {
  42529. connected = true;
  42530. unbindListeners();
  42531. callback(null, result);
  42532. });
  42533. };
  42534. var onError = function (error) {
  42535. unbindListeners();
  42536. callback(error);
  42537. };
  42538. var onClosed = function () {
  42539. unbindListeners();
  42540. var serializedTransport;
  42541. serializedTransport = safeJSONStringify(transport);
  42542. callback(new TransportClosed(serializedTransport));
  42543. };
  42544. var unbindListeners = function () {
  42545. transport.unbind("initialized", onInitialized);
  42546. transport.unbind("open", onOpen);
  42547. transport.unbind("error", onError);
  42548. transport.unbind("closed", onClosed);
  42549. };
  42550. transport.bind("initialized", onInitialized);
  42551. transport.bind("open", onOpen);
  42552. transport.bind("error", onError);
  42553. transport.bind("closed", onClosed);
  42554. transport.initialize();
  42555. return {
  42556. abort: function () {
  42557. if (connected) {
  42558. return;
  42559. }
  42560. unbindListeners();
  42561. if (handshake) {
  42562. handshake.close();
  42563. }
  42564. else {
  42565. transport.close();
  42566. }
  42567. },
  42568. forceMinPriority: function (p) {
  42569. if (connected) {
  42570. return;
  42571. }
  42572. if (_this.priority < p) {
  42573. if (handshake) {
  42574. handshake.close();
  42575. }
  42576. else {
  42577. transport.close();
  42578. }
  42579. }
  42580. }
  42581. };
  42582. };
  42583. return TransportStrategy;
  42584. }());
  42585. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42586. function failAttempt(error, callback) {
  42587. util.defer(function () {
  42588. callback(error);
  42589. });
  42590. return {
  42591. abort: function () { },
  42592. forceMinPriority: function () { }
  42593. };
  42594. }
  42595. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42596. var strategy_builder_Transports = runtime.Transports;
  42597. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42598. var transportClass = strategy_builder_Transports[type];
  42599. if (!transportClass) {
  42600. throw new UnsupportedTransport(type);
  42601. }
  42602. var enabled = (!config.enabledTransports ||
  42603. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42604. (!config.disabledTransports ||
  42605. arrayIndexOf(config.disabledTransports, name) === -1);
  42606. var transport;
  42607. if (enabled) {
  42608. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42609. key: config.key,
  42610. useTLS: config.useTLS,
  42611. timeline: config.timeline,
  42612. ignoreNullOrigin: config.ignoreNullOrigin
  42613. }, options));
  42614. }
  42615. else {
  42616. transport = strategy_builder_UnsupportedStrategy;
  42617. }
  42618. return transport;
  42619. };
  42620. var strategy_builder_UnsupportedStrategy = {
  42621. isSupported: function () {
  42622. return false;
  42623. },
  42624. connect: function (_, callback) {
  42625. var deferred = util.defer(function () {
  42626. callback(new UnsupportedStrategy());
  42627. });
  42628. return {
  42629. abort: function () {
  42630. deferred.ensureAborted();
  42631. },
  42632. forceMinPriority: function () { }
  42633. };
  42634. }
  42635. };
  42636. // CONCATENATED MODULE: ./src/core/config.ts
  42637. var getGlobalConfig = function () {
  42638. return {
  42639. wsHost: defaults.host,
  42640. wsPort: defaults.ws_port,
  42641. wssPort: defaults.wss_port,
  42642. wsPath: defaults.ws_path,
  42643. httpHost: defaults.sockjs_host,
  42644. httpPort: defaults.sockjs_http_port,
  42645. httpsPort: defaults.sockjs_https_port,
  42646. httpPath: defaults.sockjs_path,
  42647. statsHost: defaults.stats_host,
  42648. authEndpoint: defaults.channel_auth_endpoint,
  42649. authTransport: defaults.channel_auth_transport,
  42650. activity_timeout: defaults.activity_timeout,
  42651. pong_timeout: defaults.pong_timeout,
  42652. unavailable_timeout: defaults.unavailable_timeout
  42653. };
  42654. };
  42655. var getClusterConfig = function (clusterName) {
  42656. return {
  42657. wsHost: 'ws-' + clusterName + '.pusher.com',
  42658. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42659. };
  42660. };
  42661. // CONCATENATED MODULE: ./src/core/pusher.ts
  42662. var pusher_Pusher = (function () {
  42663. function Pusher(app_key, options) {
  42664. var _this = this;
  42665. checkAppKey(app_key);
  42666. options = options || {};
  42667. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42668. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42669. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42670. }
  42671. this.key = app_key;
  42672. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42673. this.channels = factory.createChannels();
  42674. this.global_emitter = new dispatcher();
  42675. this.sessionID = Math.floor(Math.random() * 1000000000);
  42676. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42677. cluster: this.config.cluster,
  42678. features: Pusher.getClientFeatures(),
  42679. params: this.config.timelineParams || {},
  42680. limit: 50,
  42681. level: timeline_level.INFO,
  42682. version: defaults.VERSION
  42683. });
  42684. if (!this.config.disableStats) {
  42685. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42686. host: this.config.statsHost,
  42687. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42688. });
  42689. }
  42690. var getStrategy = function (options) {
  42691. var config = extend({}, _this.config, options);
  42692. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42693. };
  42694. this.connection = factory.createConnectionManager(this.key, extend({
  42695. getStrategy: getStrategy,
  42696. timeline: this.timeline,
  42697. activityTimeout: this.config.activity_timeout,
  42698. pongTimeout: this.config.pong_timeout,
  42699. unavailableTimeout: this.config.unavailable_timeout
  42700. }, this.config, { useTLS: this.shouldUseTLS() }));
  42701. this.connection.bind('connected', function () {
  42702. _this.subscribeAll();
  42703. if (_this.timelineSender) {
  42704. _this.timelineSender.send(_this.connection.isUsingTLS());
  42705. }
  42706. });
  42707. this.connection.bind('message', function (event) {
  42708. var eventName = event.event;
  42709. var internal = eventName.indexOf('pusher_internal:') === 0;
  42710. if (event.channel) {
  42711. var channel = _this.channel(event.channel);
  42712. if (channel) {
  42713. channel.handleEvent(event);
  42714. }
  42715. }
  42716. if (!internal) {
  42717. _this.global_emitter.emit(event.event, event.data);
  42718. }
  42719. });
  42720. this.connection.bind('connecting', function () {
  42721. _this.channels.disconnect();
  42722. });
  42723. this.connection.bind('disconnected', function () {
  42724. _this.channels.disconnect();
  42725. });
  42726. this.connection.bind('error', function (err) {
  42727. logger.warn(err);
  42728. });
  42729. Pusher.instances.push(this);
  42730. this.timeline.info({ instances: Pusher.instances.length });
  42731. if (Pusher.isReady) {
  42732. this.connect();
  42733. }
  42734. }
  42735. Pusher.ready = function () {
  42736. Pusher.isReady = true;
  42737. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42738. Pusher.instances[i].connect();
  42739. }
  42740. };
  42741. Pusher.getClientFeatures = function () {
  42742. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42743. return t.isSupported({});
  42744. }));
  42745. };
  42746. Pusher.prototype.channel = function (name) {
  42747. return this.channels.find(name);
  42748. };
  42749. Pusher.prototype.allChannels = function () {
  42750. return this.channels.all();
  42751. };
  42752. Pusher.prototype.connect = function () {
  42753. this.connection.connect();
  42754. if (this.timelineSender) {
  42755. if (!this.timelineSenderTimer) {
  42756. var usingTLS = this.connection.isUsingTLS();
  42757. var timelineSender = this.timelineSender;
  42758. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42759. timelineSender.send(usingTLS);
  42760. });
  42761. }
  42762. }
  42763. };
  42764. Pusher.prototype.disconnect = function () {
  42765. this.connection.disconnect();
  42766. if (this.timelineSenderTimer) {
  42767. this.timelineSenderTimer.ensureAborted();
  42768. this.timelineSenderTimer = null;
  42769. }
  42770. };
  42771. Pusher.prototype.bind = function (event_name, callback, context) {
  42772. this.global_emitter.bind(event_name, callback, context);
  42773. return this;
  42774. };
  42775. Pusher.prototype.unbind = function (event_name, callback, context) {
  42776. this.global_emitter.unbind(event_name, callback, context);
  42777. return this;
  42778. };
  42779. Pusher.prototype.bind_global = function (callback) {
  42780. this.global_emitter.bind_global(callback);
  42781. return this;
  42782. };
  42783. Pusher.prototype.unbind_global = function (callback) {
  42784. this.global_emitter.unbind_global(callback);
  42785. return this;
  42786. };
  42787. Pusher.prototype.unbind_all = function (callback) {
  42788. this.global_emitter.unbind_all();
  42789. return this;
  42790. };
  42791. Pusher.prototype.subscribeAll = function () {
  42792. var channelName;
  42793. for (channelName in this.channels.channels) {
  42794. if (this.channels.channels.hasOwnProperty(channelName)) {
  42795. this.subscribe(channelName);
  42796. }
  42797. }
  42798. };
  42799. Pusher.prototype.subscribe = function (channel_name) {
  42800. var channel = this.channels.add(channel_name, this);
  42801. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42802. channel.reinstateSubscription();
  42803. }
  42804. else if (!channel.subscriptionPending &&
  42805. this.connection.state === 'connected') {
  42806. channel.subscribe();
  42807. }
  42808. return channel;
  42809. };
  42810. Pusher.prototype.unsubscribe = function (channel_name) {
  42811. var channel = this.channels.find(channel_name);
  42812. if (channel && channel.subscriptionPending) {
  42813. channel.cancelSubscription();
  42814. }
  42815. else {
  42816. channel = this.channels.remove(channel_name);
  42817. if (channel && this.connection.state === 'connected') {
  42818. channel.unsubscribe();
  42819. }
  42820. }
  42821. };
  42822. Pusher.prototype.send_event = function (event_name, data, channel) {
  42823. return this.connection.send_event(event_name, data, channel);
  42824. };
  42825. Pusher.prototype.shouldUseTLS = function () {
  42826. if (runtime.getProtocol() === 'https:') {
  42827. return true;
  42828. }
  42829. else if (this.config.forceTLS === true) {
  42830. return true;
  42831. }
  42832. else {
  42833. return Boolean(this.config.encrypted);
  42834. }
  42835. };
  42836. Pusher.instances = [];
  42837. Pusher.isReady = false;
  42838. Pusher.logToConsole = false;
  42839. Pusher.Runtime = runtime;
  42840. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42841. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42842. Pusher.auth_callbacks = runtime.auth_callbacks;
  42843. return Pusher;
  42844. }());
  42845. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42846. function checkAppKey(key) {
  42847. if (key === null || key === undefined) {
  42848. throw 'You must pass your app key when you instantiate Pusher.';
  42849. }
  42850. }
  42851. runtime.setup(pusher_Pusher);
  42852. /***/ })
  42853. /******/ ]);
  42854. });
  42855. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42856. /***/ }),
  42857. /***/ "./node_modules/setimmediate/setImmediate.js":
  42858. /*!***************************************************!*\
  42859. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42860. \***************************************************/
  42861. /*! no static exports found */
  42862. /***/ (function(module, exports, __webpack_require__) {
  42863. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42864. "use strict";
  42865. if (global.setImmediate) {
  42866. return;
  42867. }
  42868. var nextHandle = 1; // Spec says greater than zero
  42869. var tasksByHandle = {};
  42870. var currentlyRunningATask = false;
  42871. var doc = global.document;
  42872. var registerImmediate;
  42873. function setImmediate(callback) {
  42874. // Callback can either be a function or a string
  42875. if (typeof callback !== "function") {
  42876. callback = new Function("" + callback);
  42877. }
  42878. // Copy function arguments
  42879. var args = new Array(arguments.length - 1);
  42880. for (var i = 0; i < args.length; i++) {
  42881. args[i] = arguments[i + 1];
  42882. }
  42883. // Store and register the task
  42884. var task = { callback: callback, args: args };
  42885. tasksByHandle[nextHandle] = task;
  42886. registerImmediate(nextHandle);
  42887. return nextHandle++;
  42888. }
  42889. function clearImmediate(handle) {
  42890. delete tasksByHandle[handle];
  42891. }
  42892. function run(task) {
  42893. var callback = task.callback;
  42894. var args = task.args;
  42895. switch (args.length) {
  42896. case 0:
  42897. callback();
  42898. break;
  42899. case 1:
  42900. callback(args[0]);
  42901. break;
  42902. case 2:
  42903. callback(args[0], args[1]);
  42904. break;
  42905. case 3:
  42906. callback(args[0], args[1], args[2]);
  42907. break;
  42908. default:
  42909. callback.apply(undefined, args);
  42910. break;
  42911. }
  42912. }
  42913. function runIfPresent(handle) {
  42914. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42915. // So if we're currently running a task, we'll need to delay this invocation.
  42916. if (currentlyRunningATask) {
  42917. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42918. // "too much recursion" error.
  42919. setTimeout(runIfPresent, 0, handle);
  42920. } else {
  42921. var task = tasksByHandle[handle];
  42922. if (task) {
  42923. currentlyRunningATask = true;
  42924. try {
  42925. run(task);
  42926. } finally {
  42927. clearImmediate(handle);
  42928. currentlyRunningATask = false;
  42929. }
  42930. }
  42931. }
  42932. }
  42933. function installNextTickImplementation() {
  42934. registerImmediate = function(handle) {
  42935. process.nextTick(function () { runIfPresent(handle); });
  42936. };
  42937. }
  42938. function canUsePostMessage() {
  42939. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42940. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42941. if (global.postMessage && !global.importScripts) {
  42942. var postMessageIsAsynchronous = true;
  42943. var oldOnMessage = global.onmessage;
  42944. global.onmessage = function() {
  42945. postMessageIsAsynchronous = false;
  42946. };
  42947. global.postMessage("", "*");
  42948. global.onmessage = oldOnMessage;
  42949. return postMessageIsAsynchronous;
  42950. }
  42951. }
  42952. function installPostMessageImplementation() {
  42953. // Installs an event handler on `global` for the `message` event: see
  42954. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42955. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42956. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42957. var onGlobalMessage = function(event) {
  42958. if (event.source === global &&
  42959. typeof event.data === "string" &&
  42960. event.data.indexOf(messagePrefix) === 0) {
  42961. runIfPresent(+event.data.slice(messagePrefix.length));
  42962. }
  42963. };
  42964. if (global.addEventListener) {
  42965. global.addEventListener("message", onGlobalMessage, false);
  42966. } else {
  42967. global.attachEvent("onmessage", onGlobalMessage);
  42968. }
  42969. registerImmediate = function(handle) {
  42970. global.postMessage(messagePrefix + handle, "*");
  42971. };
  42972. }
  42973. function installMessageChannelImplementation() {
  42974. var channel = new MessageChannel();
  42975. channel.port1.onmessage = function(event) {
  42976. var handle = event.data;
  42977. runIfPresent(handle);
  42978. };
  42979. registerImmediate = function(handle) {
  42980. channel.port2.postMessage(handle);
  42981. };
  42982. }
  42983. function installReadyStateChangeImplementation() {
  42984. var html = doc.documentElement;
  42985. registerImmediate = function(handle) {
  42986. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42987. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42988. var script = doc.createElement("script");
  42989. script.onreadystatechange = function () {
  42990. runIfPresent(handle);
  42991. script.onreadystatechange = null;
  42992. html.removeChild(script);
  42993. script = null;
  42994. };
  42995. html.appendChild(script);
  42996. };
  42997. }
  42998. function installSetTimeoutImplementation() {
  42999. registerImmediate = function(handle) {
  43000. setTimeout(runIfPresent, 0, handle);
  43001. };
  43002. }
  43003. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43004. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43005. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43006. // Don't get fooled by e.g. browserify environments.
  43007. if ({}.toString.call(global.process) === "[object process]") {
  43008. // For Node.js before 0.9
  43009. installNextTickImplementation();
  43010. } else if (canUsePostMessage()) {
  43011. // For non-IE10 modern browsers
  43012. installPostMessageImplementation();
  43013. } else if (global.MessageChannel) {
  43014. // For web workers, where supported
  43015. installMessageChannelImplementation();
  43016. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43017. // For IE 6–8
  43018. installReadyStateChangeImplementation();
  43019. } else {
  43020. // For older browsers
  43021. installSetTimeoutImplementation();
  43022. }
  43023. attachTo.setImmediate = setImmediate;
  43024. attachTo.clearImmediate = clearImmediate;
  43025. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43026. /* 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")))
  43027. /***/ }),
  43028. /***/ "./node_modules/timers-browserify/main.js":
  43029. /*!************************************************!*\
  43030. !*** ./node_modules/timers-browserify/main.js ***!
  43031. \************************************************/
  43032. /*! no static exports found */
  43033. /***/ (function(module, exports, __webpack_require__) {
  43034. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43035. (typeof self !== "undefined" && self) ||
  43036. window;
  43037. var apply = Function.prototype.apply;
  43038. // DOM APIs, for completeness
  43039. exports.setTimeout = function() {
  43040. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43041. };
  43042. exports.setInterval = function() {
  43043. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43044. };
  43045. exports.clearTimeout =
  43046. exports.clearInterval = function(timeout) {
  43047. if (timeout) {
  43048. timeout.close();
  43049. }
  43050. };
  43051. function Timeout(id, clearFn) {
  43052. this._id = id;
  43053. this._clearFn = clearFn;
  43054. }
  43055. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43056. Timeout.prototype.close = function() {
  43057. this._clearFn.call(scope, this._id);
  43058. };
  43059. // Does not start the time, just sets up the members needed.
  43060. exports.enroll = function(item, msecs) {
  43061. clearTimeout(item._idleTimeoutId);
  43062. item._idleTimeout = msecs;
  43063. };
  43064. exports.unenroll = function(item) {
  43065. clearTimeout(item._idleTimeoutId);
  43066. item._idleTimeout = -1;
  43067. };
  43068. exports._unrefActive = exports.active = function(item) {
  43069. clearTimeout(item._idleTimeoutId);
  43070. var msecs = item._idleTimeout;
  43071. if (msecs >= 0) {
  43072. item._idleTimeoutId = setTimeout(function onTimeout() {
  43073. if (item._onTimeout)
  43074. item._onTimeout();
  43075. }, msecs);
  43076. }
  43077. };
  43078. // setimmediate attaches itself to the global object
  43079. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43080. // On some exotic environments, it's not clear which object `setimmediate` was
  43081. // able to install onto. Search each possibility in the same order as the
  43082. // `setimmediate` library.
  43083. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43084. (typeof global !== "undefined" && global.setImmediate) ||
  43085. (this && this.setImmediate);
  43086. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43087. (typeof global !== "undefined" && global.clearImmediate) ||
  43088. (this && this.clearImmediate);
  43089. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43090. /***/ }),
  43091. /***/ "./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&":
  43092. /*!*******************************************************************************************************************************************************************************************************************!*\
  43093. !*** ./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& ***!
  43094. \*******************************************************************************************************************************************************************************************************************/
  43095. /*! exports provided: render, staticRenderFns */
  43096. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43097. "use strict";
  43098. __webpack_require__.r(__webpack_exports__);
  43099. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43101. var render = function() {
  43102. var _vm = this
  43103. var _h = _vm.$createElement
  43104. var _c = _vm._self._c || _h
  43105. return _vm._m(0)
  43106. }
  43107. var staticRenderFns = [
  43108. function() {
  43109. var _vm = this
  43110. var _h = _vm.$createElement
  43111. var _c = _vm._self._c || _h
  43112. return _c("div", { staticClass: "container" }, [
  43113. _c("div", { staticClass: "row justify-content-center" }, [
  43114. _c("div", { staticClass: "col-md-8" }, [
  43115. _c("div", { staticClass: "card" }, [
  43116. _c("div", { staticClass: "card-header" }, [
  43117. _vm._v("Example Component")
  43118. ]),
  43119. _vm._v(" "),
  43120. _c("div", { staticClass: "card-body" }, [
  43121. _vm._v(
  43122. "\n I'm an example component.\n "
  43123. )
  43124. ])
  43125. ])
  43126. ])
  43127. ])
  43128. ])
  43129. }
  43130. ]
  43131. render._withStripped = true
  43132. /***/ }),
  43133. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  43134. /*!************************************************************************************************************************************************************************************************************!*\
  43135. !*** ./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& ***!
  43136. \************************************************************************************************************************************************************************************************************/
  43137. /*! exports provided: render, staticRenderFns */
  43138. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43139. "use strict";
  43140. __webpack_require__.r(__webpack_exports__);
  43141. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43142. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43143. var render = function() {
  43144. var _vm = this
  43145. var _h = _vm.$createElement
  43146. var _c = _vm._self._c || _h
  43147. return _c(
  43148. "div",
  43149. [
  43150. _c(
  43151. "modal",
  43152. {
  43153. attrs: {
  43154. id: "asseteditModal",
  43155. tabindex: "-1",
  43156. role: "dialog",
  43157. "aria-labelledby": "asseteditModalLabel"
  43158. }
  43159. },
  43160. [
  43161. _c(
  43162. "h5",
  43163. {
  43164. staticClass: "modal-title",
  43165. attrs: { slot: "header", id: "asseteditModalLabel" },
  43166. slot: "header"
  43167. },
  43168. [_vm._v("\n Edit Work Order Information\n ")]
  43169. ),
  43170. _vm._v(" "),
  43171. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43172. _c("div", { staticClass: "form-group" }, [
  43173. _c("label", { attrs: { for: "manufacturer" } }, [
  43174. _vm._v("Manufacturer")
  43175. ]),
  43176. _vm._v(" "),
  43177. _c("input", {
  43178. directives: [
  43179. {
  43180. name: "model",
  43181. rawName: "v-model.lazy",
  43182. value: _vm.data.pcmanu,
  43183. expression: "data.pcmanu",
  43184. modifiers: { lazy: true }
  43185. }
  43186. ],
  43187. staticClass: "form-control",
  43188. attrs: {
  43189. type: "text",
  43190. name: "manufacturer",
  43191. id: "manufacturer"
  43192. },
  43193. domProps: { value: _vm.data.pcmanu },
  43194. on: {
  43195. change: function($event) {
  43196. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43197. }
  43198. }
  43199. })
  43200. ]),
  43201. _vm._v(" "),
  43202. _c("div", { staticClass: "form-group" }, [
  43203. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43204. _vm._v(" "),
  43205. _c("input", {
  43206. directives: [
  43207. {
  43208. name: "model",
  43209. rawName: "v-model.lazy",
  43210. value: _vm.data.pcmake,
  43211. expression: "data.pcmake",
  43212. modifiers: { lazy: true }
  43213. }
  43214. ],
  43215. staticClass: "form-control",
  43216. attrs: { type: "text", name: "make", id: "make" },
  43217. domProps: { value: _vm.data.pcmake },
  43218. on: {
  43219. change: function($event) {
  43220. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43221. }
  43222. }
  43223. })
  43224. ]),
  43225. _vm._v(" "),
  43226. _c("div", { staticClass: "form-group" }, [
  43227. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43228. _vm._v(" "),
  43229. _c("input", {
  43230. directives: [
  43231. {
  43232. name: "model",
  43233. rawName: "v-model.lazy",
  43234. value: _vm.data.pcnickname,
  43235. expression: "data.pcnickname",
  43236. modifiers: { lazy: true }
  43237. }
  43238. ],
  43239. staticClass: "form-control",
  43240. attrs: { type: "text", name: "nickname", id: "nickname" },
  43241. domProps: { value: _vm.data.pcnickname },
  43242. on: {
  43243. change: function($event) {
  43244. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43245. }
  43246. }
  43247. })
  43248. ]),
  43249. _vm._v(" "),
  43250. _c("div", { staticClass: "form-group" }, [
  43251. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43252. _vm._v(" "),
  43253. _c("input", {
  43254. directives: [
  43255. {
  43256. name: "model",
  43257. rawName: "v-model.lazy",
  43258. value: _vm.pcextra[2],
  43259. expression: "pcextra[2]",
  43260. modifiers: { lazy: true }
  43261. }
  43262. ],
  43263. staticClass: "form-control",
  43264. attrs: { type: "text", name: "os", id: "os" },
  43265. domProps: { value: _vm.pcextra[2] },
  43266. on: {
  43267. change: function($event) {
  43268. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43269. }
  43270. }
  43271. })
  43272. ]),
  43273. _vm._v(" "),
  43274. _c("div", { staticClass: "form-group" }, [
  43275. _c("label", { attrs: { for: "serial" } }, [
  43276. _vm._v("Serial Number")
  43277. ]),
  43278. _vm._v(" "),
  43279. _c("input", {
  43280. directives: [
  43281. {
  43282. name: "model",
  43283. rawName: "v-model.lazy",
  43284. value: _vm.pcextra[104],
  43285. expression: "pcextra[104]",
  43286. modifiers: { lazy: true }
  43287. }
  43288. ],
  43289. staticClass: "form-control",
  43290. attrs: { type: "text", id: "serial", name: "serial" },
  43291. domProps: { value: _vm.pcextra[104] },
  43292. on: {
  43293. change: function($event) {
  43294. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43295. }
  43296. }
  43297. })
  43298. ]),
  43299. _vm._v(" "),
  43300. _c("div", { staticClass: "form-group" }, [
  43301. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43302. _vm._v(" "),
  43303. _c("input", {
  43304. directives: [
  43305. {
  43306. name: "model",
  43307. rawName: "v-model.lazy",
  43308. value: _vm.pcextra[101],
  43309. expression: "pcextra[101]",
  43310. modifiers: { lazy: true }
  43311. }
  43312. ],
  43313. staticClass: "form-control",
  43314. attrs: { type: "text", id: "cpu", name: "cpu" },
  43315. domProps: { value: _vm.pcextra[101] },
  43316. on: {
  43317. change: function($event) {
  43318. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43319. }
  43320. }
  43321. })
  43322. ]),
  43323. _vm._v(" "),
  43324. _c("div", { staticClass: "form-group" }, [
  43325. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43326. _vm._v(" "),
  43327. _c("input", {
  43328. directives: [
  43329. {
  43330. name: "model",
  43331. rawName: "v-model.lazy",
  43332. value: _vm.pcextra[100],
  43333. expression: "pcextra[100]",
  43334. modifiers: { lazy: true }
  43335. }
  43336. ],
  43337. staticClass: "form-control",
  43338. attrs: { type: "text", name: "ram", id: "ram" },
  43339. domProps: { value: _vm.pcextra[100] },
  43340. on: {
  43341. change: function($event) {
  43342. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43343. }
  43344. }
  43345. })
  43346. ]),
  43347. _vm._v(" "),
  43348. _c("div", { staticClass: "form-group" }, [
  43349. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43350. _vm._v(" "),
  43351. _c("input", {
  43352. directives: [
  43353. {
  43354. name: "model",
  43355. rawName: "v-model.lazy",
  43356. value: _vm.pcextra[4],
  43357. expression: "pcextra[4]",
  43358. modifiers: { lazy: true }
  43359. }
  43360. ],
  43361. staticClass: "form-control",
  43362. attrs: { type: "text", name: "graphics", id: "grapics" },
  43363. domProps: { value: _vm.pcextra[4] },
  43364. on: {
  43365. change: function($event) {
  43366. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43367. }
  43368. }
  43369. })
  43370. ])
  43371. ]),
  43372. _vm._v(" "),
  43373. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43374. _c(
  43375. "button",
  43376. {
  43377. staticClass: "btn btn-secondary",
  43378. attrs: { type: "button", "data-dismiss": "modal" }
  43379. },
  43380. [_vm._v("Close")]
  43381. ),
  43382. _vm._v(" "),
  43383. _c(
  43384. "button",
  43385. {
  43386. staticClass: "btn btn-primary",
  43387. attrs: { type: "button" },
  43388. on: {
  43389. click: function($event) {
  43390. return _vm.updateAsset()
  43391. }
  43392. }
  43393. },
  43394. [_vm._v("Save")]
  43395. )
  43396. ])
  43397. ]
  43398. ),
  43399. _vm._v(" "),
  43400. _c("h4", { staticClass: "text-center" }, [
  43401. _vm._v(
  43402. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43403. ),
  43404. _c("small", { staticClass: "text-muted" }, [
  43405. _vm._v(_vm._s(this.data.pcnickname))
  43406. ])
  43407. ]),
  43408. _vm._v(" "),
  43409. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43410. _vm._v(" "),
  43411. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43412. _vm._v(" "),
  43413. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43414. _vm._v(" "),
  43415. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43416. _vm._v(" "),
  43417. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43418. _vm._v(" "),
  43419. _c(
  43420. "button",
  43421. {
  43422. staticClass: "btn btn-primary",
  43423. attrs: {
  43424. type: "button",
  43425. "data-toggle": "modal",
  43426. "data-target": "#asseteditModal"
  43427. }
  43428. },
  43429. [_vm._v("Edit")]
  43430. )
  43431. ],
  43432. 1
  43433. )
  43434. }
  43435. var staticRenderFns = []
  43436. render._withStripped = true
  43437. /***/ }),
  43438. /***/ "./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&":
  43439. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43440. !*** ./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& ***!
  43441. \*******************************************************************************************************************************************************************************************************************************/
  43442. /*! exports provided: render, staticRenderFns */
  43443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43444. "use strict";
  43445. __webpack_require__.r(__webpack_exports__);
  43446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43447. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43448. var render = function() {
  43449. var _vm = this
  43450. var _h = _vm.$createElement
  43451. var _c = _vm._self._c || _h
  43452. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43453. _c("div", { staticClass: "input-group" }, [
  43454. _c("input", {
  43455. directives: [
  43456. {
  43457. name: "model",
  43458. rawName: "v-model",
  43459. value: _vm.searchText,
  43460. expression: "searchText"
  43461. }
  43462. ],
  43463. staticClass: "form-control",
  43464. attrs: { type: "text" },
  43465. domProps: { value: _vm.searchText },
  43466. on: {
  43467. input: [
  43468. function($event) {
  43469. if ($event.target.composing) {
  43470. return
  43471. }
  43472. _vm.searchText = $event.target.value
  43473. },
  43474. _vm.searchChanged
  43475. ]
  43476. }
  43477. }),
  43478. _vm._v(" "),
  43479. _c("div", { staticClass: "form-group-append" }, [
  43480. _c(
  43481. "a",
  43482. {
  43483. staticClass: "toggle input-group-text bg-primary text-light",
  43484. on: {
  43485. mousedown: function($event) {
  43486. $event.preventDefault()
  43487. },
  43488. click: function($event) {
  43489. return _vm.setOpen(!_vm.open)
  43490. }
  43491. }
  43492. },
  43493. [
  43494. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43495. _vm._v(" "),
  43496. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43497. ]
  43498. )
  43499. ])
  43500. ]),
  43501. _vm._v(" "),
  43502. _c(
  43503. "ul",
  43504. { staticClass: "suggestion-list list-unstyled" },
  43505. _vm._l(_vm.matches, function(suggestion, index) {
  43506. return _c(
  43507. "li",
  43508. {
  43509. key: index,
  43510. on: {
  43511. mousedown: function($event) {
  43512. $event.preventDefault()
  43513. },
  43514. click: function($event) {
  43515. return _vm.suggestionSelected(suggestion)
  43516. }
  43517. }
  43518. },
  43519. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43520. )
  43521. }),
  43522. 0
  43523. )
  43524. ])
  43525. }
  43526. var staticRenderFns = []
  43527. render._withStripped = true
  43528. /***/ }),
  43529. /***/ "./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&":
  43530. /*!************************************************************************************************************************************************************************************************************************!*\
  43531. !*** ./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& ***!
  43532. \************************************************************************************************************************************************************************************************************************/
  43533. /*! exports provided: render, staticRenderFns */
  43534. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43535. "use strict";
  43536. __webpack_require__.r(__webpack_exports__);
  43537. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43538. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43539. var render = function() {
  43540. var _vm = this
  43541. var _h = _vm.$createElement
  43542. var _c = _vm._self._c || _h
  43543. return _c(
  43544. "modal",
  43545. {
  43546. attrs: {
  43547. id: _vm.id,
  43548. tabindex: "-1",
  43549. role: "dialog",
  43550. "aria-labelledby": _vm.id + "Label"
  43551. }
  43552. },
  43553. [
  43554. _c(
  43555. "h5",
  43556. {
  43557. staticClass: "modal-title",
  43558. attrs: { slot: "header", id: _vm.id + "Label" },
  43559. slot: "header"
  43560. },
  43561. [_vm._v("\n Edit Credential\n ")]
  43562. ),
  43563. _vm._v(" "),
  43564. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43565. _c(
  43566. "div",
  43567. { staticClass: "form" },
  43568. [
  43569. _c("autocomplete-custom-dropdown", {
  43570. attrs: {
  43571. options: _vm.descriptions,
  43572. value: _vm.creddesc,
  43573. "allow-custom": true
  43574. },
  43575. model: {
  43576. value: _vm.creddesc,
  43577. callback: function($$v) {
  43578. _vm.creddesc = $$v
  43579. },
  43580. expression: "creddesc"
  43581. }
  43582. })
  43583. ],
  43584. 1
  43585. ),
  43586. _vm._v(" "),
  43587. _c("div", { staticClass: "form-group" }, [
  43588. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43589. _vm._v(" "),
  43590. _c("input", {
  43591. directives: [
  43592. {
  43593. name: "model",
  43594. rawName: "v-model",
  43595. value: _vm.data.creduser,
  43596. expression: "data.creduser"
  43597. }
  43598. ],
  43599. staticClass: "form-control credential",
  43600. attrs: {
  43601. type: "text",
  43602. name: "newusername" + _vm.data.credid,
  43603. id: "newusername" + _vm.data.credid
  43604. },
  43605. domProps: { value: _vm.data.creduser },
  43606. on: {
  43607. input: function($event) {
  43608. if ($event.target.composing) {
  43609. return
  43610. }
  43611. _vm.$set(_vm.data, "creduser", $event.target.value)
  43612. }
  43613. }
  43614. })
  43615. ]),
  43616. _vm._v(" "),
  43617. _c("div", { staticClass: "form-group" }, [
  43618. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43619. _vm._v(" "),
  43620. _c("input", {
  43621. directives: [
  43622. {
  43623. name: "model",
  43624. rawName: "v-model",
  43625. value: _vm.data.credpass,
  43626. expression: "data.credpass"
  43627. }
  43628. ],
  43629. staticClass: "form-control credential",
  43630. attrs: {
  43631. type: "text",
  43632. name: "newpassword" + _vm.data.credid,
  43633. id: "newpassword" + _vm.data.credid
  43634. },
  43635. domProps: { value: _vm.data.credpass },
  43636. on: {
  43637. input: function($event) {
  43638. if ($event.target.composing) {
  43639. return
  43640. }
  43641. _vm.$set(_vm.data, "credpass", $event.target.value)
  43642. }
  43643. }
  43644. }),
  43645. _vm._v(" "),
  43646. _c(
  43647. "button",
  43648. {
  43649. staticClass: "btn btn-secondary",
  43650. attrs: { type: "button" },
  43651. on: {
  43652. click: function($event) {
  43653. return _vm.getRandomPassword(_vm.data.credid)
  43654. }
  43655. }
  43656. },
  43657. [_vm._v("Generate Random")]
  43658. )
  43659. ]),
  43660. _vm._v(" "),
  43661. _c("div", { staticClass: "form-group" })
  43662. ]),
  43663. _vm._v(" "),
  43664. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43665. _c(
  43666. "button",
  43667. {
  43668. staticClass: "btn btn-secondary",
  43669. attrs: { type: "button", "data-dismiss": "modal" }
  43670. },
  43671. [_vm._v("Close")]
  43672. ),
  43673. _vm._v(" "),
  43674. _c(
  43675. "button",
  43676. {
  43677. staticClass: "btn btn-primary",
  43678. attrs: { type: "button" },
  43679. on: {
  43680. click: function($event) {
  43681. return _vm.updateCredential()
  43682. }
  43683. }
  43684. },
  43685. [_vm._v("Save")]
  43686. )
  43687. ])
  43688. ]
  43689. )
  43690. }
  43691. var staticRenderFns = []
  43692. render._withStripped = true
  43693. /***/ }),
  43694. /***/ "./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&":
  43695. /*!******************************************************************************************************************************************************************************************************************!*\
  43696. !*** ./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& ***!
  43697. \******************************************************************************************************************************************************************************************************************/
  43698. /*! exports provided: render, staticRenderFns */
  43699. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43700. "use strict";
  43701. __webpack_require__.r(__webpack_exports__);
  43702. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43703. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43704. var render = function() {
  43705. var _vm = this
  43706. var _h = _vm.$createElement
  43707. var _c = _vm._self._c || _h
  43708. return _c(
  43709. "div",
  43710. [
  43711. _c("credential-form-modal", {
  43712. attrs: {
  43713. "modal-id": "newCredentialModal",
  43714. descriptions: _vm.creddescList,
  43715. create: true,
  43716. pcid: _vm.pcid
  43717. }
  43718. }),
  43719. _vm._v(" "),
  43720. _c(
  43721. "button",
  43722. {
  43723. staticClass: "btn btn-primary",
  43724. attrs: {
  43725. type: "button",
  43726. "data-toggle": "modal",
  43727. "data-target": "#newCredentialModal"
  43728. }
  43729. },
  43730. [_vm._v("New Credential")]
  43731. ),
  43732. _vm._v(" "),
  43733. _vm._l(_vm.credentials, function(credential) {
  43734. return _c(
  43735. "div",
  43736. { key: credential.credid },
  43737. [
  43738. _c("credential", {
  43739. attrs: { credential: credential, descriptions: _vm.creddescList }
  43740. })
  43741. ],
  43742. 1
  43743. )
  43744. })
  43745. ],
  43746. 2
  43747. )
  43748. }
  43749. var staticRenderFns = []
  43750. render._withStripped = true
  43751. /***/ }),
  43752. /***/ "./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&":
  43753. /*!*************************************************************************************************************************************************************************************************************!*\
  43754. !*** ./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& ***!
  43755. \*************************************************************************************************************************************************************************************************************/
  43756. /*! exports provided: render, staticRenderFns */
  43757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43758. "use strict";
  43759. __webpack_require__.r(__webpack_exports__);
  43760. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43762. var render = function() {
  43763. var _vm = this
  43764. var _h = _vm.$createElement
  43765. var _c = _vm._self._c || _h
  43766. return _c(
  43767. "div",
  43768. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43769. [
  43770. _c("credential-form-modal", {
  43771. attrs: {
  43772. descriptions: _vm.creddescList,
  43773. "modal-id": "credential" + this.data.credid + "editModal",
  43774. populateWith: this.data
  43775. }
  43776. }),
  43777. _vm._v(" "),
  43778. _c(
  43779. "modal",
  43780. {
  43781. attrs: {
  43782. id: "credential" + this.data.credid + "deleteModal",
  43783. tabindex: "-1"
  43784. }
  43785. },
  43786. [
  43787. _c(
  43788. "h5",
  43789. {
  43790. staticClass: "modal-title",
  43791. attrs: {
  43792. slot: "header",
  43793. id: "credential" + this.data.credid + "deleteModalLabel"
  43794. },
  43795. slot: "header"
  43796. },
  43797. [_vm._v("\r\n Delete Credential\r\n ")]
  43798. ),
  43799. _vm._v(" "),
  43800. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43801. _vm._v("\r\n Are you sure?\r\n ")
  43802. ]),
  43803. _vm._v(" "),
  43804. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43805. _c(
  43806. "button",
  43807. {
  43808. staticClass: "btn btn-secondary",
  43809. attrs: { type: "button", "data-dismiss": "modal" }
  43810. },
  43811. [_vm._v("Cancel")]
  43812. ),
  43813. _vm._v(" "),
  43814. _c(
  43815. "button",
  43816. {
  43817. staticClass: "btn btn-danger",
  43818. attrs: { type: "button" },
  43819. on: {
  43820. click: function($event) {
  43821. return _vm.deleteCredential()
  43822. }
  43823. }
  43824. },
  43825. [_vm._v("Confirm")]
  43826. )
  43827. ])
  43828. ]
  43829. ),
  43830. _vm._v(" "),
  43831. _c("div", { staticClass: "row no-gutters" }, [
  43832. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43833. _vm._v(_vm._s(this.data.creddesc))
  43834. ]),
  43835. _vm._v(" "),
  43836. _c("div", { staticClass: "col-9 text-right" }, [
  43837. _vm._v(_vm._s(this.data.creddate))
  43838. ])
  43839. ]),
  43840. _vm._v(" "),
  43841. _c("div", { staticClass: "row" }, [
  43842. _c("div", { staticClass: "col-lg-9" }, [
  43843. _c("div", [
  43844. _vm._m(0),
  43845. _vm._v(" "),
  43846. _c("input", {
  43847. staticClass: "border-0 credential",
  43848. attrs: {
  43849. type: "text",
  43850. id: "username" + this.data.credid,
  43851. readonly: ""
  43852. },
  43853. domProps: { value: this.data.creduser }
  43854. }),
  43855. _vm._v(" "),
  43856. _c(
  43857. "button",
  43858. {
  43859. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43860. attrs: {
  43861. id: "btn-username" + this.data.credid,
  43862. "data-clipboard-target": "#username" + this.data.credid
  43863. }
  43864. },
  43865. [_c("i", { staticClass: "far fa-clone" })]
  43866. )
  43867. ]),
  43868. _vm._v(" "),
  43869. _c("div", [
  43870. _vm._m(1),
  43871. _vm._v(" "),
  43872. _c("input", {
  43873. staticClass: "border-0 credential",
  43874. attrs: {
  43875. type: "text",
  43876. id: "password" + this.data.credid,
  43877. readonly: ""
  43878. },
  43879. domProps: { value: this.data.credpass }
  43880. }),
  43881. _vm._v(" "),
  43882. _c(
  43883. "button",
  43884. {
  43885. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43886. attrs: {
  43887. id: "btn-password" + this.data.credid,
  43888. "data-clipboard-target": "#password" + this.data.credid
  43889. }
  43890. },
  43891. [_c("i", { staticClass: "far fa-clone" })]
  43892. )
  43893. ])
  43894. ]),
  43895. _vm._v(" "),
  43896. _c(
  43897. "div",
  43898. {
  43899. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43900. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43901. },
  43902. [
  43903. _c(
  43904. "button",
  43905. {
  43906. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43907. attrs: {
  43908. type: "button",
  43909. "data-toggle": "modal",
  43910. "data-target": "#credential" + this.data.credid + "editModal"
  43911. }
  43912. },
  43913. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43914. ),
  43915. _vm._v(" "),
  43916. _c(
  43917. "button",
  43918. {
  43919. staticClass: "btn btn-sm btn-danger p-lg-1",
  43920. attrs: {
  43921. type: "button",
  43922. "data-toggle": "modal",
  43923. "data-target":
  43924. "#credential" + this.data.credid + "deleteModal"
  43925. }
  43926. },
  43927. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43928. )
  43929. ]
  43930. )
  43931. ])
  43932. ],
  43933. 1
  43934. )
  43935. }
  43936. var staticRenderFns = [
  43937. function() {
  43938. var _vm = this
  43939. var _h = _vm.$createElement
  43940. var _c = _vm._self._c || _h
  43941. return _c("label", { attrs: { for: "username" } }, [
  43942. _c("i", { staticClass: "fas fa-fw fa-user" })
  43943. ])
  43944. },
  43945. function() {
  43946. var _vm = this
  43947. var _h = _vm.$createElement
  43948. var _c = _vm._self._c || _h
  43949. return _c("label", { attrs: { for: "password" } }, [
  43950. _c("i", { staticClass: "fas fa-fw fa-key" })
  43951. ])
  43952. }
  43953. ]
  43954. render._withStripped = true
  43955. /***/ }),
  43956. /***/ "./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&":
  43957. /*!************************************************************************************************************************************************************************************************************!*\
  43958. !*** ./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& ***!
  43959. \************************************************************************************************************************************************************************************************************/
  43960. /*! exports provided: render, staticRenderFns */
  43961. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43962. "use strict";
  43963. __webpack_require__.r(__webpack_exports__);
  43964. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43965. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43966. var render = function() {
  43967. var _vm = this
  43968. var _h = _vm.$createElement
  43969. var _c = _vm._self._c || _h
  43970. return _c(
  43971. "ul",
  43972. { staticClass: "list-unstyled" },
  43973. _vm._l(_vm.errorList, function(error) {
  43974. return _c("li", { key: error, staticClass: "text-danger" }, [
  43975. _vm._v(" " + _vm._s(error) + " ")
  43976. ])
  43977. }),
  43978. 0
  43979. )
  43980. }
  43981. var staticRenderFns = []
  43982. render._withStripped = true
  43983. /***/ }),
  43984. /***/ "./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&":
  43985. /*!********************************************************************************************************************************************************************************************************!*\
  43986. !*** ./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& ***!
  43987. \********************************************************************************************************************************************************************************************************/
  43988. /*! exports provided: render, staticRenderFns */
  43989. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43990. "use strict";
  43991. __webpack_require__.r(__webpack_exports__);
  43992. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43993. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43994. var render = function() {
  43995. var _vm = this
  43996. var _h = _vm.$createElement
  43997. var _c = _vm._self._c || _h
  43998. return _c("div", { staticClass: "modal fade" }, [
  43999. _c(
  44000. "div",
  44001. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44002. [
  44003. _c("div", { staticClass: "modal-content" }, [
  44004. _c(
  44005. "div",
  44006. { staticClass: "modal-header" },
  44007. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44008. 2
  44009. ),
  44010. _vm._v(" "),
  44011. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44012. _vm._v(" "),
  44013. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44014. ])
  44015. ]
  44016. )
  44017. ])
  44018. }
  44019. var staticRenderFns = [
  44020. function() {
  44021. var _vm = this
  44022. var _h = _vm.$createElement
  44023. var _c = _vm._self._c || _h
  44024. return _c(
  44025. "button",
  44026. {
  44027. staticClass: "close",
  44028. attrs: {
  44029. type: "button",
  44030. "data-dismiss": "modal",
  44031. "aria-label": "Close"
  44032. }
  44033. },
  44034. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44035. )
  44036. }
  44037. ]
  44038. render._withStripped = true
  44039. /***/ }),
  44040. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  44041. /*!******************************************************************************************************************************************************************************************************************!*\
  44042. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  44043. \******************************************************************************************************************************************************************************************************************/
  44044. /*! exports provided: render, staticRenderFns */
  44045. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44046. "use strict";
  44047. __webpack_require__.r(__webpack_exports__);
  44048. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44049. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44050. var render = function() {
  44051. var _vm = this
  44052. var _h = _vm.$createElement
  44053. var _c = _vm._self._c || _h
  44054. return _c(
  44055. "modal",
  44056. {
  44057. attrs: {
  44058. id: _vm.modalId,
  44059. tabindex: "-1",
  44060. role: "dialog",
  44061. "aria-labelledby": _vm.modalId + "Label"
  44062. }
  44063. },
  44064. [
  44065. _c(
  44066. "h5",
  44067. {
  44068. staticClass: "modal-title",
  44069. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44070. slot: "header"
  44071. },
  44072. [_vm._v("\n Edit Note\n ")]
  44073. ),
  44074. _vm._v(" "),
  44075. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44076. _c("div", { staticClass: "form-group" }, [
  44077. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44078. _vm._v(" "),
  44079. _c("textarea", {
  44080. directives: [
  44081. {
  44082. name: "model",
  44083. rawName: "v-model",
  44084. value: _vm.note.thenote,
  44085. expression: "note.thenote"
  44086. }
  44087. ],
  44088. staticClass: "form-control",
  44089. attrs: {
  44090. name: "content" + _vm.note.noteid,
  44091. id: "content" + _vm.note.noteid
  44092. },
  44093. domProps: { value: _vm.note.thenote },
  44094. on: {
  44095. input: function($event) {
  44096. if ($event.target.composing) {
  44097. return
  44098. }
  44099. _vm.$set(_vm.note, "thenote", $event.target.value)
  44100. }
  44101. }
  44102. })
  44103. ])
  44104. ]),
  44105. _vm._v(" "),
  44106. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44107. _c(
  44108. "button",
  44109. {
  44110. staticClass: "btn btn-secondary",
  44111. attrs: { type: "button", "data-dismiss": "modal" }
  44112. },
  44113. [_vm._v("Close")]
  44114. ),
  44115. _vm._v(" "),
  44116. _c(
  44117. "button",
  44118. {
  44119. staticClass: "btn btn-primary",
  44120. attrs: { type: "button" },
  44121. on: {
  44122. click: function($event) {
  44123. return _vm.updateNote(_vm.note)
  44124. }
  44125. }
  44126. },
  44127. [_vm._v("Save")]
  44128. )
  44129. ])
  44130. ]
  44131. )
  44132. }
  44133. var staticRenderFns = []
  44134. render._withStripped = true
  44135. /***/ }),
  44136. /***/ "./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&":
  44137. /*!********************************************************************************************************************************************************************************************************!*\
  44138. !*** ./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& ***!
  44139. \********************************************************************************************************************************************************************************************************/
  44140. /*! exports provided: render, staticRenderFns */
  44141. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44142. "use strict";
  44143. __webpack_require__.r(__webpack_exports__);
  44144. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44145. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44146. var render = function() {
  44147. var _vm = this
  44148. var _h = _vm.$createElement
  44149. var _c = _vm._self._c || _h
  44150. return _c(
  44151. "ul",
  44152. { staticClass: "list-unstyled" },
  44153. [
  44154. _c("note-form-modal", {
  44155. attrs: {
  44156. "modal-id": "note" + _vm.noteType + "CreateModal",
  44157. "note-type": _vm.noteType,
  44158. woid: _vm.woid,
  44159. "note-user": _vm.authusername
  44160. }
  44161. }),
  44162. _vm._v(" "),
  44163. _c(
  44164. "button",
  44165. {
  44166. staticClass: "btn btn-primary",
  44167. attrs: {
  44168. type: "button",
  44169. "data-toggle": "modal",
  44170. "data-target": "#note" + _vm.noteType + "CreateModal"
  44171. }
  44172. },
  44173. [_c("i", { staticClass: "fas fa-fw fa-plus" }), _vm._v(" Add New Note")]
  44174. ),
  44175. _vm._v(" "),
  44176. _vm._l(this.notes, function(note, index) {
  44177. return _c(
  44178. "li",
  44179. { key: index, staticClass: "row no-gutters mb-2" },
  44180. [
  44181. _c("note-form-modal", {
  44182. attrs: {
  44183. "modal-id": "note" + note.noteid + "editModal",
  44184. "populate-with": note
  44185. }
  44186. }),
  44187. _vm._v(" "),
  44188. _c(
  44189. "div",
  44190. {
  44191. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44192. class: _vm.setOrder(index)
  44193. },
  44194. [
  44195. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44196. _vm._v(_vm._s(note.noteuser))
  44197. ]),
  44198. _vm._v(" "),
  44199. _c(
  44200. "div",
  44201. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44202. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44203. ),
  44204. _vm._v(" "),
  44205. _c(
  44206. "div",
  44207. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44208. [
  44209. _vm.authusername === note.noteuser ||
  44210. _vm.authusername === "admin"
  44211. ? [
  44212. _c(
  44213. "button",
  44214. {
  44215. staticClass: "btn btn-sm btn-primary m-1",
  44216. attrs: {
  44217. "data-toggle": "modal",
  44218. "data-target":
  44219. "#note" + note.noteid + "editModal"
  44220. }
  44221. },
  44222. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44223. ),
  44224. _vm._v(" "),
  44225. _vm._m(0, true),
  44226. _vm._v(" "),
  44227. _vm._m(1, true)
  44228. ]
  44229. : _vm._e()
  44230. ],
  44231. 2
  44232. )
  44233. ]
  44234. ),
  44235. _vm._v(" "),
  44236. _c("div", { staticClass: "col-md-10" }, [
  44237. _c("div", { staticClass: "card m-2" }, [
  44238. _c("div", { staticClass: "card-body p-2" }, [
  44239. _vm._v(
  44240. "\n " +
  44241. _vm._s(note.thenote) +
  44242. "\n "
  44243. )
  44244. ])
  44245. ])
  44246. ])
  44247. ],
  44248. 1
  44249. )
  44250. })
  44251. ],
  44252. 2
  44253. )
  44254. }
  44255. var staticRenderFns = [
  44256. function() {
  44257. var _vm = this
  44258. var _h = _vm.$createElement
  44259. var _c = _vm._self._c || _h
  44260. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44261. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44262. ])
  44263. },
  44264. function() {
  44265. var _vm = this
  44266. var _h = _vm.$createElement
  44267. var _c = _vm._self._c || _h
  44268. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44269. _c("i", { staticClass: "fa fa-fw fa-random" })
  44270. ])
  44271. }
  44272. ]
  44273. render._withStripped = true
  44274. /***/ }),
  44275. /***/ "./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&":
  44276. /*!********************************************************************************************************************************************************************************************************************!*\
  44277. !*** ./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& ***!
  44278. \********************************************************************************************************************************************************************************************************************/
  44279. /*! exports provided: render, staticRenderFns */
  44280. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44281. "use strict";
  44282. __webpack_require__.r(__webpack_exports__);
  44283. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44284. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44285. var render = function() {
  44286. var _vm = this
  44287. var _h = _vm.$createElement
  44288. var _c = _vm._self._c || _h
  44289. return _c(
  44290. "modal",
  44291. {
  44292. attrs: {
  44293. id: _vm.id,
  44294. tabindex: "-1",
  44295. role: "dialog",
  44296. "aria-labelledby": _vm.id + "Label"
  44297. }
  44298. },
  44299. [
  44300. _c(
  44301. "h5",
  44302. {
  44303. staticClass: "modal-title",
  44304. attrs: { slot: "header", id: _vm.id + "Label" },
  44305. slot: "header"
  44306. },
  44307. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44308. ),
  44309. _vm._v(" "),
  44310. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44311. _c(
  44312. "div",
  44313. { staticClass: "form-group" },
  44314. [
  44315. _c("label", { attrs: { for: "probdesc" } }, [
  44316. _vm._v("Problem Description")
  44317. ]),
  44318. _vm._v(" "),
  44319. _c("textarea", {
  44320. directives: [
  44321. {
  44322. name: "model",
  44323. rawName: "v-model",
  44324. value: _vm.data.probdesc,
  44325. expression: "data.probdesc"
  44326. }
  44327. ],
  44328. class: {
  44329. "form-control": true,
  44330. "is-invalid": _vm.errors.probdesc
  44331. },
  44332. attrs: { id: "probdesc", name: "probdesc" },
  44333. domProps: { value: _vm.data.probdesc },
  44334. on: {
  44335. input: function($event) {
  44336. if ($event.target.composing) {
  44337. return
  44338. }
  44339. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44340. }
  44341. }
  44342. }),
  44343. _vm._v(" "),
  44344. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44345. ],
  44346. 1
  44347. ),
  44348. _vm._v(" "),
  44349. _c(
  44350. "div",
  44351. { staticClass: "form-group" },
  44352. [
  44353. _c("label", { attrs: { for: "suggested" } }, [
  44354. _vm._v("Suggested Solution")
  44355. ]),
  44356. _vm._v(" "),
  44357. _c("textarea", {
  44358. directives: [
  44359. {
  44360. name: "model",
  44361. rawName: "v-model",
  44362. value: _vm.data.suggested,
  44363. expression: "data.suggested"
  44364. }
  44365. ],
  44366. class: {
  44367. "form-control": true,
  44368. "is-invalid": _vm.errors.suggested
  44369. },
  44370. attrs: { id: "suggested", name: "suggested" },
  44371. domProps: { value: _vm.data.suggested },
  44372. on: {
  44373. input: function($event) {
  44374. if ($event.target.composing) {
  44375. return
  44376. }
  44377. _vm.$set(_vm.data, "suggested", $event.target.value)
  44378. }
  44379. }
  44380. }),
  44381. _vm._v(" "),
  44382. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44383. ],
  44384. 1
  44385. ),
  44386. _vm._v(" "),
  44387. _c(
  44388. "div",
  44389. { staticClass: "form-group" },
  44390. [
  44391. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44392. _vm._v(" "),
  44393. _c("autocomplete-custom-dropdown", {
  44394. attrs: { options: _vm.storeList, value: this.store },
  44395. model: {
  44396. value: _vm.store,
  44397. callback: function($$v) {
  44398. _vm.store = $$v
  44399. },
  44400. expression: "store"
  44401. }
  44402. })
  44403. ],
  44404. 1
  44405. )
  44406. ]),
  44407. _vm._v(" "),
  44408. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44409. _c(
  44410. "button",
  44411. {
  44412. staticClass: "btn btn-secondary",
  44413. attrs: { type: "button", "data-dismiss": "modal" }
  44414. },
  44415. [_vm._v("Close")]
  44416. ),
  44417. _vm._v(" "),
  44418. _c(
  44419. "button",
  44420. {
  44421. staticClass: "btn btn-primary",
  44422. attrs: { type: "button" },
  44423. on: {
  44424. click: function($event) {
  44425. return _vm.updateWorkOrder()
  44426. }
  44427. }
  44428. },
  44429. [_vm._v("Save")]
  44430. )
  44431. ])
  44432. ]
  44433. )
  44434. }
  44435. var staticRenderFns = []
  44436. render._withStripped = true
  44437. /***/ }),
  44438. /***/ "./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&":
  44439. /*!*********************************************************************************************************************************************************************************************************!*\
  44440. !*** ./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& ***!
  44441. \*********************************************************************************************************************************************************************************************************/
  44442. /*! exports provided: render, staticRenderFns */
  44443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44444. "use strict";
  44445. __webpack_require__.r(__webpack_exports__);
  44446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44447. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44448. var render = function() {
  44449. var _vm = this
  44450. var _h = _vm.$createElement
  44451. var _c = _vm._self._c || _h
  44452. return _c(
  44453. "div",
  44454. [
  44455. _c("woinfo-edit-modal", {
  44456. attrs: {
  44457. "modal-id": "workordereditModal",
  44458. "populate-with": this.data,
  44459. "store-list": this.storeList
  44460. }
  44461. }),
  44462. _vm._v(" "),
  44463. _c("p", [
  44464. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44465. _vm._v(" "),
  44466. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44467. ]),
  44468. _vm._v(" "),
  44469. _c("p", [
  44470. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44471. _vm._v(" "),
  44472. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44473. ]),
  44474. _vm._v(" "),
  44475. _c("p", [
  44476. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44477. _vm._v(" "),
  44478. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44479. ]),
  44480. _vm._v(" "),
  44481. _c("p", [
  44482. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44483. _vm._v(" "),
  44484. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44485. ]),
  44486. _vm._v(" "),
  44487. _c("p", [
  44488. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44489. _vm._v(" "),
  44490. _c(
  44491. "span",
  44492. {
  44493. staticClass: "dashed-underline",
  44494. attrs: {
  44495. "data-toggle": "tooltip",
  44496. "data-placement": "bottom",
  44497. title: this.getHRDate(this.data.dropdate)
  44498. }
  44499. },
  44500. [
  44501. _vm._v(
  44502. "\n " +
  44503. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44504. " days ago\n "
  44505. )
  44506. ]
  44507. )
  44508. ]),
  44509. _vm._v(" "),
  44510. _c("p", [
  44511. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44512. _vm._v(" "),
  44513. !this.isZero(this.data.pickupdate)
  44514. ? _c(
  44515. "span",
  44516. {
  44517. staticClass: "dashed-underline",
  44518. attrs: {
  44519. "data-toggle": "tooltip",
  44520. "data-placement": "bottom",
  44521. title: this.getHRDate(this.data.pickupdate)
  44522. }
  44523. },
  44524. [
  44525. _vm._v(
  44526. "\n " +
  44527. _vm._s(
  44528. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44529. ) +
  44530. " days ago\n "
  44531. )
  44532. ]
  44533. )
  44534. : _vm._e()
  44535. ]),
  44536. _vm._v(" "),
  44537. _c(
  44538. "button",
  44539. {
  44540. staticClass: "btn btn-primary",
  44541. attrs: {
  44542. type: "button",
  44543. "data-toggle": "modal",
  44544. "data-target": "#workordereditModal"
  44545. }
  44546. },
  44547. [_vm._v("Edit")]
  44548. )
  44549. ],
  44550. 1
  44551. )
  44552. }
  44553. var staticRenderFns = []
  44554. render._withStripped = true
  44555. /***/ }),
  44556. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44557. /*!********************************************************************!*\
  44558. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44559. \********************************************************************/
  44560. /*! exports provided: default */
  44561. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44562. "use strict";
  44563. __webpack_require__.r(__webpack_exports__);
  44564. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44565. /* globals __VUE_SSR_CONTEXT__ */
  44566. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44567. // This module is a runtime utility for cleaner component module output and will
  44568. // be included in the final webpack user bundle.
  44569. function normalizeComponent (
  44570. scriptExports,
  44571. render,
  44572. staticRenderFns,
  44573. functionalTemplate,
  44574. injectStyles,
  44575. scopeId,
  44576. moduleIdentifier, /* server only */
  44577. shadowMode /* vue-cli only */
  44578. ) {
  44579. // Vue.extend constructor export interop
  44580. var options = typeof scriptExports === 'function'
  44581. ? scriptExports.options
  44582. : scriptExports
  44583. // render functions
  44584. if (render) {
  44585. options.render = render
  44586. options.staticRenderFns = staticRenderFns
  44587. options._compiled = true
  44588. }
  44589. // functional template
  44590. if (functionalTemplate) {
  44591. options.functional = true
  44592. }
  44593. // scopedId
  44594. if (scopeId) {
  44595. options._scopeId = 'data-v-' + scopeId
  44596. }
  44597. var hook
  44598. if (moduleIdentifier) { // server build
  44599. hook = function (context) {
  44600. // 2.3 injection
  44601. context =
  44602. context || // cached call
  44603. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44604. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44605. // 2.2 with runInNewContext: true
  44606. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44607. context = __VUE_SSR_CONTEXT__
  44608. }
  44609. // inject component styles
  44610. if (injectStyles) {
  44611. injectStyles.call(this, context)
  44612. }
  44613. // register component module identifier for async chunk inferrence
  44614. if (context && context._registeredComponents) {
  44615. context._registeredComponents.add(moduleIdentifier)
  44616. }
  44617. }
  44618. // used by ssr in case component is cached and beforeCreate
  44619. // never gets called
  44620. options._ssrRegister = hook
  44621. } else if (injectStyles) {
  44622. hook = shadowMode
  44623. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44624. : injectStyles
  44625. }
  44626. if (hook) {
  44627. if (options.functional) {
  44628. // for template-only hot-reload because in that case the render fn doesn't
  44629. // go through the normalizer
  44630. options._injectStyles = hook
  44631. // register for functioal component in vue file
  44632. var originalRender = options.render
  44633. options.render = function renderWithStyleInjection (h, context) {
  44634. hook.call(context)
  44635. return originalRender(h, context)
  44636. }
  44637. } else {
  44638. // inject component registration as beforeCreate hook
  44639. var existing = options.beforeCreate
  44640. options.beforeCreate = existing
  44641. ? [].concat(existing, hook)
  44642. : [hook]
  44643. }
  44644. }
  44645. return {
  44646. exports: scriptExports,
  44647. options: options
  44648. }
  44649. }
  44650. /***/ }),
  44651. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44652. /*!*************************************************!*\
  44653. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44654. \*************************************************/
  44655. /*! no static exports found */
  44656. /***/ (function(module, exports, __webpack_require__) {
  44657. "use strict";
  44658. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44659. * Vue.js v2.6.11
  44660. * (c) 2014-2019 Evan You
  44661. * Released under the MIT License.
  44662. */
  44663. /* */
  44664. var emptyObject = Object.freeze({});
  44665. // These helpers produce better VM code in JS engines due to their
  44666. // explicitness and function inlining.
  44667. function isUndef (v) {
  44668. return v === undefined || v === null
  44669. }
  44670. function isDef (v) {
  44671. return v !== undefined && v !== null
  44672. }
  44673. function isTrue (v) {
  44674. return v === true
  44675. }
  44676. function isFalse (v) {
  44677. return v === false
  44678. }
  44679. /**
  44680. * Check if value is primitive.
  44681. */
  44682. function isPrimitive (value) {
  44683. return (
  44684. typeof value === 'string' ||
  44685. typeof value === 'number' ||
  44686. // $flow-disable-line
  44687. typeof value === 'symbol' ||
  44688. typeof value === 'boolean'
  44689. )
  44690. }
  44691. /**
  44692. * Quick object check - this is primarily used to tell
  44693. * Objects from primitive values when we know the value
  44694. * is a JSON-compliant type.
  44695. */
  44696. function isObject (obj) {
  44697. return obj !== null && typeof obj === 'object'
  44698. }
  44699. /**
  44700. * Get the raw type string of a value, e.g., [object Object].
  44701. */
  44702. var _toString = Object.prototype.toString;
  44703. function toRawType (value) {
  44704. return _toString.call(value).slice(8, -1)
  44705. }
  44706. /**
  44707. * Strict object type check. Only returns true
  44708. * for plain JavaScript objects.
  44709. */
  44710. function isPlainObject (obj) {
  44711. return _toString.call(obj) === '[object Object]'
  44712. }
  44713. function isRegExp (v) {
  44714. return _toString.call(v) === '[object RegExp]'
  44715. }
  44716. /**
  44717. * Check if val is a valid array index.
  44718. */
  44719. function isValidArrayIndex (val) {
  44720. var n = parseFloat(String(val));
  44721. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44722. }
  44723. function isPromise (val) {
  44724. return (
  44725. isDef(val) &&
  44726. typeof val.then === 'function' &&
  44727. typeof val.catch === 'function'
  44728. )
  44729. }
  44730. /**
  44731. * Convert a value to a string that is actually rendered.
  44732. */
  44733. function toString (val) {
  44734. return val == null
  44735. ? ''
  44736. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44737. ? JSON.stringify(val, null, 2)
  44738. : String(val)
  44739. }
  44740. /**
  44741. * Convert an input value to a number for persistence.
  44742. * If the conversion fails, return original string.
  44743. */
  44744. function toNumber (val) {
  44745. var n = parseFloat(val);
  44746. return isNaN(n) ? val : n
  44747. }
  44748. /**
  44749. * Make a map and return a function for checking if a key
  44750. * is in that map.
  44751. */
  44752. function makeMap (
  44753. str,
  44754. expectsLowerCase
  44755. ) {
  44756. var map = Object.create(null);
  44757. var list = str.split(',');
  44758. for (var i = 0; i < list.length; i++) {
  44759. map[list[i]] = true;
  44760. }
  44761. return expectsLowerCase
  44762. ? function (val) { return map[val.toLowerCase()]; }
  44763. : function (val) { return map[val]; }
  44764. }
  44765. /**
  44766. * Check if a tag is a built-in tag.
  44767. */
  44768. var isBuiltInTag = makeMap('slot,component', true);
  44769. /**
  44770. * Check if an attribute is a reserved attribute.
  44771. */
  44772. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44773. /**
  44774. * Remove an item from an array.
  44775. */
  44776. function remove (arr, item) {
  44777. if (arr.length) {
  44778. var index = arr.indexOf(item);
  44779. if (index > -1) {
  44780. return arr.splice(index, 1)
  44781. }
  44782. }
  44783. }
  44784. /**
  44785. * Check whether an object has the property.
  44786. */
  44787. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44788. function hasOwn (obj, key) {
  44789. return hasOwnProperty.call(obj, key)
  44790. }
  44791. /**
  44792. * Create a cached version of a pure function.
  44793. */
  44794. function cached (fn) {
  44795. var cache = Object.create(null);
  44796. return (function cachedFn (str) {
  44797. var hit = cache[str];
  44798. return hit || (cache[str] = fn(str))
  44799. })
  44800. }
  44801. /**
  44802. * Camelize a hyphen-delimited string.
  44803. */
  44804. var camelizeRE = /-(\w)/g;
  44805. var camelize = cached(function (str) {
  44806. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44807. });
  44808. /**
  44809. * Capitalize a string.
  44810. */
  44811. var capitalize = cached(function (str) {
  44812. return str.charAt(0).toUpperCase() + str.slice(1)
  44813. });
  44814. /**
  44815. * Hyphenate a camelCase string.
  44816. */
  44817. var hyphenateRE = /\B([A-Z])/g;
  44818. var hyphenate = cached(function (str) {
  44819. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44820. });
  44821. /**
  44822. * Simple bind polyfill for environments that do not support it,
  44823. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44824. * since native bind is now performant enough in most browsers.
  44825. * But removing it would mean breaking code that was able to run in
  44826. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44827. */
  44828. /* istanbul ignore next */
  44829. function polyfillBind (fn, ctx) {
  44830. function boundFn (a) {
  44831. var l = arguments.length;
  44832. return l
  44833. ? l > 1
  44834. ? fn.apply(ctx, arguments)
  44835. : fn.call(ctx, a)
  44836. : fn.call(ctx)
  44837. }
  44838. boundFn._length = fn.length;
  44839. return boundFn
  44840. }
  44841. function nativeBind (fn, ctx) {
  44842. return fn.bind(ctx)
  44843. }
  44844. var bind = Function.prototype.bind
  44845. ? nativeBind
  44846. : polyfillBind;
  44847. /**
  44848. * Convert an Array-like object to a real Array.
  44849. */
  44850. function toArray (list, start) {
  44851. start = start || 0;
  44852. var i = list.length - start;
  44853. var ret = new Array(i);
  44854. while (i--) {
  44855. ret[i] = list[i + start];
  44856. }
  44857. return ret
  44858. }
  44859. /**
  44860. * Mix properties into target object.
  44861. */
  44862. function extend (to, _from) {
  44863. for (var key in _from) {
  44864. to[key] = _from[key];
  44865. }
  44866. return to
  44867. }
  44868. /**
  44869. * Merge an Array of Objects into a single Object.
  44870. */
  44871. function toObject (arr) {
  44872. var res = {};
  44873. for (var i = 0; i < arr.length; i++) {
  44874. if (arr[i]) {
  44875. extend(res, arr[i]);
  44876. }
  44877. }
  44878. return res
  44879. }
  44880. /* eslint-disable no-unused-vars */
  44881. /**
  44882. * Perform no operation.
  44883. * Stubbing args to make Flow happy without leaving useless transpiled code
  44884. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44885. */
  44886. function noop (a, b, c) {}
  44887. /**
  44888. * Always return false.
  44889. */
  44890. var no = function (a, b, c) { return false; };
  44891. /* eslint-enable no-unused-vars */
  44892. /**
  44893. * Return the same value.
  44894. */
  44895. var identity = function (_) { return _; };
  44896. /**
  44897. * Generate a string containing static keys from compiler modules.
  44898. */
  44899. function genStaticKeys (modules) {
  44900. return modules.reduce(function (keys, m) {
  44901. return keys.concat(m.staticKeys || [])
  44902. }, []).join(',')
  44903. }
  44904. /**
  44905. * Check if two values are loosely equal - that is,
  44906. * if they are plain objects, do they have the same shape?
  44907. */
  44908. function looseEqual (a, b) {
  44909. if (a === b) { return true }
  44910. var isObjectA = isObject(a);
  44911. var isObjectB = isObject(b);
  44912. if (isObjectA && isObjectB) {
  44913. try {
  44914. var isArrayA = Array.isArray(a);
  44915. var isArrayB = Array.isArray(b);
  44916. if (isArrayA && isArrayB) {
  44917. return a.length === b.length && a.every(function (e, i) {
  44918. return looseEqual(e, b[i])
  44919. })
  44920. } else if (a instanceof Date && b instanceof Date) {
  44921. return a.getTime() === b.getTime()
  44922. } else if (!isArrayA && !isArrayB) {
  44923. var keysA = Object.keys(a);
  44924. var keysB = Object.keys(b);
  44925. return keysA.length === keysB.length && keysA.every(function (key) {
  44926. return looseEqual(a[key], b[key])
  44927. })
  44928. } else {
  44929. /* istanbul ignore next */
  44930. return false
  44931. }
  44932. } catch (e) {
  44933. /* istanbul ignore next */
  44934. return false
  44935. }
  44936. } else if (!isObjectA && !isObjectB) {
  44937. return String(a) === String(b)
  44938. } else {
  44939. return false
  44940. }
  44941. }
  44942. /**
  44943. * Return the first index at which a loosely equal value can be
  44944. * found in the array (if value is a plain object, the array must
  44945. * contain an object of the same shape), or -1 if it is not present.
  44946. */
  44947. function looseIndexOf (arr, val) {
  44948. for (var i = 0; i < arr.length; i++) {
  44949. if (looseEqual(arr[i], val)) { return i }
  44950. }
  44951. return -1
  44952. }
  44953. /**
  44954. * Ensure a function is called only once.
  44955. */
  44956. function once (fn) {
  44957. var called = false;
  44958. return function () {
  44959. if (!called) {
  44960. called = true;
  44961. fn.apply(this, arguments);
  44962. }
  44963. }
  44964. }
  44965. var SSR_ATTR = 'data-server-rendered';
  44966. var ASSET_TYPES = [
  44967. 'component',
  44968. 'directive',
  44969. 'filter'
  44970. ];
  44971. var LIFECYCLE_HOOKS = [
  44972. 'beforeCreate',
  44973. 'created',
  44974. 'beforeMount',
  44975. 'mounted',
  44976. 'beforeUpdate',
  44977. 'updated',
  44978. 'beforeDestroy',
  44979. 'destroyed',
  44980. 'activated',
  44981. 'deactivated',
  44982. 'errorCaptured',
  44983. 'serverPrefetch'
  44984. ];
  44985. /* */
  44986. var config = ({
  44987. /**
  44988. * Option merge strategies (used in core/util/options)
  44989. */
  44990. // $flow-disable-line
  44991. optionMergeStrategies: Object.create(null),
  44992. /**
  44993. * Whether to suppress warnings.
  44994. */
  44995. silent: false,
  44996. /**
  44997. * Show production mode tip message on boot?
  44998. */
  44999. productionTip: "development" !== 'production',
  45000. /**
  45001. * Whether to enable devtools
  45002. */
  45003. devtools: "development" !== 'production',
  45004. /**
  45005. * Whether to record perf
  45006. */
  45007. performance: false,
  45008. /**
  45009. * Error handler for watcher errors
  45010. */
  45011. errorHandler: null,
  45012. /**
  45013. * Warn handler for watcher warns
  45014. */
  45015. warnHandler: null,
  45016. /**
  45017. * Ignore certain custom elements
  45018. */
  45019. ignoredElements: [],
  45020. /**
  45021. * Custom user key aliases for v-on
  45022. */
  45023. // $flow-disable-line
  45024. keyCodes: Object.create(null),
  45025. /**
  45026. * Check if a tag is reserved so that it cannot be registered as a
  45027. * component. This is platform-dependent and may be overwritten.
  45028. */
  45029. isReservedTag: no,
  45030. /**
  45031. * Check if an attribute is reserved so that it cannot be used as a component
  45032. * prop. This is platform-dependent and may be overwritten.
  45033. */
  45034. isReservedAttr: no,
  45035. /**
  45036. * Check if a tag is an unknown element.
  45037. * Platform-dependent.
  45038. */
  45039. isUnknownElement: no,
  45040. /**
  45041. * Get the namespace of an element
  45042. */
  45043. getTagNamespace: noop,
  45044. /**
  45045. * Parse the real tag name for the specific platform.
  45046. */
  45047. parsePlatformTagName: identity,
  45048. /**
  45049. * Check if an attribute must be bound using property, e.g. value
  45050. * Platform-dependent.
  45051. */
  45052. mustUseProp: no,
  45053. /**
  45054. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45055. * This will significantly reduce performance if set to false.
  45056. */
  45057. async: true,
  45058. /**
  45059. * Exposed for legacy reasons
  45060. */
  45061. _lifecycleHooks: LIFECYCLE_HOOKS
  45062. });
  45063. /* */
  45064. /**
  45065. * unicode letters used for parsing html tags, component names and property paths.
  45066. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45067. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45068. */
  45069. 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/;
  45070. /**
  45071. * Check if a string starts with $ or _
  45072. */
  45073. function isReserved (str) {
  45074. var c = (str + '').charCodeAt(0);
  45075. return c === 0x24 || c === 0x5F
  45076. }
  45077. /**
  45078. * Define a property.
  45079. */
  45080. function def (obj, key, val, enumerable) {
  45081. Object.defineProperty(obj, key, {
  45082. value: val,
  45083. enumerable: !!enumerable,
  45084. writable: true,
  45085. configurable: true
  45086. });
  45087. }
  45088. /**
  45089. * Parse simple path.
  45090. */
  45091. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45092. function parsePath (path) {
  45093. if (bailRE.test(path)) {
  45094. return
  45095. }
  45096. var segments = path.split('.');
  45097. return function (obj) {
  45098. for (var i = 0; i < segments.length; i++) {
  45099. if (!obj) { return }
  45100. obj = obj[segments[i]];
  45101. }
  45102. return obj
  45103. }
  45104. }
  45105. /* */
  45106. // can we use __proto__?
  45107. var hasProto = '__proto__' in {};
  45108. // Browser environment sniffing
  45109. var inBrowser = typeof window !== 'undefined';
  45110. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45111. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45112. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45113. var isIE = UA && /msie|trident/.test(UA);
  45114. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45115. var isEdge = UA && UA.indexOf('edge/') > 0;
  45116. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45117. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45118. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45119. var isPhantomJS = UA && /phantomjs/.test(UA);
  45120. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45121. // Firefox has a "watch" function on Object.prototype...
  45122. var nativeWatch = ({}).watch;
  45123. var supportsPassive = false;
  45124. if (inBrowser) {
  45125. try {
  45126. var opts = {};
  45127. Object.defineProperty(opts, 'passive', ({
  45128. get: function get () {
  45129. /* istanbul ignore next */
  45130. supportsPassive = true;
  45131. }
  45132. })); // https://github.com/facebook/flow/issues/285
  45133. window.addEventListener('test-passive', null, opts);
  45134. } catch (e) {}
  45135. }
  45136. // this needs to be lazy-evaled because vue may be required before
  45137. // vue-server-renderer can set VUE_ENV
  45138. var _isServer;
  45139. var isServerRendering = function () {
  45140. if (_isServer === undefined) {
  45141. /* istanbul ignore if */
  45142. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45143. // detect presence of vue-server-renderer and avoid
  45144. // Webpack shimming the process
  45145. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45146. } else {
  45147. _isServer = false;
  45148. }
  45149. }
  45150. return _isServer
  45151. };
  45152. // detect devtools
  45153. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45154. /* istanbul ignore next */
  45155. function isNative (Ctor) {
  45156. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45157. }
  45158. var hasSymbol =
  45159. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45160. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45161. var _Set;
  45162. /* istanbul ignore if */ // $flow-disable-line
  45163. if (typeof Set !== 'undefined' && isNative(Set)) {
  45164. // use native Set when available.
  45165. _Set = Set;
  45166. } else {
  45167. // a non-standard Set polyfill that only works with primitive keys.
  45168. _Set = /*@__PURE__*/(function () {
  45169. function Set () {
  45170. this.set = Object.create(null);
  45171. }
  45172. Set.prototype.has = function has (key) {
  45173. return this.set[key] === true
  45174. };
  45175. Set.prototype.add = function add (key) {
  45176. this.set[key] = true;
  45177. };
  45178. Set.prototype.clear = function clear () {
  45179. this.set = Object.create(null);
  45180. };
  45181. return Set;
  45182. }());
  45183. }
  45184. /* */
  45185. var warn = noop;
  45186. var tip = noop;
  45187. var generateComponentTrace = (noop); // work around flow check
  45188. var formatComponentName = (noop);
  45189. {
  45190. var hasConsole = typeof console !== 'undefined';
  45191. var classifyRE = /(?:^|[-_])(\w)/g;
  45192. var classify = function (str) { return str
  45193. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45194. .replace(/[-_]/g, ''); };
  45195. warn = function (msg, vm) {
  45196. var trace = vm ? generateComponentTrace(vm) : '';
  45197. if (config.warnHandler) {
  45198. config.warnHandler.call(null, msg, vm, trace);
  45199. } else if (hasConsole && (!config.silent)) {
  45200. console.error(("[Vue warn]: " + msg + trace));
  45201. }
  45202. };
  45203. tip = function (msg, vm) {
  45204. if (hasConsole && (!config.silent)) {
  45205. console.warn("[Vue tip]: " + msg + (
  45206. vm ? generateComponentTrace(vm) : ''
  45207. ));
  45208. }
  45209. };
  45210. formatComponentName = function (vm, includeFile) {
  45211. if (vm.$root === vm) {
  45212. return '<Root>'
  45213. }
  45214. var options = typeof vm === 'function' && vm.cid != null
  45215. ? vm.options
  45216. : vm._isVue
  45217. ? vm.$options || vm.constructor.options
  45218. : vm;
  45219. var name = options.name || options._componentTag;
  45220. var file = options.__file;
  45221. if (!name && file) {
  45222. var match = file.match(/([^/\\]+)\.vue$/);
  45223. name = match && match[1];
  45224. }
  45225. return (
  45226. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45227. (file && includeFile !== false ? (" at " + file) : '')
  45228. )
  45229. };
  45230. var repeat = function (str, n) {
  45231. var res = '';
  45232. while (n) {
  45233. if (n % 2 === 1) { res += str; }
  45234. if (n > 1) { str += str; }
  45235. n >>= 1;
  45236. }
  45237. return res
  45238. };
  45239. generateComponentTrace = function (vm) {
  45240. if (vm._isVue && vm.$parent) {
  45241. var tree = [];
  45242. var currentRecursiveSequence = 0;
  45243. while (vm) {
  45244. if (tree.length > 0) {
  45245. var last = tree[tree.length - 1];
  45246. if (last.constructor === vm.constructor) {
  45247. currentRecursiveSequence++;
  45248. vm = vm.$parent;
  45249. continue
  45250. } else if (currentRecursiveSequence > 0) {
  45251. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45252. currentRecursiveSequence = 0;
  45253. }
  45254. }
  45255. tree.push(vm);
  45256. vm = vm.$parent;
  45257. }
  45258. return '\n\nfound in\n\n' + tree
  45259. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45260. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45261. : formatComponentName(vm))); })
  45262. .join('\n')
  45263. } else {
  45264. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45265. }
  45266. };
  45267. }
  45268. /* */
  45269. var uid = 0;
  45270. /**
  45271. * A dep is an observable that can have multiple
  45272. * directives subscribing to it.
  45273. */
  45274. var Dep = function Dep () {
  45275. this.id = uid++;
  45276. this.subs = [];
  45277. };
  45278. Dep.prototype.addSub = function addSub (sub) {
  45279. this.subs.push(sub);
  45280. };
  45281. Dep.prototype.removeSub = function removeSub (sub) {
  45282. remove(this.subs, sub);
  45283. };
  45284. Dep.prototype.depend = function depend () {
  45285. if (Dep.target) {
  45286. Dep.target.addDep(this);
  45287. }
  45288. };
  45289. Dep.prototype.notify = function notify () {
  45290. // stabilize the subscriber list first
  45291. var subs = this.subs.slice();
  45292. if (!config.async) {
  45293. // subs aren't sorted in scheduler if not running async
  45294. // we need to sort them now to make sure they fire in correct
  45295. // order
  45296. subs.sort(function (a, b) { return a.id - b.id; });
  45297. }
  45298. for (var i = 0, l = subs.length; i < l; i++) {
  45299. subs[i].update();
  45300. }
  45301. };
  45302. // The current target watcher being evaluated.
  45303. // This is globally unique because only one watcher
  45304. // can be evaluated at a time.
  45305. Dep.target = null;
  45306. var targetStack = [];
  45307. function pushTarget (target) {
  45308. targetStack.push(target);
  45309. Dep.target = target;
  45310. }
  45311. function popTarget () {
  45312. targetStack.pop();
  45313. Dep.target = targetStack[targetStack.length - 1];
  45314. }
  45315. /* */
  45316. var VNode = function VNode (
  45317. tag,
  45318. data,
  45319. children,
  45320. text,
  45321. elm,
  45322. context,
  45323. componentOptions,
  45324. asyncFactory
  45325. ) {
  45326. this.tag = tag;
  45327. this.data = data;
  45328. this.children = children;
  45329. this.text = text;
  45330. this.elm = elm;
  45331. this.ns = undefined;
  45332. this.context = context;
  45333. this.fnContext = undefined;
  45334. this.fnOptions = undefined;
  45335. this.fnScopeId = undefined;
  45336. this.key = data && data.key;
  45337. this.componentOptions = componentOptions;
  45338. this.componentInstance = undefined;
  45339. this.parent = undefined;
  45340. this.raw = false;
  45341. this.isStatic = false;
  45342. this.isRootInsert = true;
  45343. this.isComment = false;
  45344. this.isCloned = false;
  45345. this.isOnce = false;
  45346. this.asyncFactory = asyncFactory;
  45347. this.asyncMeta = undefined;
  45348. this.isAsyncPlaceholder = false;
  45349. };
  45350. var prototypeAccessors = { child: { configurable: true } };
  45351. // DEPRECATED: alias for componentInstance for backwards compat.
  45352. /* istanbul ignore next */
  45353. prototypeAccessors.child.get = function () {
  45354. return this.componentInstance
  45355. };
  45356. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45357. var createEmptyVNode = function (text) {
  45358. if ( text === void 0 ) text = '';
  45359. var node = new VNode();
  45360. node.text = text;
  45361. node.isComment = true;
  45362. return node
  45363. };
  45364. function createTextVNode (val) {
  45365. return new VNode(undefined, undefined, undefined, String(val))
  45366. }
  45367. // optimized shallow clone
  45368. // used for static nodes and slot nodes because they may be reused across
  45369. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45370. // on their elm reference.
  45371. function cloneVNode (vnode) {
  45372. var cloned = new VNode(
  45373. vnode.tag,
  45374. vnode.data,
  45375. // #7975
  45376. // clone children array to avoid mutating original in case of cloning
  45377. // a child.
  45378. vnode.children && vnode.children.slice(),
  45379. vnode.text,
  45380. vnode.elm,
  45381. vnode.context,
  45382. vnode.componentOptions,
  45383. vnode.asyncFactory
  45384. );
  45385. cloned.ns = vnode.ns;
  45386. cloned.isStatic = vnode.isStatic;
  45387. cloned.key = vnode.key;
  45388. cloned.isComment = vnode.isComment;
  45389. cloned.fnContext = vnode.fnContext;
  45390. cloned.fnOptions = vnode.fnOptions;
  45391. cloned.fnScopeId = vnode.fnScopeId;
  45392. cloned.asyncMeta = vnode.asyncMeta;
  45393. cloned.isCloned = true;
  45394. return cloned
  45395. }
  45396. /*
  45397. * not type checking this file because flow doesn't play well with
  45398. * dynamically accessing methods on Array prototype
  45399. */
  45400. var arrayProto = Array.prototype;
  45401. var arrayMethods = Object.create(arrayProto);
  45402. var methodsToPatch = [
  45403. 'push',
  45404. 'pop',
  45405. 'shift',
  45406. 'unshift',
  45407. 'splice',
  45408. 'sort',
  45409. 'reverse'
  45410. ];
  45411. /**
  45412. * Intercept mutating methods and emit events
  45413. */
  45414. methodsToPatch.forEach(function (method) {
  45415. // cache original method
  45416. var original = arrayProto[method];
  45417. def(arrayMethods, method, function mutator () {
  45418. var args = [], len = arguments.length;
  45419. while ( len-- ) args[ len ] = arguments[ len ];
  45420. var result = original.apply(this, args);
  45421. var ob = this.__ob__;
  45422. var inserted;
  45423. switch (method) {
  45424. case 'push':
  45425. case 'unshift':
  45426. inserted = args;
  45427. break
  45428. case 'splice':
  45429. inserted = args.slice(2);
  45430. break
  45431. }
  45432. if (inserted) { ob.observeArray(inserted); }
  45433. // notify change
  45434. ob.dep.notify();
  45435. return result
  45436. });
  45437. });
  45438. /* */
  45439. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45440. /**
  45441. * In some cases we may want to disable observation inside a component's
  45442. * update computation.
  45443. */
  45444. var shouldObserve = true;
  45445. function toggleObserving (value) {
  45446. shouldObserve = value;
  45447. }
  45448. /**
  45449. * Observer class that is attached to each observed
  45450. * object. Once attached, the observer converts the target
  45451. * object's property keys into getter/setters that
  45452. * collect dependencies and dispatch updates.
  45453. */
  45454. var Observer = function Observer (value) {
  45455. this.value = value;
  45456. this.dep = new Dep();
  45457. this.vmCount = 0;
  45458. def(value, '__ob__', this);
  45459. if (Array.isArray(value)) {
  45460. if (hasProto) {
  45461. protoAugment(value, arrayMethods);
  45462. } else {
  45463. copyAugment(value, arrayMethods, arrayKeys);
  45464. }
  45465. this.observeArray(value);
  45466. } else {
  45467. this.walk(value);
  45468. }
  45469. };
  45470. /**
  45471. * Walk through all properties and convert them into
  45472. * getter/setters. This method should only be called when
  45473. * value type is Object.
  45474. */
  45475. Observer.prototype.walk = function walk (obj) {
  45476. var keys = Object.keys(obj);
  45477. for (var i = 0; i < keys.length; i++) {
  45478. defineReactive$$1(obj, keys[i]);
  45479. }
  45480. };
  45481. /**
  45482. * Observe a list of Array items.
  45483. */
  45484. Observer.prototype.observeArray = function observeArray (items) {
  45485. for (var i = 0, l = items.length; i < l; i++) {
  45486. observe(items[i]);
  45487. }
  45488. };
  45489. // helpers
  45490. /**
  45491. * Augment a target Object or Array by intercepting
  45492. * the prototype chain using __proto__
  45493. */
  45494. function protoAugment (target, src) {
  45495. /* eslint-disable no-proto */
  45496. target.__proto__ = src;
  45497. /* eslint-enable no-proto */
  45498. }
  45499. /**
  45500. * Augment a target Object or Array by defining
  45501. * hidden properties.
  45502. */
  45503. /* istanbul ignore next */
  45504. function copyAugment (target, src, keys) {
  45505. for (var i = 0, l = keys.length; i < l; i++) {
  45506. var key = keys[i];
  45507. def(target, key, src[key]);
  45508. }
  45509. }
  45510. /**
  45511. * Attempt to create an observer instance for a value,
  45512. * returns the new observer if successfully observed,
  45513. * or the existing observer if the value already has one.
  45514. */
  45515. function observe (value, asRootData) {
  45516. if (!isObject(value) || value instanceof VNode) {
  45517. return
  45518. }
  45519. var ob;
  45520. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45521. ob = value.__ob__;
  45522. } else if (
  45523. shouldObserve &&
  45524. !isServerRendering() &&
  45525. (Array.isArray(value) || isPlainObject(value)) &&
  45526. Object.isExtensible(value) &&
  45527. !value._isVue
  45528. ) {
  45529. ob = new Observer(value);
  45530. }
  45531. if (asRootData && ob) {
  45532. ob.vmCount++;
  45533. }
  45534. return ob
  45535. }
  45536. /**
  45537. * Define a reactive property on an Object.
  45538. */
  45539. function defineReactive$$1 (
  45540. obj,
  45541. key,
  45542. val,
  45543. customSetter,
  45544. shallow
  45545. ) {
  45546. var dep = new Dep();
  45547. var property = Object.getOwnPropertyDescriptor(obj, key);
  45548. if (property && property.configurable === false) {
  45549. return
  45550. }
  45551. // cater for pre-defined getter/setters
  45552. var getter = property && property.get;
  45553. var setter = property && property.set;
  45554. if ((!getter || setter) && arguments.length === 2) {
  45555. val = obj[key];
  45556. }
  45557. var childOb = !shallow && observe(val);
  45558. Object.defineProperty(obj, key, {
  45559. enumerable: true,
  45560. configurable: true,
  45561. get: function reactiveGetter () {
  45562. var value = getter ? getter.call(obj) : val;
  45563. if (Dep.target) {
  45564. dep.depend();
  45565. if (childOb) {
  45566. childOb.dep.depend();
  45567. if (Array.isArray(value)) {
  45568. dependArray(value);
  45569. }
  45570. }
  45571. }
  45572. return value
  45573. },
  45574. set: function reactiveSetter (newVal) {
  45575. var value = getter ? getter.call(obj) : val;
  45576. /* eslint-disable no-self-compare */
  45577. if (newVal === value || (newVal !== newVal && value !== value)) {
  45578. return
  45579. }
  45580. /* eslint-enable no-self-compare */
  45581. if (customSetter) {
  45582. customSetter();
  45583. }
  45584. // #7981: for accessor properties without setter
  45585. if (getter && !setter) { return }
  45586. if (setter) {
  45587. setter.call(obj, newVal);
  45588. } else {
  45589. val = newVal;
  45590. }
  45591. childOb = !shallow && observe(newVal);
  45592. dep.notify();
  45593. }
  45594. });
  45595. }
  45596. /**
  45597. * Set a property on an object. Adds the new property and
  45598. * triggers change notification if the property doesn't
  45599. * already exist.
  45600. */
  45601. function set (target, key, val) {
  45602. if (isUndef(target) || isPrimitive(target)
  45603. ) {
  45604. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45605. }
  45606. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45607. target.length = Math.max(target.length, key);
  45608. target.splice(key, 1, val);
  45609. return val
  45610. }
  45611. if (key in target && !(key in Object.prototype)) {
  45612. target[key] = val;
  45613. return val
  45614. }
  45615. var ob = (target).__ob__;
  45616. if (target._isVue || (ob && ob.vmCount)) {
  45617. warn(
  45618. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45619. 'at runtime - declare it upfront in the data option.'
  45620. );
  45621. return val
  45622. }
  45623. if (!ob) {
  45624. target[key] = val;
  45625. return val
  45626. }
  45627. defineReactive$$1(ob.value, key, val);
  45628. ob.dep.notify();
  45629. return val
  45630. }
  45631. /**
  45632. * Delete a property and trigger change if necessary.
  45633. */
  45634. function del (target, key) {
  45635. if (isUndef(target) || isPrimitive(target)
  45636. ) {
  45637. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45638. }
  45639. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45640. target.splice(key, 1);
  45641. return
  45642. }
  45643. var ob = (target).__ob__;
  45644. if (target._isVue || (ob && ob.vmCount)) {
  45645. warn(
  45646. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45647. '- just set it to null.'
  45648. );
  45649. return
  45650. }
  45651. if (!hasOwn(target, key)) {
  45652. return
  45653. }
  45654. delete target[key];
  45655. if (!ob) {
  45656. return
  45657. }
  45658. ob.dep.notify();
  45659. }
  45660. /**
  45661. * Collect dependencies on array elements when the array is touched, since
  45662. * we cannot intercept array element access like property getters.
  45663. */
  45664. function dependArray (value) {
  45665. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45666. e = value[i];
  45667. e && e.__ob__ && e.__ob__.dep.depend();
  45668. if (Array.isArray(e)) {
  45669. dependArray(e);
  45670. }
  45671. }
  45672. }
  45673. /* */
  45674. /**
  45675. * Option overwriting strategies are functions that handle
  45676. * how to merge a parent option value and a child option
  45677. * value into the final value.
  45678. */
  45679. var strats = config.optionMergeStrategies;
  45680. /**
  45681. * Options with restrictions
  45682. */
  45683. {
  45684. strats.el = strats.propsData = function (parent, child, vm, key) {
  45685. if (!vm) {
  45686. warn(
  45687. "option \"" + key + "\" can only be used during instance " +
  45688. 'creation with the `new` keyword.'
  45689. );
  45690. }
  45691. return defaultStrat(parent, child)
  45692. };
  45693. }
  45694. /**
  45695. * Helper that recursively merges two data objects together.
  45696. */
  45697. function mergeData (to, from) {
  45698. if (!from) { return to }
  45699. var key, toVal, fromVal;
  45700. var keys = hasSymbol
  45701. ? Reflect.ownKeys(from)
  45702. : Object.keys(from);
  45703. for (var i = 0; i < keys.length; i++) {
  45704. key = keys[i];
  45705. // in case the object is already observed...
  45706. if (key === '__ob__') { continue }
  45707. toVal = to[key];
  45708. fromVal = from[key];
  45709. if (!hasOwn(to, key)) {
  45710. set(to, key, fromVal);
  45711. } else if (
  45712. toVal !== fromVal &&
  45713. isPlainObject(toVal) &&
  45714. isPlainObject(fromVal)
  45715. ) {
  45716. mergeData(toVal, fromVal);
  45717. }
  45718. }
  45719. return to
  45720. }
  45721. /**
  45722. * Data
  45723. */
  45724. function mergeDataOrFn (
  45725. parentVal,
  45726. childVal,
  45727. vm
  45728. ) {
  45729. if (!vm) {
  45730. // in a Vue.extend merge, both should be functions
  45731. if (!childVal) {
  45732. return parentVal
  45733. }
  45734. if (!parentVal) {
  45735. return childVal
  45736. }
  45737. // when parentVal & childVal are both present,
  45738. // we need to return a function that returns the
  45739. // merged result of both functions... no need to
  45740. // check if parentVal is a function here because
  45741. // it has to be a function to pass previous merges.
  45742. return function mergedDataFn () {
  45743. return mergeData(
  45744. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45745. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45746. )
  45747. }
  45748. } else {
  45749. return function mergedInstanceDataFn () {
  45750. // instance merge
  45751. var instanceData = typeof childVal === 'function'
  45752. ? childVal.call(vm, vm)
  45753. : childVal;
  45754. var defaultData = typeof parentVal === 'function'
  45755. ? parentVal.call(vm, vm)
  45756. : parentVal;
  45757. if (instanceData) {
  45758. return mergeData(instanceData, defaultData)
  45759. } else {
  45760. return defaultData
  45761. }
  45762. }
  45763. }
  45764. }
  45765. strats.data = function (
  45766. parentVal,
  45767. childVal,
  45768. vm
  45769. ) {
  45770. if (!vm) {
  45771. if (childVal && typeof childVal !== 'function') {
  45772. warn(
  45773. 'The "data" option should be a function ' +
  45774. 'that returns a per-instance value in component ' +
  45775. 'definitions.',
  45776. vm
  45777. );
  45778. return parentVal
  45779. }
  45780. return mergeDataOrFn(parentVal, childVal)
  45781. }
  45782. return mergeDataOrFn(parentVal, childVal, vm)
  45783. };
  45784. /**
  45785. * Hooks and props are merged as arrays.
  45786. */
  45787. function mergeHook (
  45788. parentVal,
  45789. childVal
  45790. ) {
  45791. var res = childVal
  45792. ? parentVal
  45793. ? parentVal.concat(childVal)
  45794. : Array.isArray(childVal)
  45795. ? childVal
  45796. : [childVal]
  45797. : parentVal;
  45798. return res
  45799. ? dedupeHooks(res)
  45800. : res
  45801. }
  45802. function dedupeHooks (hooks) {
  45803. var res = [];
  45804. for (var i = 0; i < hooks.length; i++) {
  45805. if (res.indexOf(hooks[i]) === -1) {
  45806. res.push(hooks[i]);
  45807. }
  45808. }
  45809. return res
  45810. }
  45811. LIFECYCLE_HOOKS.forEach(function (hook) {
  45812. strats[hook] = mergeHook;
  45813. });
  45814. /**
  45815. * Assets
  45816. *
  45817. * When a vm is present (instance creation), we need to do
  45818. * a three-way merge between constructor options, instance
  45819. * options and parent options.
  45820. */
  45821. function mergeAssets (
  45822. parentVal,
  45823. childVal,
  45824. vm,
  45825. key
  45826. ) {
  45827. var res = Object.create(parentVal || null);
  45828. if (childVal) {
  45829. assertObjectType(key, childVal, vm);
  45830. return extend(res, childVal)
  45831. } else {
  45832. return res
  45833. }
  45834. }
  45835. ASSET_TYPES.forEach(function (type) {
  45836. strats[type + 's'] = mergeAssets;
  45837. });
  45838. /**
  45839. * Watchers.
  45840. *
  45841. * Watchers hashes should not overwrite one
  45842. * another, so we merge them as arrays.
  45843. */
  45844. strats.watch = function (
  45845. parentVal,
  45846. childVal,
  45847. vm,
  45848. key
  45849. ) {
  45850. // work around Firefox's Object.prototype.watch...
  45851. if (parentVal === nativeWatch) { parentVal = undefined; }
  45852. if (childVal === nativeWatch) { childVal = undefined; }
  45853. /* istanbul ignore if */
  45854. if (!childVal) { return Object.create(parentVal || null) }
  45855. {
  45856. assertObjectType(key, childVal, vm);
  45857. }
  45858. if (!parentVal) { return childVal }
  45859. var ret = {};
  45860. extend(ret, parentVal);
  45861. for (var key$1 in childVal) {
  45862. var parent = ret[key$1];
  45863. var child = childVal[key$1];
  45864. if (parent && !Array.isArray(parent)) {
  45865. parent = [parent];
  45866. }
  45867. ret[key$1] = parent
  45868. ? parent.concat(child)
  45869. : Array.isArray(child) ? child : [child];
  45870. }
  45871. return ret
  45872. };
  45873. /**
  45874. * Other object hashes.
  45875. */
  45876. strats.props =
  45877. strats.methods =
  45878. strats.inject =
  45879. strats.computed = function (
  45880. parentVal,
  45881. childVal,
  45882. vm,
  45883. key
  45884. ) {
  45885. if (childVal && "development" !== 'production') {
  45886. assertObjectType(key, childVal, vm);
  45887. }
  45888. if (!parentVal) { return childVal }
  45889. var ret = Object.create(null);
  45890. extend(ret, parentVal);
  45891. if (childVal) { extend(ret, childVal); }
  45892. return ret
  45893. };
  45894. strats.provide = mergeDataOrFn;
  45895. /**
  45896. * Default strategy.
  45897. */
  45898. var defaultStrat = function (parentVal, childVal) {
  45899. return childVal === undefined
  45900. ? parentVal
  45901. : childVal
  45902. };
  45903. /**
  45904. * Validate component names
  45905. */
  45906. function checkComponents (options) {
  45907. for (var key in options.components) {
  45908. validateComponentName(key);
  45909. }
  45910. }
  45911. function validateComponentName (name) {
  45912. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45913. warn(
  45914. 'Invalid component name: "' + name + '". Component names ' +
  45915. 'should conform to valid custom element name in html5 specification.'
  45916. );
  45917. }
  45918. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45919. warn(
  45920. 'Do not use built-in or reserved HTML elements as component ' +
  45921. 'id: ' + name
  45922. );
  45923. }
  45924. }
  45925. /**
  45926. * Ensure all props option syntax are normalized into the
  45927. * Object-based format.
  45928. */
  45929. function normalizeProps (options, vm) {
  45930. var props = options.props;
  45931. if (!props) { return }
  45932. var res = {};
  45933. var i, val, name;
  45934. if (Array.isArray(props)) {
  45935. i = props.length;
  45936. while (i--) {
  45937. val = props[i];
  45938. if (typeof val === 'string') {
  45939. name = camelize(val);
  45940. res[name] = { type: null };
  45941. } else {
  45942. warn('props must be strings when using array syntax.');
  45943. }
  45944. }
  45945. } else if (isPlainObject(props)) {
  45946. for (var key in props) {
  45947. val = props[key];
  45948. name = camelize(key);
  45949. res[name] = isPlainObject(val)
  45950. ? val
  45951. : { type: val };
  45952. }
  45953. } else {
  45954. warn(
  45955. "Invalid value for option \"props\": expected an Array or an Object, " +
  45956. "but got " + (toRawType(props)) + ".",
  45957. vm
  45958. );
  45959. }
  45960. options.props = res;
  45961. }
  45962. /**
  45963. * Normalize all injections into Object-based format
  45964. */
  45965. function normalizeInject (options, vm) {
  45966. var inject = options.inject;
  45967. if (!inject) { return }
  45968. var normalized = options.inject = {};
  45969. if (Array.isArray(inject)) {
  45970. for (var i = 0; i < inject.length; i++) {
  45971. normalized[inject[i]] = { from: inject[i] };
  45972. }
  45973. } else if (isPlainObject(inject)) {
  45974. for (var key in inject) {
  45975. var val = inject[key];
  45976. normalized[key] = isPlainObject(val)
  45977. ? extend({ from: key }, val)
  45978. : { from: val };
  45979. }
  45980. } else {
  45981. warn(
  45982. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45983. "but got " + (toRawType(inject)) + ".",
  45984. vm
  45985. );
  45986. }
  45987. }
  45988. /**
  45989. * Normalize raw function directives into object format.
  45990. */
  45991. function normalizeDirectives (options) {
  45992. var dirs = options.directives;
  45993. if (dirs) {
  45994. for (var key in dirs) {
  45995. var def$$1 = dirs[key];
  45996. if (typeof def$$1 === 'function') {
  45997. dirs[key] = { bind: def$$1, update: def$$1 };
  45998. }
  45999. }
  46000. }
  46001. }
  46002. function assertObjectType (name, value, vm) {
  46003. if (!isPlainObject(value)) {
  46004. warn(
  46005. "Invalid value for option \"" + name + "\": expected an Object, " +
  46006. "but got " + (toRawType(value)) + ".",
  46007. vm
  46008. );
  46009. }
  46010. }
  46011. /**
  46012. * Merge two option objects into a new one.
  46013. * Core utility used in both instantiation and inheritance.
  46014. */
  46015. function mergeOptions (
  46016. parent,
  46017. child,
  46018. vm
  46019. ) {
  46020. {
  46021. checkComponents(child);
  46022. }
  46023. if (typeof child === 'function') {
  46024. child = child.options;
  46025. }
  46026. normalizeProps(child, vm);
  46027. normalizeInject(child, vm);
  46028. normalizeDirectives(child);
  46029. // Apply extends and mixins on the child options,
  46030. // but only if it is a raw options object that isn't
  46031. // the result of another mergeOptions call.
  46032. // Only merged options has the _base property.
  46033. if (!child._base) {
  46034. if (child.extends) {
  46035. parent = mergeOptions(parent, child.extends, vm);
  46036. }
  46037. if (child.mixins) {
  46038. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46039. parent = mergeOptions(parent, child.mixins[i], vm);
  46040. }
  46041. }
  46042. }
  46043. var options = {};
  46044. var key;
  46045. for (key in parent) {
  46046. mergeField(key);
  46047. }
  46048. for (key in child) {
  46049. if (!hasOwn(parent, key)) {
  46050. mergeField(key);
  46051. }
  46052. }
  46053. function mergeField (key) {
  46054. var strat = strats[key] || defaultStrat;
  46055. options[key] = strat(parent[key], child[key], vm, key);
  46056. }
  46057. return options
  46058. }
  46059. /**
  46060. * Resolve an asset.
  46061. * This function is used because child instances need access
  46062. * to assets defined in its ancestor chain.
  46063. */
  46064. function resolveAsset (
  46065. options,
  46066. type,
  46067. id,
  46068. warnMissing
  46069. ) {
  46070. /* istanbul ignore if */
  46071. if (typeof id !== 'string') {
  46072. return
  46073. }
  46074. var assets = options[type];
  46075. // check local registration variations first
  46076. if (hasOwn(assets, id)) { return assets[id] }
  46077. var camelizedId = camelize(id);
  46078. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46079. var PascalCaseId = capitalize(camelizedId);
  46080. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46081. // fallback to prototype chain
  46082. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46083. if (warnMissing && !res) {
  46084. warn(
  46085. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46086. options
  46087. );
  46088. }
  46089. return res
  46090. }
  46091. /* */
  46092. function validateProp (
  46093. key,
  46094. propOptions,
  46095. propsData,
  46096. vm
  46097. ) {
  46098. var prop = propOptions[key];
  46099. var absent = !hasOwn(propsData, key);
  46100. var value = propsData[key];
  46101. // boolean casting
  46102. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46103. if (booleanIndex > -1) {
  46104. if (absent && !hasOwn(prop, 'default')) {
  46105. value = false;
  46106. } else if (value === '' || value === hyphenate(key)) {
  46107. // only cast empty string / same name to boolean if
  46108. // boolean has higher priority
  46109. var stringIndex = getTypeIndex(String, prop.type);
  46110. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46111. value = true;
  46112. }
  46113. }
  46114. }
  46115. // check default value
  46116. if (value === undefined) {
  46117. value = getPropDefaultValue(vm, prop, key);
  46118. // since the default value is a fresh copy,
  46119. // make sure to observe it.
  46120. var prevShouldObserve = shouldObserve;
  46121. toggleObserving(true);
  46122. observe(value);
  46123. toggleObserving(prevShouldObserve);
  46124. }
  46125. {
  46126. assertProp(prop, key, value, vm, absent);
  46127. }
  46128. return value
  46129. }
  46130. /**
  46131. * Get the default value of a prop.
  46132. */
  46133. function getPropDefaultValue (vm, prop, key) {
  46134. // no default, return undefined
  46135. if (!hasOwn(prop, 'default')) {
  46136. return undefined
  46137. }
  46138. var def = prop.default;
  46139. // warn against non-factory defaults for Object & Array
  46140. if (isObject(def)) {
  46141. warn(
  46142. 'Invalid default value for prop "' + key + '": ' +
  46143. 'Props with type Object/Array must use a factory function ' +
  46144. 'to return the default value.',
  46145. vm
  46146. );
  46147. }
  46148. // the raw prop value was also undefined from previous render,
  46149. // return previous default value to avoid unnecessary watcher trigger
  46150. if (vm && vm.$options.propsData &&
  46151. vm.$options.propsData[key] === undefined &&
  46152. vm._props[key] !== undefined
  46153. ) {
  46154. return vm._props[key]
  46155. }
  46156. // call factory function for non-Function types
  46157. // a value is Function if its prototype is function even across different execution context
  46158. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46159. ? def.call(vm)
  46160. : def
  46161. }
  46162. /**
  46163. * Assert whether a prop is valid.
  46164. */
  46165. function assertProp (
  46166. prop,
  46167. name,
  46168. value,
  46169. vm,
  46170. absent
  46171. ) {
  46172. if (prop.required && absent) {
  46173. warn(
  46174. 'Missing required prop: "' + name + '"',
  46175. vm
  46176. );
  46177. return
  46178. }
  46179. if (value == null && !prop.required) {
  46180. return
  46181. }
  46182. var type = prop.type;
  46183. var valid = !type || type === true;
  46184. var expectedTypes = [];
  46185. if (type) {
  46186. if (!Array.isArray(type)) {
  46187. type = [type];
  46188. }
  46189. for (var i = 0; i < type.length && !valid; i++) {
  46190. var assertedType = assertType(value, type[i]);
  46191. expectedTypes.push(assertedType.expectedType || '');
  46192. valid = assertedType.valid;
  46193. }
  46194. }
  46195. if (!valid) {
  46196. warn(
  46197. getInvalidTypeMessage(name, value, expectedTypes),
  46198. vm
  46199. );
  46200. return
  46201. }
  46202. var validator = prop.validator;
  46203. if (validator) {
  46204. if (!validator(value)) {
  46205. warn(
  46206. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46207. vm
  46208. );
  46209. }
  46210. }
  46211. }
  46212. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46213. function assertType (value, type) {
  46214. var valid;
  46215. var expectedType = getType(type);
  46216. if (simpleCheckRE.test(expectedType)) {
  46217. var t = typeof value;
  46218. valid = t === expectedType.toLowerCase();
  46219. // for primitive wrapper objects
  46220. if (!valid && t === 'object') {
  46221. valid = value instanceof type;
  46222. }
  46223. } else if (expectedType === 'Object') {
  46224. valid = isPlainObject(value);
  46225. } else if (expectedType === 'Array') {
  46226. valid = Array.isArray(value);
  46227. } else {
  46228. valid = value instanceof type;
  46229. }
  46230. return {
  46231. valid: valid,
  46232. expectedType: expectedType
  46233. }
  46234. }
  46235. /**
  46236. * Use function string name to check built-in types,
  46237. * because a simple equality check will fail when running
  46238. * across different vms / iframes.
  46239. */
  46240. function getType (fn) {
  46241. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46242. return match ? match[1] : ''
  46243. }
  46244. function isSameType (a, b) {
  46245. return getType(a) === getType(b)
  46246. }
  46247. function getTypeIndex (type, expectedTypes) {
  46248. if (!Array.isArray(expectedTypes)) {
  46249. return isSameType(expectedTypes, type) ? 0 : -1
  46250. }
  46251. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46252. if (isSameType(expectedTypes[i], type)) {
  46253. return i
  46254. }
  46255. }
  46256. return -1
  46257. }
  46258. function getInvalidTypeMessage (name, value, expectedTypes) {
  46259. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46260. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46261. var expectedType = expectedTypes[0];
  46262. var receivedType = toRawType(value);
  46263. var expectedValue = styleValue(value, expectedType);
  46264. var receivedValue = styleValue(value, receivedType);
  46265. // check if we need to specify expected value
  46266. if (expectedTypes.length === 1 &&
  46267. isExplicable(expectedType) &&
  46268. !isBoolean(expectedType, receivedType)) {
  46269. message += " with value " + expectedValue;
  46270. }
  46271. message += ", got " + receivedType + " ";
  46272. // check if we need to specify received value
  46273. if (isExplicable(receivedType)) {
  46274. message += "with value " + receivedValue + ".";
  46275. }
  46276. return message
  46277. }
  46278. function styleValue (value, type) {
  46279. if (type === 'String') {
  46280. return ("\"" + value + "\"")
  46281. } else if (type === 'Number') {
  46282. return ("" + (Number(value)))
  46283. } else {
  46284. return ("" + value)
  46285. }
  46286. }
  46287. function isExplicable (value) {
  46288. var explicitTypes = ['string', 'number', 'boolean'];
  46289. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46290. }
  46291. function isBoolean () {
  46292. var args = [], len = arguments.length;
  46293. while ( len-- ) args[ len ] = arguments[ len ];
  46294. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46295. }
  46296. /* */
  46297. function handleError (err, vm, info) {
  46298. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46299. // See: https://github.com/vuejs/vuex/issues/1505
  46300. pushTarget();
  46301. try {
  46302. if (vm) {
  46303. var cur = vm;
  46304. while ((cur = cur.$parent)) {
  46305. var hooks = cur.$options.errorCaptured;
  46306. if (hooks) {
  46307. for (var i = 0; i < hooks.length; i++) {
  46308. try {
  46309. var capture = hooks[i].call(cur, err, vm, info) === false;
  46310. if (capture) { return }
  46311. } catch (e) {
  46312. globalHandleError(e, cur, 'errorCaptured hook');
  46313. }
  46314. }
  46315. }
  46316. }
  46317. }
  46318. globalHandleError(err, vm, info);
  46319. } finally {
  46320. popTarget();
  46321. }
  46322. }
  46323. function invokeWithErrorHandling (
  46324. handler,
  46325. context,
  46326. args,
  46327. vm,
  46328. info
  46329. ) {
  46330. var res;
  46331. try {
  46332. res = args ? handler.apply(context, args) : handler.call(context);
  46333. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46334. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46335. // issue #9511
  46336. // avoid catch triggering multiple times when nested calls
  46337. res._handled = true;
  46338. }
  46339. } catch (e) {
  46340. handleError(e, vm, info);
  46341. }
  46342. return res
  46343. }
  46344. function globalHandleError (err, vm, info) {
  46345. if (config.errorHandler) {
  46346. try {
  46347. return config.errorHandler.call(null, err, vm, info)
  46348. } catch (e) {
  46349. // if the user intentionally throws the original error in the handler,
  46350. // do not log it twice
  46351. if (e !== err) {
  46352. logError(e, null, 'config.errorHandler');
  46353. }
  46354. }
  46355. }
  46356. logError(err, vm, info);
  46357. }
  46358. function logError (err, vm, info) {
  46359. {
  46360. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46361. }
  46362. /* istanbul ignore else */
  46363. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46364. console.error(err);
  46365. } else {
  46366. throw err
  46367. }
  46368. }
  46369. /* */
  46370. var isUsingMicroTask = false;
  46371. var callbacks = [];
  46372. var pending = false;
  46373. function flushCallbacks () {
  46374. pending = false;
  46375. var copies = callbacks.slice(0);
  46376. callbacks.length = 0;
  46377. for (var i = 0; i < copies.length; i++) {
  46378. copies[i]();
  46379. }
  46380. }
  46381. // Here we have async deferring wrappers using microtasks.
  46382. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46383. // However, it has subtle problems when state is changed right before repaint
  46384. // (e.g. #6813, out-in transitions).
  46385. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46386. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46387. // So we now use microtasks everywhere, again.
  46388. // A major drawback of this tradeoff is that there are some scenarios
  46389. // where microtasks have too high a priority and fire in between supposedly
  46390. // sequential events (e.g. #4521, #6690, which have workarounds)
  46391. // or even between bubbling of the same event (#6566).
  46392. var timerFunc;
  46393. // The nextTick behavior leverages the microtask queue, which can be accessed
  46394. // via either native Promise.then or MutationObserver.
  46395. // MutationObserver has wider support, however it is seriously bugged in
  46396. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46397. // completely stops working after triggering a few times... so, if native
  46398. // Promise is available, we will use it:
  46399. /* istanbul ignore next, $flow-disable-line */
  46400. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46401. var p = Promise.resolve();
  46402. timerFunc = function () {
  46403. p.then(flushCallbacks);
  46404. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46405. // it can get stuck in a weird state where callbacks are pushed into the
  46406. // microtask queue but the queue isn't being flushed, until the browser
  46407. // needs to do some other work, e.g. handle a timer. Therefore we can
  46408. // "force" the microtask queue to be flushed by adding an empty timer.
  46409. if (isIOS) { setTimeout(noop); }
  46410. };
  46411. isUsingMicroTask = true;
  46412. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46413. isNative(MutationObserver) ||
  46414. // PhantomJS and iOS 7.x
  46415. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46416. )) {
  46417. // Use MutationObserver where native Promise is not available,
  46418. // e.g. PhantomJS, iOS7, Android 4.4
  46419. // (#6466 MutationObserver is unreliable in IE11)
  46420. var counter = 1;
  46421. var observer = new MutationObserver(flushCallbacks);
  46422. var textNode = document.createTextNode(String(counter));
  46423. observer.observe(textNode, {
  46424. characterData: true
  46425. });
  46426. timerFunc = function () {
  46427. counter = (counter + 1) % 2;
  46428. textNode.data = String(counter);
  46429. };
  46430. isUsingMicroTask = true;
  46431. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46432. // Fallback to setImmediate.
  46433. // Technically it leverages the (macro) task queue,
  46434. // but it is still a better choice than setTimeout.
  46435. timerFunc = function () {
  46436. setImmediate(flushCallbacks);
  46437. };
  46438. } else {
  46439. // Fallback to setTimeout.
  46440. timerFunc = function () {
  46441. setTimeout(flushCallbacks, 0);
  46442. };
  46443. }
  46444. function nextTick (cb, ctx) {
  46445. var _resolve;
  46446. callbacks.push(function () {
  46447. if (cb) {
  46448. try {
  46449. cb.call(ctx);
  46450. } catch (e) {
  46451. handleError(e, ctx, 'nextTick');
  46452. }
  46453. } else if (_resolve) {
  46454. _resolve(ctx);
  46455. }
  46456. });
  46457. if (!pending) {
  46458. pending = true;
  46459. timerFunc();
  46460. }
  46461. // $flow-disable-line
  46462. if (!cb && typeof Promise !== 'undefined') {
  46463. return new Promise(function (resolve) {
  46464. _resolve = resolve;
  46465. })
  46466. }
  46467. }
  46468. /* */
  46469. var mark;
  46470. var measure;
  46471. {
  46472. var perf = inBrowser && window.performance;
  46473. /* istanbul ignore if */
  46474. if (
  46475. perf &&
  46476. perf.mark &&
  46477. perf.measure &&
  46478. perf.clearMarks &&
  46479. perf.clearMeasures
  46480. ) {
  46481. mark = function (tag) { return perf.mark(tag); };
  46482. measure = function (name, startTag, endTag) {
  46483. perf.measure(name, startTag, endTag);
  46484. perf.clearMarks(startTag);
  46485. perf.clearMarks(endTag);
  46486. // perf.clearMeasures(name)
  46487. };
  46488. }
  46489. }
  46490. /* not type checking this file because flow doesn't play well with Proxy */
  46491. var initProxy;
  46492. {
  46493. var allowedGlobals = makeMap(
  46494. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46495. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46496. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46497. 'require' // for Webpack/Browserify
  46498. );
  46499. var warnNonPresent = function (target, key) {
  46500. warn(
  46501. "Property or method \"" + key + "\" is not defined on the instance but " +
  46502. 'referenced during render. Make sure that this property is reactive, ' +
  46503. 'either in the data option, or for class-based components, by ' +
  46504. 'initializing the property. ' +
  46505. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46506. target
  46507. );
  46508. };
  46509. var warnReservedPrefix = function (target, key) {
  46510. warn(
  46511. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46512. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46513. 'prevent conflicts with Vue internals. ' +
  46514. 'See: https://vuejs.org/v2/api/#data',
  46515. target
  46516. );
  46517. };
  46518. var hasProxy =
  46519. typeof Proxy !== 'undefined' && isNative(Proxy);
  46520. if (hasProxy) {
  46521. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46522. config.keyCodes = new Proxy(config.keyCodes, {
  46523. set: function set (target, key, value) {
  46524. if (isBuiltInModifier(key)) {
  46525. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46526. return false
  46527. } else {
  46528. target[key] = value;
  46529. return true
  46530. }
  46531. }
  46532. });
  46533. }
  46534. var hasHandler = {
  46535. has: function has (target, key) {
  46536. var has = key in target;
  46537. var isAllowed = allowedGlobals(key) ||
  46538. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46539. if (!has && !isAllowed) {
  46540. if (key in target.$data) { warnReservedPrefix(target, key); }
  46541. else { warnNonPresent(target, key); }
  46542. }
  46543. return has || !isAllowed
  46544. }
  46545. };
  46546. var getHandler = {
  46547. get: function get (target, key) {
  46548. if (typeof key === 'string' && !(key in target)) {
  46549. if (key in target.$data) { warnReservedPrefix(target, key); }
  46550. else { warnNonPresent(target, key); }
  46551. }
  46552. return target[key]
  46553. }
  46554. };
  46555. initProxy = function initProxy (vm) {
  46556. if (hasProxy) {
  46557. // determine which proxy handler to use
  46558. var options = vm.$options;
  46559. var handlers = options.render && options.render._withStripped
  46560. ? getHandler
  46561. : hasHandler;
  46562. vm._renderProxy = new Proxy(vm, handlers);
  46563. } else {
  46564. vm._renderProxy = vm;
  46565. }
  46566. };
  46567. }
  46568. /* */
  46569. var seenObjects = new _Set();
  46570. /**
  46571. * Recursively traverse an object to evoke all converted
  46572. * getters, so that every nested property inside the object
  46573. * is collected as a "deep" dependency.
  46574. */
  46575. function traverse (val) {
  46576. _traverse(val, seenObjects);
  46577. seenObjects.clear();
  46578. }
  46579. function _traverse (val, seen) {
  46580. var i, keys;
  46581. var isA = Array.isArray(val);
  46582. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46583. return
  46584. }
  46585. if (val.__ob__) {
  46586. var depId = val.__ob__.dep.id;
  46587. if (seen.has(depId)) {
  46588. return
  46589. }
  46590. seen.add(depId);
  46591. }
  46592. if (isA) {
  46593. i = val.length;
  46594. while (i--) { _traverse(val[i], seen); }
  46595. } else {
  46596. keys = Object.keys(val);
  46597. i = keys.length;
  46598. while (i--) { _traverse(val[keys[i]], seen); }
  46599. }
  46600. }
  46601. /* */
  46602. var normalizeEvent = cached(function (name) {
  46603. var passive = name.charAt(0) === '&';
  46604. name = passive ? name.slice(1) : name;
  46605. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46606. name = once$$1 ? name.slice(1) : name;
  46607. var capture = name.charAt(0) === '!';
  46608. name = capture ? name.slice(1) : name;
  46609. return {
  46610. name: name,
  46611. once: once$$1,
  46612. capture: capture,
  46613. passive: passive
  46614. }
  46615. });
  46616. function createFnInvoker (fns, vm) {
  46617. function invoker () {
  46618. var arguments$1 = arguments;
  46619. var fns = invoker.fns;
  46620. if (Array.isArray(fns)) {
  46621. var cloned = fns.slice();
  46622. for (var i = 0; i < cloned.length; i++) {
  46623. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46624. }
  46625. } else {
  46626. // return handler return value for single handlers
  46627. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46628. }
  46629. }
  46630. invoker.fns = fns;
  46631. return invoker
  46632. }
  46633. function updateListeners (
  46634. on,
  46635. oldOn,
  46636. add,
  46637. remove$$1,
  46638. createOnceHandler,
  46639. vm
  46640. ) {
  46641. var name, def$$1, cur, old, event;
  46642. for (name in on) {
  46643. def$$1 = cur = on[name];
  46644. old = oldOn[name];
  46645. event = normalizeEvent(name);
  46646. if (isUndef(cur)) {
  46647. warn(
  46648. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46649. vm
  46650. );
  46651. } else if (isUndef(old)) {
  46652. if (isUndef(cur.fns)) {
  46653. cur = on[name] = createFnInvoker(cur, vm);
  46654. }
  46655. if (isTrue(event.once)) {
  46656. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46657. }
  46658. add(event.name, cur, event.capture, event.passive, event.params);
  46659. } else if (cur !== old) {
  46660. old.fns = cur;
  46661. on[name] = old;
  46662. }
  46663. }
  46664. for (name in oldOn) {
  46665. if (isUndef(on[name])) {
  46666. event = normalizeEvent(name);
  46667. remove$$1(event.name, oldOn[name], event.capture);
  46668. }
  46669. }
  46670. }
  46671. /* */
  46672. function mergeVNodeHook (def, hookKey, hook) {
  46673. if (def instanceof VNode) {
  46674. def = def.data.hook || (def.data.hook = {});
  46675. }
  46676. var invoker;
  46677. var oldHook = def[hookKey];
  46678. function wrappedHook () {
  46679. hook.apply(this, arguments);
  46680. // important: remove merged hook to ensure it's called only once
  46681. // and prevent memory leak
  46682. remove(invoker.fns, wrappedHook);
  46683. }
  46684. if (isUndef(oldHook)) {
  46685. // no existing hook
  46686. invoker = createFnInvoker([wrappedHook]);
  46687. } else {
  46688. /* istanbul ignore if */
  46689. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46690. // already a merged invoker
  46691. invoker = oldHook;
  46692. invoker.fns.push(wrappedHook);
  46693. } else {
  46694. // existing plain hook
  46695. invoker = createFnInvoker([oldHook, wrappedHook]);
  46696. }
  46697. }
  46698. invoker.merged = true;
  46699. def[hookKey] = invoker;
  46700. }
  46701. /* */
  46702. function extractPropsFromVNodeData (
  46703. data,
  46704. Ctor,
  46705. tag
  46706. ) {
  46707. // we are only extracting raw values here.
  46708. // validation and default values are handled in the child
  46709. // component itself.
  46710. var propOptions = Ctor.options.props;
  46711. if (isUndef(propOptions)) {
  46712. return
  46713. }
  46714. var res = {};
  46715. var attrs = data.attrs;
  46716. var props = data.props;
  46717. if (isDef(attrs) || isDef(props)) {
  46718. for (var key in propOptions) {
  46719. var altKey = hyphenate(key);
  46720. {
  46721. var keyInLowerCase = key.toLowerCase();
  46722. if (
  46723. key !== keyInLowerCase &&
  46724. attrs && hasOwn(attrs, keyInLowerCase)
  46725. ) {
  46726. tip(
  46727. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46728. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46729. " \"" + key + "\". " +
  46730. "Note that HTML attributes are case-insensitive and camelCased " +
  46731. "props need to use their kebab-case equivalents when using in-DOM " +
  46732. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46733. );
  46734. }
  46735. }
  46736. checkProp(res, props, key, altKey, true) ||
  46737. checkProp(res, attrs, key, altKey, false);
  46738. }
  46739. }
  46740. return res
  46741. }
  46742. function checkProp (
  46743. res,
  46744. hash,
  46745. key,
  46746. altKey,
  46747. preserve
  46748. ) {
  46749. if (isDef(hash)) {
  46750. if (hasOwn(hash, key)) {
  46751. res[key] = hash[key];
  46752. if (!preserve) {
  46753. delete hash[key];
  46754. }
  46755. return true
  46756. } else if (hasOwn(hash, altKey)) {
  46757. res[key] = hash[altKey];
  46758. if (!preserve) {
  46759. delete hash[altKey];
  46760. }
  46761. return true
  46762. }
  46763. }
  46764. return false
  46765. }
  46766. /* */
  46767. // The template compiler attempts to minimize the need for normalization by
  46768. // statically analyzing the template at compile time.
  46769. //
  46770. // For plain HTML markup, normalization can be completely skipped because the
  46771. // generated render function is guaranteed to return Array<VNode>. There are
  46772. // two cases where extra normalization is needed:
  46773. // 1. When the children contains components - because a functional component
  46774. // may return an Array instead of a single root. In this case, just a simple
  46775. // normalization is needed - if any child is an Array, we flatten the whole
  46776. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46777. // because functional components already normalize their own children.
  46778. function simpleNormalizeChildren (children) {
  46779. for (var i = 0; i < children.length; i++) {
  46780. if (Array.isArray(children[i])) {
  46781. return Array.prototype.concat.apply([], children)
  46782. }
  46783. }
  46784. return children
  46785. }
  46786. // 2. When the children contains constructs that always generated nested Arrays,
  46787. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46788. // with hand-written render functions / JSX. In such cases a full normalization
  46789. // is needed to cater to all possible types of children values.
  46790. function normalizeChildren (children) {
  46791. return isPrimitive(children)
  46792. ? [createTextVNode(children)]
  46793. : Array.isArray(children)
  46794. ? normalizeArrayChildren(children)
  46795. : undefined
  46796. }
  46797. function isTextNode (node) {
  46798. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46799. }
  46800. function normalizeArrayChildren (children, nestedIndex) {
  46801. var res = [];
  46802. var i, c, lastIndex, last;
  46803. for (i = 0; i < children.length; i++) {
  46804. c = children[i];
  46805. if (isUndef(c) || typeof c === 'boolean') { continue }
  46806. lastIndex = res.length - 1;
  46807. last = res[lastIndex];
  46808. // nested
  46809. if (Array.isArray(c)) {
  46810. if (c.length > 0) {
  46811. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46812. // merge adjacent text nodes
  46813. if (isTextNode(c[0]) && isTextNode(last)) {
  46814. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46815. c.shift();
  46816. }
  46817. res.push.apply(res, c);
  46818. }
  46819. } else if (isPrimitive(c)) {
  46820. if (isTextNode(last)) {
  46821. // merge adjacent text nodes
  46822. // this is necessary for SSR hydration because text nodes are
  46823. // essentially merged when rendered to HTML strings
  46824. res[lastIndex] = createTextVNode(last.text + c);
  46825. } else if (c !== '') {
  46826. // convert primitive to vnode
  46827. res.push(createTextVNode(c));
  46828. }
  46829. } else {
  46830. if (isTextNode(c) && isTextNode(last)) {
  46831. // merge adjacent text nodes
  46832. res[lastIndex] = createTextVNode(last.text + c.text);
  46833. } else {
  46834. // default key for nested array children (likely generated by v-for)
  46835. if (isTrue(children._isVList) &&
  46836. isDef(c.tag) &&
  46837. isUndef(c.key) &&
  46838. isDef(nestedIndex)) {
  46839. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46840. }
  46841. res.push(c);
  46842. }
  46843. }
  46844. }
  46845. return res
  46846. }
  46847. /* */
  46848. function initProvide (vm) {
  46849. var provide = vm.$options.provide;
  46850. if (provide) {
  46851. vm._provided = typeof provide === 'function'
  46852. ? provide.call(vm)
  46853. : provide;
  46854. }
  46855. }
  46856. function initInjections (vm) {
  46857. var result = resolveInject(vm.$options.inject, vm);
  46858. if (result) {
  46859. toggleObserving(false);
  46860. Object.keys(result).forEach(function (key) {
  46861. /* istanbul ignore else */
  46862. {
  46863. defineReactive$$1(vm, key, result[key], function () {
  46864. warn(
  46865. "Avoid mutating an injected value directly since the changes will be " +
  46866. "overwritten whenever the provided component re-renders. " +
  46867. "injection being mutated: \"" + key + "\"",
  46868. vm
  46869. );
  46870. });
  46871. }
  46872. });
  46873. toggleObserving(true);
  46874. }
  46875. }
  46876. function resolveInject (inject, vm) {
  46877. if (inject) {
  46878. // inject is :any because flow is not smart enough to figure out cached
  46879. var result = Object.create(null);
  46880. var keys = hasSymbol
  46881. ? Reflect.ownKeys(inject)
  46882. : Object.keys(inject);
  46883. for (var i = 0; i < keys.length; i++) {
  46884. var key = keys[i];
  46885. // #6574 in case the inject object is observed...
  46886. if (key === '__ob__') { continue }
  46887. var provideKey = inject[key].from;
  46888. var source = vm;
  46889. while (source) {
  46890. if (source._provided && hasOwn(source._provided, provideKey)) {
  46891. result[key] = source._provided[provideKey];
  46892. break
  46893. }
  46894. source = source.$parent;
  46895. }
  46896. if (!source) {
  46897. if ('default' in inject[key]) {
  46898. var provideDefault = inject[key].default;
  46899. result[key] = typeof provideDefault === 'function'
  46900. ? provideDefault.call(vm)
  46901. : provideDefault;
  46902. } else {
  46903. warn(("Injection \"" + key + "\" not found"), vm);
  46904. }
  46905. }
  46906. }
  46907. return result
  46908. }
  46909. }
  46910. /* */
  46911. /**
  46912. * Runtime helper for resolving raw children VNodes into a slot object.
  46913. */
  46914. function resolveSlots (
  46915. children,
  46916. context
  46917. ) {
  46918. if (!children || !children.length) {
  46919. return {}
  46920. }
  46921. var slots = {};
  46922. for (var i = 0, l = children.length; i < l; i++) {
  46923. var child = children[i];
  46924. var data = child.data;
  46925. // remove slot attribute if the node is resolved as a Vue slot node
  46926. if (data && data.attrs && data.attrs.slot) {
  46927. delete data.attrs.slot;
  46928. }
  46929. // named slots should only be respected if the vnode was rendered in the
  46930. // same context.
  46931. if ((child.context === context || child.fnContext === context) &&
  46932. data && data.slot != null
  46933. ) {
  46934. var name = data.slot;
  46935. var slot = (slots[name] || (slots[name] = []));
  46936. if (child.tag === 'template') {
  46937. slot.push.apply(slot, child.children || []);
  46938. } else {
  46939. slot.push(child);
  46940. }
  46941. } else {
  46942. (slots.default || (slots.default = [])).push(child);
  46943. }
  46944. }
  46945. // ignore slots that contains only whitespace
  46946. for (var name$1 in slots) {
  46947. if (slots[name$1].every(isWhitespace)) {
  46948. delete slots[name$1];
  46949. }
  46950. }
  46951. return slots
  46952. }
  46953. function isWhitespace (node) {
  46954. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46955. }
  46956. /* */
  46957. function normalizeScopedSlots (
  46958. slots,
  46959. normalSlots,
  46960. prevSlots
  46961. ) {
  46962. var res;
  46963. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46964. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46965. var key = slots && slots.$key;
  46966. if (!slots) {
  46967. res = {};
  46968. } else if (slots._normalized) {
  46969. // fast path 1: child component re-render only, parent did not change
  46970. return slots._normalized
  46971. } else if (
  46972. isStable &&
  46973. prevSlots &&
  46974. prevSlots !== emptyObject &&
  46975. key === prevSlots.$key &&
  46976. !hasNormalSlots &&
  46977. !prevSlots.$hasNormal
  46978. ) {
  46979. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46980. // only need to normalize once
  46981. return prevSlots
  46982. } else {
  46983. res = {};
  46984. for (var key$1 in slots) {
  46985. if (slots[key$1] && key$1[0] !== '$') {
  46986. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46987. }
  46988. }
  46989. }
  46990. // expose normal slots on scopedSlots
  46991. for (var key$2 in normalSlots) {
  46992. if (!(key$2 in res)) {
  46993. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46994. }
  46995. }
  46996. // avoriaz seems to mock a non-extensible $scopedSlots object
  46997. // and when that is passed down this would cause an error
  46998. if (slots && Object.isExtensible(slots)) {
  46999. (slots)._normalized = res;
  47000. }
  47001. def(res, '$stable', isStable);
  47002. def(res, '$key', key);
  47003. def(res, '$hasNormal', hasNormalSlots);
  47004. return res
  47005. }
  47006. function normalizeScopedSlot(normalSlots, key, fn) {
  47007. var normalized = function () {
  47008. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47009. res = res && typeof res === 'object' && !Array.isArray(res)
  47010. ? [res] // single vnode
  47011. : normalizeChildren(res);
  47012. return res && (
  47013. res.length === 0 ||
  47014. (res.length === 1 && res[0].isComment) // #9658
  47015. ) ? undefined
  47016. : res
  47017. };
  47018. // this is a slot using the new v-slot syntax without scope. although it is
  47019. // compiled as a scoped slot, render fn users would expect it to be present
  47020. // on this.$slots because the usage is semantically a normal slot.
  47021. if (fn.proxy) {
  47022. Object.defineProperty(normalSlots, key, {
  47023. get: normalized,
  47024. enumerable: true,
  47025. configurable: true
  47026. });
  47027. }
  47028. return normalized
  47029. }
  47030. function proxyNormalSlot(slots, key) {
  47031. return function () { return slots[key]; }
  47032. }
  47033. /* */
  47034. /**
  47035. * Runtime helper for rendering v-for lists.
  47036. */
  47037. function renderList (
  47038. val,
  47039. render
  47040. ) {
  47041. var ret, i, l, keys, key;
  47042. if (Array.isArray(val) || typeof val === 'string') {
  47043. ret = new Array(val.length);
  47044. for (i = 0, l = val.length; i < l; i++) {
  47045. ret[i] = render(val[i], i);
  47046. }
  47047. } else if (typeof val === 'number') {
  47048. ret = new Array(val);
  47049. for (i = 0; i < val; i++) {
  47050. ret[i] = render(i + 1, i);
  47051. }
  47052. } else if (isObject(val)) {
  47053. if (hasSymbol && val[Symbol.iterator]) {
  47054. ret = [];
  47055. var iterator = val[Symbol.iterator]();
  47056. var result = iterator.next();
  47057. while (!result.done) {
  47058. ret.push(render(result.value, ret.length));
  47059. result = iterator.next();
  47060. }
  47061. } else {
  47062. keys = Object.keys(val);
  47063. ret = new Array(keys.length);
  47064. for (i = 0, l = keys.length; i < l; i++) {
  47065. key = keys[i];
  47066. ret[i] = render(val[key], key, i);
  47067. }
  47068. }
  47069. }
  47070. if (!isDef(ret)) {
  47071. ret = [];
  47072. }
  47073. (ret)._isVList = true;
  47074. return ret
  47075. }
  47076. /* */
  47077. /**
  47078. * Runtime helper for rendering <slot>
  47079. */
  47080. function renderSlot (
  47081. name,
  47082. fallback,
  47083. props,
  47084. bindObject
  47085. ) {
  47086. var scopedSlotFn = this.$scopedSlots[name];
  47087. var nodes;
  47088. if (scopedSlotFn) { // scoped slot
  47089. props = props || {};
  47090. if (bindObject) {
  47091. if (!isObject(bindObject)) {
  47092. warn(
  47093. 'slot v-bind without argument expects an Object',
  47094. this
  47095. );
  47096. }
  47097. props = extend(extend({}, bindObject), props);
  47098. }
  47099. nodes = scopedSlotFn(props) || fallback;
  47100. } else {
  47101. nodes = this.$slots[name] || fallback;
  47102. }
  47103. var target = props && props.slot;
  47104. if (target) {
  47105. return this.$createElement('template', { slot: target }, nodes)
  47106. } else {
  47107. return nodes
  47108. }
  47109. }
  47110. /* */
  47111. /**
  47112. * Runtime helper for resolving filters
  47113. */
  47114. function resolveFilter (id) {
  47115. return resolveAsset(this.$options, 'filters', id, true) || identity
  47116. }
  47117. /* */
  47118. function isKeyNotMatch (expect, actual) {
  47119. if (Array.isArray(expect)) {
  47120. return expect.indexOf(actual) === -1
  47121. } else {
  47122. return expect !== actual
  47123. }
  47124. }
  47125. /**
  47126. * Runtime helper for checking keyCodes from config.
  47127. * exposed as Vue.prototype._k
  47128. * passing in eventKeyName as last argument separately for backwards compat
  47129. */
  47130. function checkKeyCodes (
  47131. eventKeyCode,
  47132. key,
  47133. builtInKeyCode,
  47134. eventKeyName,
  47135. builtInKeyName
  47136. ) {
  47137. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47138. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47139. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47140. } else if (mappedKeyCode) {
  47141. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47142. } else if (eventKeyName) {
  47143. return hyphenate(eventKeyName) !== key
  47144. }
  47145. }
  47146. /* */
  47147. /**
  47148. * Runtime helper for merging v-bind="object" into a VNode's data.
  47149. */
  47150. function bindObjectProps (
  47151. data,
  47152. tag,
  47153. value,
  47154. asProp,
  47155. isSync
  47156. ) {
  47157. if (value) {
  47158. if (!isObject(value)) {
  47159. warn(
  47160. 'v-bind without argument expects an Object or Array value',
  47161. this
  47162. );
  47163. } else {
  47164. if (Array.isArray(value)) {
  47165. value = toObject(value);
  47166. }
  47167. var hash;
  47168. var loop = function ( key ) {
  47169. if (
  47170. key === 'class' ||
  47171. key === 'style' ||
  47172. isReservedAttribute(key)
  47173. ) {
  47174. hash = data;
  47175. } else {
  47176. var type = data.attrs && data.attrs.type;
  47177. hash = asProp || config.mustUseProp(tag, type, key)
  47178. ? data.domProps || (data.domProps = {})
  47179. : data.attrs || (data.attrs = {});
  47180. }
  47181. var camelizedKey = camelize(key);
  47182. var hyphenatedKey = hyphenate(key);
  47183. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47184. hash[key] = value[key];
  47185. if (isSync) {
  47186. var on = data.on || (data.on = {});
  47187. on[("update:" + key)] = function ($event) {
  47188. value[key] = $event;
  47189. };
  47190. }
  47191. }
  47192. };
  47193. for (var key in value) loop( key );
  47194. }
  47195. }
  47196. return data
  47197. }
  47198. /* */
  47199. /**
  47200. * Runtime helper for rendering static trees.
  47201. */
  47202. function renderStatic (
  47203. index,
  47204. isInFor
  47205. ) {
  47206. var cached = this._staticTrees || (this._staticTrees = []);
  47207. var tree = cached[index];
  47208. // if has already-rendered static tree and not inside v-for,
  47209. // we can reuse the same tree.
  47210. if (tree && !isInFor) {
  47211. return tree
  47212. }
  47213. // otherwise, render a fresh tree.
  47214. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47215. this._renderProxy,
  47216. null,
  47217. this // for render fns generated for functional component templates
  47218. );
  47219. markStatic(tree, ("__static__" + index), false);
  47220. return tree
  47221. }
  47222. /**
  47223. * Runtime helper for v-once.
  47224. * Effectively it means marking the node as static with a unique key.
  47225. */
  47226. function markOnce (
  47227. tree,
  47228. index,
  47229. key
  47230. ) {
  47231. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47232. return tree
  47233. }
  47234. function markStatic (
  47235. tree,
  47236. key,
  47237. isOnce
  47238. ) {
  47239. if (Array.isArray(tree)) {
  47240. for (var i = 0; i < tree.length; i++) {
  47241. if (tree[i] && typeof tree[i] !== 'string') {
  47242. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47243. }
  47244. }
  47245. } else {
  47246. markStaticNode(tree, key, isOnce);
  47247. }
  47248. }
  47249. function markStaticNode (node, key, isOnce) {
  47250. node.isStatic = true;
  47251. node.key = key;
  47252. node.isOnce = isOnce;
  47253. }
  47254. /* */
  47255. function bindObjectListeners (data, value) {
  47256. if (value) {
  47257. if (!isPlainObject(value)) {
  47258. warn(
  47259. 'v-on without argument expects an Object value',
  47260. this
  47261. );
  47262. } else {
  47263. var on = data.on = data.on ? extend({}, data.on) : {};
  47264. for (var key in value) {
  47265. var existing = on[key];
  47266. var ours = value[key];
  47267. on[key] = existing ? [].concat(existing, ours) : ours;
  47268. }
  47269. }
  47270. }
  47271. return data
  47272. }
  47273. /* */
  47274. function resolveScopedSlots (
  47275. fns, // see flow/vnode
  47276. res,
  47277. // the following are added in 2.6
  47278. hasDynamicKeys,
  47279. contentHashKey
  47280. ) {
  47281. res = res || { $stable: !hasDynamicKeys };
  47282. for (var i = 0; i < fns.length; i++) {
  47283. var slot = fns[i];
  47284. if (Array.isArray(slot)) {
  47285. resolveScopedSlots(slot, res, hasDynamicKeys);
  47286. } else if (slot) {
  47287. // marker for reverse proxying v-slot without scope on this.$slots
  47288. if (slot.proxy) {
  47289. slot.fn.proxy = true;
  47290. }
  47291. res[slot.key] = slot.fn;
  47292. }
  47293. }
  47294. if (contentHashKey) {
  47295. (res).$key = contentHashKey;
  47296. }
  47297. return res
  47298. }
  47299. /* */
  47300. function bindDynamicKeys (baseObj, values) {
  47301. for (var i = 0; i < values.length; i += 2) {
  47302. var key = values[i];
  47303. if (typeof key === 'string' && key) {
  47304. baseObj[values[i]] = values[i + 1];
  47305. } else if (key !== '' && key !== null) {
  47306. // null is a special value for explicitly removing a binding
  47307. warn(
  47308. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47309. this
  47310. );
  47311. }
  47312. }
  47313. return baseObj
  47314. }
  47315. // helper to dynamically append modifier runtime markers to event names.
  47316. // ensure only append when value is already string, otherwise it will be cast
  47317. // to string and cause the type check to miss.
  47318. function prependModifier (value, symbol) {
  47319. return typeof value === 'string' ? symbol + value : value
  47320. }
  47321. /* */
  47322. function installRenderHelpers (target) {
  47323. target._o = markOnce;
  47324. target._n = toNumber;
  47325. target._s = toString;
  47326. target._l = renderList;
  47327. target._t = renderSlot;
  47328. target._q = looseEqual;
  47329. target._i = looseIndexOf;
  47330. target._m = renderStatic;
  47331. target._f = resolveFilter;
  47332. target._k = checkKeyCodes;
  47333. target._b = bindObjectProps;
  47334. target._v = createTextVNode;
  47335. target._e = createEmptyVNode;
  47336. target._u = resolveScopedSlots;
  47337. target._g = bindObjectListeners;
  47338. target._d = bindDynamicKeys;
  47339. target._p = prependModifier;
  47340. }
  47341. /* */
  47342. function FunctionalRenderContext (
  47343. data,
  47344. props,
  47345. children,
  47346. parent,
  47347. Ctor
  47348. ) {
  47349. var this$1 = this;
  47350. var options = Ctor.options;
  47351. // ensure the createElement function in functional components
  47352. // gets a unique context - this is necessary for correct named slot check
  47353. var contextVm;
  47354. if (hasOwn(parent, '_uid')) {
  47355. contextVm = Object.create(parent);
  47356. // $flow-disable-line
  47357. contextVm._original = parent;
  47358. } else {
  47359. // the context vm passed in is a functional context as well.
  47360. // in this case we want to make sure we are able to get a hold to the
  47361. // real context instance.
  47362. contextVm = parent;
  47363. // $flow-disable-line
  47364. parent = parent._original;
  47365. }
  47366. var isCompiled = isTrue(options._compiled);
  47367. var needNormalization = !isCompiled;
  47368. this.data = data;
  47369. this.props = props;
  47370. this.children = children;
  47371. this.parent = parent;
  47372. this.listeners = data.on || emptyObject;
  47373. this.injections = resolveInject(options.inject, parent);
  47374. this.slots = function () {
  47375. if (!this$1.$slots) {
  47376. normalizeScopedSlots(
  47377. data.scopedSlots,
  47378. this$1.$slots = resolveSlots(children, parent)
  47379. );
  47380. }
  47381. return this$1.$slots
  47382. };
  47383. Object.defineProperty(this, 'scopedSlots', ({
  47384. enumerable: true,
  47385. get: function get () {
  47386. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47387. }
  47388. }));
  47389. // support for compiled functional template
  47390. if (isCompiled) {
  47391. // exposing $options for renderStatic()
  47392. this.$options = options;
  47393. // pre-resolve slots for renderSlot()
  47394. this.$slots = this.slots();
  47395. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47396. }
  47397. if (options._scopeId) {
  47398. this._c = function (a, b, c, d) {
  47399. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47400. if (vnode && !Array.isArray(vnode)) {
  47401. vnode.fnScopeId = options._scopeId;
  47402. vnode.fnContext = parent;
  47403. }
  47404. return vnode
  47405. };
  47406. } else {
  47407. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47408. }
  47409. }
  47410. installRenderHelpers(FunctionalRenderContext.prototype);
  47411. function createFunctionalComponent (
  47412. Ctor,
  47413. propsData,
  47414. data,
  47415. contextVm,
  47416. children
  47417. ) {
  47418. var options = Ctor.options;
  47419. var props = {};
  47420. var propOptions = options.props;
  47421. if (isDef(propOptions)) {
  47422. for (var key in propOptions) {
  47423. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47424. }
  47425. } else {
  47426. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47427. if (isDef(data.props)) { mergeProps(props, data.props); }
  47428. }
  47429. var renderContext = new FunctionalRenderContext(
  47430. data,
  47431. props,
  47432. children,
  47433. contextVm,
  47434. Ctor
  47435. );
  47436. var vnode = options.render.call(null, renderContext._c, renderContext);
  47437. if (vnode instanceof VNode) {
  47438. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47439. } else if (Array.isArray(vnode)) {
  47440. var vnodes = normalizeChildren(vnode) || [];
  47441. var res = new Array(vnodes.length);
  47442. for (var i = 0; i < vnodes.length; i++) {
  47443. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47444. }
  47445. return res
  47446. }
  47447. }
  47448. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47449. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47450. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47451. // that should not be matched to match.
  47452. var clone = cloneVNode(vnode);
  47453. clone.fnContext = contextVm;
  47454. clone.fnOptions = options;
  47455. {
  47456. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47457. }
  47458. if (data.slot) {
  47459. (clone.data || (clone.data = {})).slot = data.slot;
  47460. }
  47461. return clone
  47462. }
  47463. function mergeProps (to, from) {
  47464. for (var key in from) {
  47465. to[camelize(key)] = from[key];
  47466. }
  47467. }
  47468. /* */
  47469. /* */
  47470. /* */
  47471. /* */
  47472. // inline hooks to be invoked on component VNodes during patch
  47473. var componentVNodeHooks = {
  47474. init: function init (vnode, hydrating) {
  47475. if (
  47476. vnode.componentInstance &&
  47477. !vnode.componentInstance._isDestroyed &&
  47478. vnode.data.keepAlive
  47479. ) {
  47480. // kept-alive components, treat as a patch
  47481. var mountedNode = vnode; // work around flow
  47482. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47483. } else {
  47484. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47485. vnode,
  47486. activeInstance
  47487. );
  47488. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47489. }
  47490. },
  47491. prepatch: function prepatch (oldVnode, vnode) {
  47492. var options = vnode.componentOptions;
  47493. var child = vnode.componentInstance = oldVnode.componentInstance;
  47494. updateChildComponent(
  47495. child,
  47496. options.propsData, // updated props
  47497. options.listeners, // updated listeners
  47498. vnode, // new parent vnode
  47499. options.children // new children
  47500. );
  47501. },
  47502. insert: function insert (vnode) {
  47503. var context = vnode.context;
  47504. var componentInstance = vnode.componentInstance;
  47505. if (!componentInstance._isMounted) {
  47506. componentInstance._isMounted = true;
  47507. callHook(componentInstance, 'mounted');
  47508. }
  47509. if (vnode.data.keepAlive) {
  47510. if (context._isMounted) {
  47511. // vue-router#1212
  47512. // During updates, a kept-alive component's child components may
  47513. // change, so directly walking the tree here may call activated hooks
  47514. // on incorrect children. Instead we push them into a queue which will
  47515. // be processed after the whole patch process ended.
  47516. queueActivatedComponent(componentInstance);
  47517. } else {
  47518. activateChildComponent(componentInstance, true /* direct */);
  47519. }
  47520. }
  47521. },
  47522. destroy: function destroy (vnode) {
  47523. var componentInstance = vnode.componentInstance;
  47524. if (!componentInstance._isDestroyed) {
  47525. if (!vnode.data.keepAlive) {
  47526. componentInstance.$destroy();
  47527. } else {
  47528. deactivateChildComponent(componentInstance, true /* direct */);
  47529. }
  47530. }
  47531. }
  47532. };
  47533. var hooksToMerge = Object.keys(componentVNodeHooks);
  47534. function createComponent (
  47535. Ctor,
  47536. data,
  47537. context,
  47538. children,
  47539. tag
  47540. ) {
  47541. if (isUndef(Ctor)) {
  47542. return
  47543. }
  47544. var baseCtor = context.$options._base;
  47545. // plain options object: turn it into a constructor
  47546. if (isObject(Ctor)) {
  47547. Ctor = baseCtor.extend(Ctor);
  47548. }
  47549. // if at this stage it's not a constructor or an async component factory,
  47550. // reject.
  47551. if (typeof Ctor !== 'function') {
  47552. {
  47553. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47554. }
  47555. return
  47556. }
  47557. // async component
  47558. var asyncFactory;
  47559. if (isUndef(Ctor.cid)) {
  47560. asyncFactory = Ctor;
  47561. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47562. if (Ctor === undefined) {
  47563. // return a placeholder node for async component, which is rendered
  47564. // as a comment node but preserves all the raw information for the node.
  47565. // the information will be used for async server-rendering and hydration.
  47566. return createAsyncPlaceholder(
  47567. asyncFactory,
  47568. data,
  47569. context,
  47570. children,
  47571. tag
  47572. )
  47573. }
  47574. }
  47575. data = data || {};
  47576. // resolve constructor options in case global mixins are applied after
  47577. // component constructor creation
  47578. resolveConstructorOptions(Ctor);
  47579. // transform component v-model data into props & events
  47580. if (isDef(data.model)) {
  47581. transformModel(Ctor.options, data);
  47582. }
  47583. // extract props
  47584. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47585. // functional component
  47586. if (isTrue(Ctor.options.functional)) {
  47587. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47588. }
  47589. // extract listeners, since these needs to be treated as
  47590. // child component listeners instead of DOM listeners
  47591. var listeners = data.on;
  47592. // replace with listeners with .native modifier
  47593. // so it gets processed during parent component patch.
  47594. data.on = data.nativeOn;
  47595. if (isTrue(Ctor.options.abstract)) {
  47596. // abstract components do not keep anything
  47597. // other than props & listeners & slot
  47598. // work around flow
  47599. var slot = data.slot;
  47600. data = {};
  47601. if (slot) {
  47602. data.slot = slot;
  47603. }
  47604. }
  47605. // install component management hooks onto the placeholder node
  47606. installComponentHooks(data);
  47607. // return a placeholder vnode
  47608. var name = Ctor.options.name || tag;
  47609. var vnode = new VNode(
  47610. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47611. data, undefined, undefined, undefined, context,
  47612. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47613. asyncFactory
  47614. );
  47615. return vnode
  47616. }
  47617. function createComponentInstanceForVnode (
  47618. vnode, // we know it's MountedComponentVNode but flow doesn't
  47619. parent // activeInstance in lifecycle state
  47620. ) {
  47621. var options = {
  47622. _isComponent: true,
  47623. _parentVnode: vnode,
  47624. parent: parent
  47625. };
  47626. // check inline-template render functions
  47627. var inlineTemplate = vnode.data.inlineTemplate;
  47628. if (isDef(inlineTemplate)) {
  47629. options.render = inlineTemplate.render;
  47630. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47631. }
  47632. return new vnode.componentOptions.Ctor(options)
  47633. }
  47634. function installComponentHooks (data) {
  47635. var hooks = data.hook || (data.hook = {});
  47636. for (var i = 0; i < hooksToMerge.length; i++) {
  47637. var key = hooksToMerge[i];
  47638. var existing = hooks[key];
  47639. var toMerge = componentVNodeHooks[key];
  47640. if (existing !== toMerge && !(existing && existing._merged)) {
  47641. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47642. }
  47643. }
  47644. }
  47645. function mergeHook$1 (f1, f2) {
  47646. var merged = function (a, b) {
  47647. // flow complains about extra args which is why we use any
  47648. f1(a, b);
  47649. f2(a, b);
  47650. };
  47651. merged._merged = true;
  47652. return merged
  47653. }
  47654. // transform component v-model info (value and callback) into
  47655. // prop and event handler respectively.
  47656. function transformModel (options, data) {
  47657. var prop = (options.model && options.model.prop) || 'value';
  47658. var event = (options.model && options.model.event) || 'input'
  47659. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47660. var on = data.on || (data.on = {});
  47661. var existing = on[event];
  47662. var callback = data.model.callback;
  47663. if (isDef(existing)) {
  47664. if (
  47665. Array.isArray(existing)
  47666. ? existing.indexOf(callback) === -1
  47667. : existing !== callback
  47668. ) {
  47669. on[event] = [callback].concat(existing);
  47670. }
  47671. } else {
  47672. on[event] = callback;
  47673. }
  47674. }
  47675. /* */
  47676. var SIMPLE_NORMALIZE = 1;
  47677. var ALWAYS_NORMALIZE = 2;
  47678. // wrapper function for providing a more flexible interface
  47679. // without getting yelled at by flow
  47680. function createElement (
  47681. context,
  47682. tag,
  47683. data,
  47684. children,
  47685. normalizationType,
  47686. alwaysNormalize
  47687. ) {
  47688. if (Array.isArray(data) || isPrimitive(data)) {
  47689. normalizationType = children;
  47690. children = data;
  47691. data = undefined;
  47692. }
  47693. if (isTrue(alwaysNormalize)) {
  47694. normalizationType = ALWAYS_NORMALIZE;
  47695. }
  47696. return _createElement(context, tag, data, children, normalizationType)
  47697. }
  47698. function _createElement (
  47699. context,
  47700. tag,
  47701. data,
  47702. children,
  47703. normalizationType
  47704. ) {
  47705. if (isDef(data) && isDef((data).__ob__)) {
  47706. warn(
  47707. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47708. 'Always create fresh vnode data objects in each render!',
  47709. context
  47710. );
  47711. return createEmptyVNode()
  47712. }
  47713. // object syntax in v-bind
  47714. if (isDef(data) && isDef(data.is)) {
  47715. tag = data.is;
  47716. }
  47717. if (!tag) {
  47718. // in case of component :is set to falsy value
  47719. return createEmptyVNode()
  47720. }
  47721. // warn against non-primitive key
  47722. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47723. ) {
  47724. {
  47725. warn(
  47726. 'Avoid using non-primitive value as key, ' +
  47727. 'use string/number value instead.',
  47728. context
  47729. );
  47730. }
  47731. }
  47732. // support single function children as default scoped slot
  47733. if (Array.isArray(children) &&
  47734. typeof children[0] === 'function'
  47735. ) {
  47736. data = data || {};
  47737. data.scopedSlots = { default: children[0] };
  47738. children.length = 0;
  47739. }
  47740. if (normalizationType === ALWAYS_NORMALIZE) {
  47741. children = normalizeChildren(children);
  47742. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47743. children = simpleNormalizeChildren(children);
  47744. }
  47745. var vnode, ns;
  47746. if (typeof tag === 'string') {
  47747. var Ctor;
  47748. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47749. if (config.isReservedTag(tag)) {
  47750. // platform built-in elements
  47751. if (isDef(data) && isDef(data.nativeOn)) {
  47752. warn(
  47753. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47754. context
  47755. );
  47756. }
  47757. vnode = new VNode(
  47758. config.parsePlatformTagName(tag), data, children,
  47759. undefined, undefined, context
  47760. );
  47761. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47762. // component
  47763. vnode = createComponent(Ctor, data, context, children, tag);
  47764. } else {
  47765. // unknown or unlisted namespaced elements
  47766. // check at runtime because it may get assigned a namespace when its
  47767. // parent normalizes children
  47768. vnode = new VNode(
  47769. tag, data, children,
  47770. undefined, undefined, context
  47771. );
  47772. }
  47773. } else {
  47774. // direct component options / constructor
  47775. vnode = createComponent(tag, data, context, children);
  47776. }
  47777. if (Array.isArray(vnode)) {
  47778. return vnode
  47779. } else if (isDef(vnode)) {
  47780. if (isDef(ns)) { applyNS(vnode, ns); }
  47781. if (isDef(data)) { registerDeepBindings(data); }
  47782. return vnode
  47783. } else {
  47784. return createEmptyVNode()
  47785. }
  47786. }
  47787. function applyNS (vnode, ns, force) {
  47788. vnode.ns = ns;
  47789. if (vnode.tag === 'foreignObject') {
  47790. // use default namespace inside foreignObject
  47791. ns = undefined;
  47792. force = true;
  47793. }
  47794. if (isDef(vnode.children)) {
  47795. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47796. var child = vnode.children[i];
  47797. if (isDef(child.tag) && (
  47798. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47799. applyNS(child, ns, force);
  47800. }
  47801. }
  47802. }
  47803. }
  47804. // ref #5318
  47805. // necessary to ensure parent re-render when deep bindings like :style and
  47806. // :class are used on slot nodes
  47807. function registerDeepBindings (data) {
  47808. if (isObject(data.style)) {
  47809. traverse(data.style);
  47810. }
  47811. if (isObject(data.class)) {
  47812. traverse(data.class);
  47813. }
  47814. }
  47815. /* */
  47816. function initRender (vm) {
  47817. vm._vnode = null; // the root of the child tree
  47818. vm._staticTrees = null; // v-once cached trees
  47819. var options = vm.$options;
  47820. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47821. var renderContext = parentVnode && parentVnode.context;
  47822. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47823. vm.$scopedSlots = emptyObject;
  47824. // bind the createElement fn to this instance
  47825. // so that we get proper render context inside it.
  47826. // args order: tag, data, children, normalizationType, alwaysNormalize
  47827. // internal version is used by render functions compiled from templates
  47828. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47829. // normalization is always applied for the public version, used in
  47830. // user-written render functions.
  47831. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47832. // $attrs & $listeners are exposed for easier HOC creation.
  47833. // they need to be reactive so that HOCs using them are always updated
  47834. var parentData = parentVnode && parentVnode.data;
  47835. /* istanbul ignore else */
  47836. {
  47837. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47838. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47839. }, true);
  47840. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47841. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47842. }, true);
  47843. }
  47844. }
  47845. var currentRenderingInstance = null;
  47846. function renderMixin (Vue) {
  47847. // install runtime convenience helpers
  47848. installRenderHelpers(Vue.prototype);
  47849. Vue.prototype.$nextTick = function (fn) {
  47850. return nextTick(fn, this)
  47851. };
  47852. Vue.prototype._render = function () {
  47853. var vm = this;
  47854. var ref = vm.$options;
  47855. var render = ref.render;
  47856. var _parentVnode = ref._parentVnode;
  47857. if (_parentVnode) {
  47858. vm.$scopedSlots = normalizeScopedSlots(
  47859. _parentVnode.data.scopedSlots,
  47860. vm.$slots,
  47861. vm.$scopedSlots
  47862. );
  47863. }
  47864. // set parent vnode. this allows render functions to have access
  47865. // to the data on the placeholder node.
  47866. vm.$vnode = _parentVnode;
  47867. // render self
  47868. var vnode;
  47869. try {
  47870. // There's no need to maintain a stack because all render fns are called
  47871. // separately from one another. Nested component's render fns are called
  47872. // when parent component is patched.
  47873. currentRenderingInstance = vm;
  47874. vnode = render.call(vm._renderProxy, vm.$createElement);
  47875. } catch (e) {
  47876. handleError(e, vm, "render");
  47877. // return error render result,
  47878. // or previous vnode to prevent render error causing blank component
  47879. /* istanbul ignore else */
  47880. if (vm.$options.renderError) {
  47881. try {
  47882. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47883. } catch (e) {
  47884. handleError(e, vm, "renderError");
  47885. vnode = vm._vnode;
  47886. }
  47887. } else {
  47888. vnode = vm._vnode;
  47889. }
  47890. } finally {
  47891. currentRenderingInstance = null;
  47892. }
  47893. // if the returned array contains only a single node, allow it
  47894. if (Array.isArray(vnode) && vnode.length === 1) {
  47895. vnode = vnode[0];
  47896. }
  47897. // return empty vnode in case the render function errored out
  47898. if (!(vnode instanceof VNode)) {
  47899. if (Array.isArray(vnode)) {
  47900. warn(
  47901. 'Multiple root nodes returned from render function. Render function ' +
  47902. 'should return a single root node.',
  47903. vm
  47904. );
  47905. }
  47906. vnode = createEmptyVNode();
  47907. }
  47908. // set parent
  47909. vnode.parent = _parentVnode;
  47910. return vnode
  47911. };
  47912. }
  47913. /* */
  47914. function ensureCtor (comp, base) {
  47915. if (
  47916. comp.__esModule ||
  47917. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47918. ) {
  47919. comp = comp.default;
  47920. }
  47921. return isObject(comp)
  47922. ? base.extend(comp)
  47923. : comp
  47924. }
  47925. function createAsyncPlaceholder (
  47926. factory,
  47927. data,
  47928. context,
  47929. children,
  47930. tag
  47931. ) {
  47932. var node = createEmptyVNode();
  47933. node.asyncFactory = factory;
  47934. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47935. return node
  47936. }
  47937. function resolveAsyncComponent (
  47938. factory,
  47939. baseCtor
  47940. ) {
  47941. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47942. return factory.errorComp
  47943. }
  47944. if (isDef(factory.resolved)) {
  47945. return factory.resolved
  47946. }
  47947. var owner = currentRenderingInstance;
  47948. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47949. // already pending
  47950. factory.owners.push(owner);
  47951. }
  47952. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47953. return factory.loadingComp
  47954. }
  47955. if (owner && !isDef(factory.owners)) {
  47956. var owners = factory.owners = [owner];
  47957. var sync = true;
  47958. var timerLoading = null;
  47959. var timerTimeout = null
  47960. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47961. var forceRender = function (renderCompleted) {
  47962. for (var i = 0, l = owners.length; i < l; i++) {
  47963. (owners[i]).$forceUpdate();
  47964. }
  47965. if (renderCompleted) {
  47966. owners.length = 0;
  47967. if (timerLoading !== null) {
  47968. clearTimeout(timerLoading);
  47969. timerLoading = null;
  47970. }
  47971. if (timerTimeout !== null) {
  47972. clearTimeout(timerTimeout);
  47973. timerTimeout = null;
  47974. }
  47975. }
  47976. };
  47977. var resolve = once(function (res) {
  47978. // cache resolved
  47979. factory.resolved = ensureCtor(res, baseCtor);
  47980. // invoke callbacks only if this is not a synchronous resolve
  47981. // (async resolves are shimmed as synchronous during SSR)
  47982. if (!sync) {
  47983. forceRender(true);
  47984. } else {
  47985. owners.length = 0;
  47986. }
  47987. });
  47988. var reject = once(function (reason) {
  47989. warn(
  47990. "Failed to resolve async component: " + (String(factory)) +
  47991. (reason ? ("\nReason: " + reason) : '')
  47992. );
  47993. if (isDef(factory.errorComp)) {
  47994. factory.error = true;
  47995. forceRender(true);
  47996. }
  47997. });
  47998. var res = factory(resolve, reject);
  47999. if (isObject(res)) {
  48000. if (isPromise(res)) {
  48001. // () => Promise
  48002. if (isUndef(factory.resolved)) {
  48003. res.then(resolve, reject);
  48004. }
  48005. } else if (isPromise(res.component)) {
  48006. res.component.then(resolve, reject);
  48007. if (isDef(res.error)) {
  48008. factory.errorComp = ensureCtor(res.error, baseCtor);
  48009. }
  48010. if (isDef(res.loading)) {
  48011. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48012. if (res.delay === 0) {
  48013. factory.loading = true;
  48014. } else {
  48015. timerLoading = setTimeout(function () {
  48016. timerLoading = null;
  48017. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48018. factory.loading = true;
  48019. forceRender(false);
  48020. }
  48021. }, res.delay || 200);
  48022. }
  48023. }
  48024. if (isDef(res.timeout)) {
  48025. timerTimeout = setTimeout(function () {
  48026. timerTimeout = null;
  48027. if (isUndef(factory.resolved)) {
  48028. reject(
  48029. "timeout (" + (res.timeout) + "ms)"
  48030. );
  48031. }
  48032. }, res.timeout);
  48033. }
  48034. }
  48035. }
  48036. sync = false;
  48037. // return in case resolved synchronously
  48038. return factory.loading
  48039. ? factory.loadingComp
  48040. : factory.resolved
  48041. }
  48042. }
  48043. /* */
  48044. function isAsyncPlaceholder (node) {
  48045. return node.isComment && node.asyncFactory
  48046. }
  48047. /* */
  48048. function getFirstComponentChild (children) {
  48049. if (Array.isArray(children)) {
  48050. for (var i = 0; i < children.length; i++) {
  48051. var c = children[i];
  48052. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48053. return c
  48054. }
  48055. }
  48056. }
  48057. }
  48058. /* */
  48059. /* */
  48060. function initEvents (vm) {
  48061. vm._events = Object.create(null);
  48062. vm._hasHookEvent = false;
  48063. // init parent attached events
  48064. var listeners = vm.$options._parentListeners;
  48065. if (listeners) {
  48066. updateComponentListeners(vm, listeners);
  48067. }
  48068. }
  48069. var target;
  48070. function add (event, fn) {
  48071. target.$on(event, fn);
  48072. }
  48073. function remove$1 (event, fn) {
  48074. target.$off(event, fn);
  48075. }
  48076. function createOnceHandler (event, fn) {
  48077. var _target = target;
  48078. return function onceHandler () {
  48079. var res = fn.apply(null, arguments);
  48080. if (res !== null) {
  48081. _target.$off(event, onceHandler);
  48082. }
  48083. }
  48084. }
  48085. function updateComponentListeners (
  48086. vm,
  48087. listeners,
  48088. oldListeners
  48089. ) {
  48090. target = vm;
  48091. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48092. target = undefined;
  48093. }
  48094. function eventsMixin (Vue) {
  48095. var hookRE = /^hook:/;
  48096. Vue.prototype.$on = function (event, fn) {
  48097. var vm = this;
  48098. if (Array.isArray(event)) {
  48099. for (var i = 0, l = event.length; i < l; i++) {
  48100. vm.$on(event[i], fn);
  48101. }
  48102. } else {
  48103. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48104. // optimize hook:event cost by using a boolean flag marked at registration
  48105. // instead of a hash lookup
  48106. if (hookRE.test(event)) {
  48107. vm._hasHookEvent = true;
  48108. }
  48109. }
  48110. return vm
  48111. };
  48112. Vue.prototype.$once = function (event, fn) {
  48113. var vm = this;
  48114. function on () {
  48115. vm.$off(event, on);
  48116. fn.apply(vm, arguments);
  48117. }
  48118. on.fn = fn;
  48119. vm.$on(event, on);
  48120. return vm
  48121. };
  48122. Vue.prototype.$off = function (event, fn) {
  48123. var vm = this;
  48124. // all
  48125. if (!arguments.length) {
  48126. vm._events = Object.create(null);
  48127. return vm
  48128. }
  48129. // array of events
  48130. if (Array.isArray(event)) {
  48131. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48132. vm.$off(event[i$1], fn);
  48133. }
  48134. return vm
  48135. }
  48136. // specific event
  48137. var cbs = vm._events[event];
  48138. if (!cbs) {
  48139. return vm
  48140. }
  48141. if (!fn) {
  48142. vm._events[event] = null;
  48143. return vm
  48144. }
  48145. // specific handler
  48146. var cb;
  48147. var i = cbs.length;
  48148. while (i--) {
  48149. cb = cbs[i];
  48150. if (cb === fn || cb.fn === fn) {
  48151. cbs.splice(i, 1);
  48152. break
  48153. }
  48154. }
  48155. return vm
  48156. };
  48157. Vue.prototype.$emit = function (event) {
  48158. var vm = this;
  48159. {
  48160. var lowerCaseEvent = event.toLowerCase();
  48161. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48162. tip(
  48163. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48164. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48165. "Note that HTML attributes are case-insensitive and you cannot use " +
  48166. "v-on to listen to camelCase events when using in-DOM templates. " +
  48167. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48168. );
  48169. }
  48170. }
  48171. var cbs = vm._events[event];
  48172. if (cbs) {
  48173. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48174. var args = toArray(arguments, 1);
  48175. var info = "event handler for \"" + event + "\"";
  48176. for (var i = 0, l = cbs.length; i < l; i++) {
  48177. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48178. }
  48179. }
  48180. return vm
  48181. };
  48182. }
  48183. /* */
  48184. var activeInstance = null;
  48185. var isUpdatingChildComponent = false;
  48186. function setActiveInstance(vm) {
  48187. var prevActiveInstance = activeInstance;
  48188. activeInstance = vm;
  48189. return function () {
  48190. activeInstance = prevActiveInstance;
  48191. }
  48192. }
  48193. function initLifecycle (vm) {
  48194. var options = vm.$options;
  48195. // locate first non-abstract parent
  48196. var parent = options.parent;
  48197. if (parent && !options.abstract) {
  48198. while (parent.$options.abstract && parent.$parent) {
  48199. parent = parent.$parent;
  48200. }
  48201. parent.$children.push(vm);
  48202. }
  48203. vm.$parent = parent;
  48204. vm.$root = parent ? parent.$root : vm;
  48205. vm.$children = [];
  48206. vm.$refs = {};
  48207. vm._watcher = null;
  48208. vm._inactive = null;
  48209. vm._directInactive = false;
  48210. vm._isMounted = false;
  48211. vm._isDestroyed = false;
  48212. vm._isBeingDestroyed = false;
  48213. }
  48214. function lifecycleMixin (Vue) {
  48215. Vue.prototype._update = function (vnode, hydrating) {
  48216. var vm = this;
  48217. var prevEl = vm.$el;
  48218. var prevVnode = vm._vnode;
  48219. var restoreActiveInstance = setActiveInstance(vm);
  48220. vm._vnode = vnode;
  48221. // Vue.prototype.__patch__ is injected in entry points
  48222. // based on the rendering backend used.
  48223. if (!prevVnode) {
  48224. // initial render
  48225. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48226. } else {
  48227. // updates
  48228. vm.$el = vm.__patch__(prevVnode, vnode);
  48229. }
  48230. restoreActiveInstance();
  48231. // update __vue__ reference
  48232. if (prevEl) {
  48233. prevEl.__vue__ = null;
  48234. }
  48235. if (vm.$el) {
  48236. vm.$el.__vue__ = vm;
  48237. }
  48238. // if parent is an HOC, update its $el as well
  48239. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48240. vm.$parent.$el = vm.$el;
  48241. }
  48242. // updated hook is called by the scheduler to ensure that children are
  48243. // updated in a parent's updated hook.
  48244. };
  48245. Vue.prototype.$forceUpdate = function () {
  48246. var vm = this;
  48247. if (vm._watcher) {
  48248. vm._watcher.update();
  48249. }
  48250. };
  48251. Vue.prototype.$destroy = function () {
  48252. var vm = this;
  48253. if (vm._isBeingDestroyed) {
  48254. return
  48255. }
  48256. callHook(vm, 'beforeDestroy');
  48257. vm._isBeingDestroyed = true;
  48258. // remove self from parent
  48259. var parent = vm.$parent;
  48260. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48261. remove(parent.$children, vm);
  48262. }
  48263. // teardown watchers
  48264. if (vm._watcher) {
  48265. vm._watcher.teardown();
  48266. }
  48267. var i = vm._watchers.length;
  48268. while (i--) {
  48269. vm._watchers[i].teardown();
  48270. }
  48271. // remove reference from data ob
  48272. // frozen object may not have observer.
  48273. if (vm._data.__ob__) {
  48274. vm._data.__ob__.vmCount--;
  48275. }
  48276. // call the last hook...
  48277. vm._isDestroyed = true;
  48278. // invoke destroy hooks on current rendered tree
  48279. vm.__patch__(vm._vnode, null);
  48280. // fire destroyed hook
  48281. callHook(vm, 'destroyed');
  48282. // turn off all instance listeners.
  48283. vm.$off();
  48284. // remove __vue__ reference
  48285. if (vm.$el) {
  48286. vm.$el.__vue__ = null;
  48287. }
  48288. // release circular reference (#6759)
  48289. if (vm.$vnode) {
  48290. vm.$vnode.parent = null;
  48291. }
  48292. };
  48293. }
  48294. function mountComponent (
  48295. vm,
  48296. el,
  48297. hydrating
  48298. ) {
  48299. vm.$el = el;
  48300. if (!vm.$options.render) {
  48301. vm.$options.render = createEmptyVNode;
  48302. {
  48303. /* istanbul ignore if */
  48304. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48305. vm.$options.el || el) {
  48306. warn(
  48307. 'You are using the runtime-only build of Vue where the template ' +
  48308. 'compiler is not available. Either pre-compile the templates into ' +
  48309. 'render functions, or use the compiler-included build.',
  48310. vm
  48311. );
  48312. } else {
  48313. warn(
  48314. 'Failed to mount component: template or render function not defined.',
  48315. vm
  48316. );
  48317. }
  48318. }
  48319. }
  48320. callHook(vm, 'beforeMount');
  48321. var updateComponent;
  48322. /* istanbul ignore if */
  48323. if (config.performance && mark) {
  48324. updateComponent = function () {
  48325. var name = vm._name;
  48326. var id = vm._uid;
  48327. var startTag = "vue-perf-start:" + id;
  48328. var endTag = "vue-perf-end:" + id;
  48329. mark(startTag);
  48330. var vnode = vm._render();
  48331. mark(endTag);
  48332. measure(("vue " + name + " render"), startTag, endTag);
  48333. mark(startTag);
  48334. vm._update(vnode, hydrating);
  48335. mark(endTag);
  48336. measure(("vue " + name + " patch"), startTag, endTag);
  48337. };
  48338. } else {
  48339. updateComponent = function () {
  48340. vm._update(vm._render(), hydrating);
  48341. };
  48342. }
  48343. // we set this to vm._watcher inside the watcher's constructor
  48344. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48345. // component's mounted hook), which relies on vm._watcher being already defined
  48346. new Watcher(vm, updateComponent, noop, {
  48347. before: function before () {
  48348. if (vm._isMounted && !vm._isDestroyed) {
  48349. callHook(vm, 'beforeUpdate');
  48350. }
  48351. }
  48352. }, true /* isRenderWatcher */);
  48353. hydrating = false;
  48354. // manually mounted instance, call mounted on self
  48355. // mounted is called for render-created child components in its inserted hook
  48356. if (vm.$vnode == null) {
  48357. vm._isMounted = true;
  48358. callHook(vm, 'mounted');
  48359. }
  48360. return vm
  48361. }
  48362. function updateChildComponent (
  48363. vm,
  48364. propsData,
  48365. listeners,
  48366. parentVnode,
  48367. renderChildren
  48368. ) {
  48369. {
  48370. isUpdatingChildComponent = true;
  48371. }
  48372. // determine whether component has slot children
  48373. // we need to do this before overwriting $options._renderChildren.
  48374. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48375. // dynamic slot names). Static scoped slots compiled from template has the
  48376. // "$stable" marker.
  48377. var newScopedSlots = parentVnode.data.scopedSlots;
  48378. var oldScopedSlots = vm.$scopedSlots;
  48379. var hasDynamicScopedSlot = !!(
  48380. (newScopedSlots && !newScopedSlots.$stable) ||
  48381. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48382. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48383. );
  48384. // Any static slot children from the parent may have changed during parent's
  48385. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48386. // update is necessary to ensure correctness.
  48387. var needsForceUpdate = !!(
  48388. renderChildren || // has new static slots
  48389. vm.$options._renderChildren || // has old static slots
  48390. hasDynamicScopedSlot
  48391. );
  48392. vm.$options._parentVnode = parentVnode;
  48393. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48394. if (vm._vnode) { // update child tree's parent
  48395. vm._vnode.parent = parentVnode;
  48396. }
  48397. vm.$options._renderChildren = renderChildren;
  48398. // update $attrs and $listeners hash
  48399. // these are also reactive so they may trigger child update if the child
  48400. // used them during render
  48401. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48402. vm.$listeners = listeners || emptyObject;
  48403. // update props
  48404. if (propsData && vm.$options.props) {
  48405. toggleObserving(false);
  48406. var props = vm._props;
  48407. var propKeys = vm.$options._propKeys || [];
  48408. for (var i = 0; i < propKeys.length; i++) {
  48409. var key = propKeys[i];
  48410. var propOptions = vm.$options.props; // wtf flow?
  48411. props[key] = validateProp(key, propOptions, propsData, vm);
  48412. }
  48413. toggleObserving(true);
  48414. // keep a copy of raw propsData
  48415. vm.$options.propsData = propsData;
  48416. }
  48417. // update listeners
  48418. listeners = listeners || emptyObject;
  48419. var oldListeners = vm.$options._parentListeners;
  48420. vm.$options._parentListeners = listeners;
  48421. updateComponentListeners(vm, listeners, oldListeners);
  48422. // resolve slots + force update if has children
  48423. if (needsForceUpdate) {
  48424. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48425. vm.$forceUpdate();
  48426. }
  48427. {
  48428. isUpdatingChildComponent = false;
  48429. }
  48430. }
  48431. function isInInactiveTree (vm) {
  48432. while (vm && (vm = vm.$parent)) {
  48433. if (vm._inactive) { return true }
  48434. }
  48435. return false
  48436. }
  48437. function activateChildComponent (vm, direct) {
  48438. if (direct) {
  48439. vm._directInactive = false;
  48440. if (isInInactiveTree(vm)) {
  48441. return
  48442. }
  48443. } else if (vm._directInactive) {
  48444. return
  48445. }
  48446. if (vm._inactive || vm._inactive === null) {
  48447. vm._inactive = false;
  48448. for (var i = 0; i < vm.$children.length; i++) {
  48449. activateChildComponent(vm.$children[i]);
  48450. }
  48451. callHook(vm, 'activated');
  48452. }
  48453. }
  48454. function deactivateChildComponent (vm, direct) {
  48455. if (direct) {
  48456. vm._directInactive = true;
  48457. if (isInInactiveTree(vm)) {
  48458. return
  48459. }
  48460. }
  48461. if (!vm._inactive) {
  48462. vm._inactive = true;
  48463. for (var i = 0; i < vm.$children.length; i++) {
  48464. deactivateChildComponent(vm.$children[i]);
  48465. }
  48466. callHook(vm, 'deactivated');
  48467. }
  48468. }
  48469. function callHook (vm, hook) {
  48470. // #7573 disable dep collection when invoking lifecycle hooks
  48471. pushTarget();
  48472. var handlers = vm.$options[hook];
  48473. var info = hook + " hook";
  48474. if (handlers) {
  48475. for (var i = 0, j = handlers.length; i < j; i++) {
  48476. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48477. }
  48478. }
  48479. if (vm._hasHookEvent) {
  48480. vm.$emit('hook:' + hook);
  48481. }
  48482. popTarget();
  48483. }
  48484. /* */
  48485. var MAX_UPDATE_COUNT = 100;
  48486. var queue = [];
  48487. var activatedChildren = [];
  48488. var has = {};
  48489. var circular = {};
  48490. var waiting = false;
  48491. var flushing = false;
  48492. var index = 0;
  48493. /**
  48494. * Reset the scheduler's state.
  48495. */
  48496. function resetSchedulerState () {
  48497. index = queue.length = activatedChildren.length = 0;
  48498. has = {};
  48499. {
  48500. circular = {};
  48501. }
  48502. waiting = flushing = false;
  48503. }
  48504. // Async edge case #6566 requires saving the timestamp when event listeners are
  48505. // attached. However, calling performance.now() has a perf overhead especially
  48506. // if the page has thousands of event listeners. Instead, we take a timestamp
  48507. // every time the scheduler flushes and use that for all event listeners
  48508. // attached during that flush.
  48509. var currentFlushTimestamp = 0;
  48510. // Async edge case fix requires storing an event listener's attach timestamp.
  48511. var getNow = Date.now;
  48512. // Determine what event timestamp the browser is using. Annoyingly, the
  48513. // timestamp can either be hi-res (relative to page load) or low-res
  48514. // (relative to UNIX epoch), so in order to compare time we have to use the
  48515. // same timestamp type when saving the flush timestamp.
  48516. // All IE versions use low-res event timestamps, and have problematic clock
  48517. // implementations (#9632)
  48518. if (inBrowser && !isIE) {
  48519. var performance = window.performance;
  48520. if (
  48521. performance &&
  48522. typeof performance.now === 'function' &&
  48523. getNow() > document.createEvent('Event').timeStamp
  48524. ) {
  48525. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48526. // smaller than it, it means the event is using a hi-res timestamp,
  48527. // and we need to use the hi-res version for event listener timestamps as
  48528. // well.
  48529. getNow = function () { return performance.now(); };
  48530. }
  48531. }
  48532. /**
  48533. * Flush both queues and run the watchers.
  48534. */
  48535. function flushSchedulerQueue () {
  48536. currentFlushTimestamp = getNow();
  48537. flushing = true;
  48538. var watcher, id;
  48539. // Sort queue before flush.
  48540. // This ensures that:
  48541. // 1. Components are updated from parent to child. (because parent is always
  48542. // created before the child)
  48543. // 2. A component's user watchers are run before its render watcher (because
  48544. // user watchers are created before the render watcher)
  48545. // 3. If a component is destroyed during a parent component's watcher run,
  48546. // its watchers can be skipped.
  48547. queue.sort(function (a, b) { return a.id - b.id; });
  48548. // do not cache length because more watchers might be pushed
  48549. // as we run existing watchers
  48550. for (index = 0; index < queue.length; index++) {
  48551. watcher = queue[index];
  48552. if (watcher.before) {
  48553. watcher.before();
  48554. }
  48555. id = watcher.id;
  48556. has[id] = null;
  48557. watcher.run();
  48558. // in dev build, check and stop circular updates.
  48559. if (has[id] != null) {
  48560. circular[id] = (circular[id] || 0) + 1;
  48561. if (circular[id] > MAX_UPDATE_COUNT) {
  48562. warn(
  48563. 'You may have an infinite update loop ' + (
  48564. watcher.user
  48565. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48566. : "in a component render function."
  48567. ),
  48568. watcher.vm
  48569. );
  48570. break
  48571. }
  48572. }
  48573. }
  48574. // keep copies of post queues before resetting state
  48575. var activatedQueue = activatedChildren.slice();
  48576. var updatedQueue = queue.slice();
  48577. resetSchedulerState();
  48578. // call component updated and activated hooks
  48579. callActivatedHooks(activatedQueue);
  48580. callUpdatedHooks(updatedQueue);
  48581. // devtool hook
  48582. /* istanbul ignore if */
  48583. if (devtools && config.devtools) {
  48584. devtools.emit('flush');
  48585. }
  48586. }
  48587. function callUpdatedHooks (queue) {
  48588. var i = queue.length;
  48589. while (i--) {
  48590. var watcher = queue[i];
  48591. var vm = watcher.vm;
  48592. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48593. callHook(vm, 'updated');
  48594. }
  48595. }
  48596. }
  48597. /**
  48598. * Queue a kept-alive component that was activated during patch.
  48599. * The queue will be processed after the entire tree has been patched.
  48600. */
  48601. function queueActivatedComponent (vm) {
  48602. // setting _inactive to false here so that a render function can
  48603. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48604. vm._inactive = false;
  48605. activatedChildren.push(vm);
  48606. }
  48607. function callActivatedHooks (queue) {
  48608. for (var i = 0; i < queue.length; i++) {
  48609. queue[i]._inactive = true;
  48610. activateChildComponent(queue[i], true /* true */);
  48611. }
  48612. }
  48613. /**
  48614. * Push a watcher into the watcher queue.
  48615. * Jobs with duplicate IDs will be skipped unless it's
  48616. * pushed when the queue is being flushed.
  48617. */
  48618. function queueWatcher (watcher) {
  48619. var id = watcher.id;
  48620. if (has[id] == null) {
  48621. has[id] = true;
  48622. if (!flushing) {
  48623. queue.push(watcher);
  48624. } else {
  48625. // if already flushing, splice the watcher based on its id
  48626. // if already past its id, it will be run next immediately.
  48627. var i = queue.length - 1;
  48628. while (i > index && queue[i].id > watcher.id) {
  48629. i--;
  48630. }
  48631. queue.splice(i + 1, 0, watcher);
  48632. }
  48633. // queue the flush
  48634. if (!waiting) {
  48635. waiting = true;
  48636. if (!config.async) {
  48637. flushSchedulerQueue();
  48638. return
  48639. }
  48640. nextTick(flushSchedulerQueue);
  48641. }
  48642. }
  48643. }
  48644. /* */
  48645. var uid$2 = 0;
  48646. /**
  48647. * A watcher parses an expression, collects dependencies,
  48648. * and fires callback when the expression value changes.
  48649. * This is used for both the $watch() api and directives.
  48650. */
  48651. var Watcher = function Watcher (
  48652. vm,
  48653. expOrFn,
  48654. cb,
  48655. options,
  48656. isRenderWatcher
  48657. ) {
  48658. this.vm = vm;
  48659. if (isRenderWatcher) {
  48660. vm._watcher = this;
  48661. }
  48662. vm._watchers.push(this);
  48663. // options
  48664. if (options) {
  48665. this.deep = !!options.deep;
  48666. this.user = !!options.user;
  48667. this.lazy = !!options.lazy;
  48668. this.sync = !!options.sync;
  48669. this.before = options.before;
  48670. } else {
  48671. this.deep = this.user = this.lazy = this.sync = false;
  48672. }
  48673. this.cb = cb;
  48674. this.id = ++uid$2; // uid for batching
  48675. this.active = true;
  48676. this.dirty = this.lazy; // for lazy watchers
  48677. this.deps = [];
  48678. this.newDeps = [];
  48679. this.depIds = new _Set();
  48680. this.newDepIds = new _Set();
  48681. this.expression = expOrFn.toString();
  48682. // parse expression for getter
  48683. if (typeof expOrFn === 'function') {
  48684. this.getter = expOrFn;
  48685. } else {
  48686. this.getter = parsePath(expOrFn);
  48687. if (!this.getter) {
  48688. this.getter = noop;
  48689. warn(
  48690. "Failed watching path: \"" + expOrFn + "\" " +
  48691. 'Watcher only accepts simple dot-delimited paths. ' +
  48692. 'For full control, use a function instead.',
  48693. vm
  48694. );
  48695. }
  48696. }
  48697. this.value = this.lazy
  48698. ? undefined
  48699. : this.get();
  48700. };
  48701. /**
  48702. * Evaluate the getter, and re-collect dependencies.
  48703. */
  48704. Watcher.prototype.get = function get () {
  48705. pushTarget(this);
  48706. var value;
  48707. var vm = this.vm;
  48708. try {
  48709. value = this.getter.call(vm, vm);
  48710. } catch (e) {
  48711. if (this.user) {
  48712. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48713. } else {
  48714. throw e
  48715. }
  48716. } finally {
  48717. // "touch" every property so they are all tracked as
  48718. // dependencies for deep watching
  48719. if (this.deep) {
  48720. traverse(value);
  48721. }
  48722. popTarget();
  48723. this.cleanupDeps();
  48724. }
  48725. return value
  48726. };
  48727. /**
  48728. * Add a dependency to this directive.
  48729. */
  48730. Watcher.prototype.addDep = function addDep (dep) {
  48731. var id = dep.id;
  48732. if (!this.newDepIds.has(id)) {
  48733. this.newDepIds.add(id);
  48734. this.newDeps.push(dep);
  48735. if (!this.depIds.has(id)) {
  48736. dep.addSub(this);
  48737. }
  48738. }
  48739. };
  48740. /**
  48741. * Clean up for dependency collection.
  48742. */
  48743. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48744. var i = this.deps.length;
  48745. while (i--) {
  48746. var dep = this.deps[i];
  48747. if (!this.newDepIds.has(dep.id)) {
  48748. dep.removeSub(this);
  48749. }
  48750. }
  48751. var tmp = this.depIds;
  48752. this.depIds = this.newDepIds;
  48753. this.newDepIds = tmp;
  48754. this.newDepIds.clear();
  48755. tmp = this.deps;
  48756. this.deps = this.newDeps;
  48757. this.newDeps = tmp;
  48758. this.newDeps.length = 0;
  48759. };
  48760. /**
  48761. * Subscriber interface.
  48762. * Will be called when a dependency changes.
  48763. */
  48764. Watcher.prototype.update = function update () {
  48765. /* istanbul ignore else */
  48766. if (this.lazy) {
  48767. this.dirty = true;
  48768. } else if (this.sync) {
  48769. this.run();
  48770. } else {
  48771. queueWatcher(this);
  48772. }
  48773. };
  48774. /**
  48775. * Scheduler job interface.
  48776. * Will be called by the scheduler.
  48777. */
  48778. Watcher.prototype.run = function run () {
  48779. if (this.active) {
  48780. var value = this.get();
  48781. if (
  48782. value !== this.value ||
  48783. // Deep watchers and watchers on Object/Arrays should fire even
  48784. // when the value is the same, because the value may
  48785. // have mutated.
  48786. isObject(value) ||
  48787. this.deep
  48788. ) {
  48789. // set new value
  48790. var oldValue = this.value;
  48791. this.value = value;
  48792. if (this.user) {
  48793. try {
  48794. this.cb.call(this.vm, value, oldValue);
  48795. } catch (e) {
  48796. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48797. }
  48798. } else {
  48799. this.cb.call(this.vm, value, oldValue);
  48800. }
  48801. }
  48802. }
  48803. };
  48804. /**
  48805. * Evaluate the value of the watcher.
  48806. * This only gets called for lazy watchers.
  48807. */
  48808. Watcher.prototype.evaluate = function evaluate () {
  48809. this.value = this.get();
  48810. this.dirty = false;
  48811. };
  48812. /**
  48813. * Depend on all deps collected by this watcher.
  48814. */
  48815. Watcher.prototype.depend = function depend () {
  48816. var i = this.deps.length;
  48817. while (i--) {
  48818. this.deps[i].depend();
  48819. }
  48820. };
  48821. /**
  48822. * Remove self from all dependencies' subscriber list.
  48823. */
  48824. Watcher.prototype.teardown = function teardown () {
  48825. if (this.active) {
  48826. // remove self from vm's watcher list
  48827. // this is a somewhat expensive operation so we skip it
  48828. // if the vm is being destroyed.
  48829. if (!this.vm._isBeingDestroyed) {
  48830. remove(this.vm._watchers, this);
  48831. }
  48832. var i = this.deps.length;
  48833. while (i--) {
  48834. this.deps[i].removeSub(this);
  48835. }
  48836. this.active = false;
  48837. }
  48838. };
  48839. /* */
  48840. var sharedPropertyDefinition = {
  48841. enumerable: true,
  48842. configurable: true,
  48843. get: noop,
  48844. set: noop
  48845. };
  48846. function proxy (target, sourceKey, key) {
  48847. sharedPropertyDefinition.get = function proxyGetter () {
  48848. return this[sourceKey][key]
  48849. };
  48850. sharedPropertyDefinition.set = function proxySetter (val) {
  48851. this[sourceKey][key] = val;
  48852. };
  48853. Object.defineProperty(target, key, sharedPropertyDefinition);
  48854. }
  48855. function initState (vm) {
  48856. vm._watchers = [];
  48857. var opts = vm.$options;
  48858. if (opts.props) { initProps(vm, opts.props); }
  48859. if (opts.methods) { initMethods(vm, opts.methods); }
  48860. if (opts.data) {
  48861. initData(vm);
  48862. } else {
  48863. observe(vm._data = {}, true /* asRootData */);
  48864. }
  48865. if (opts.computed) { initComputed(vm, opts.computed); }
  48866. if (opts.watch && opts.watch !== nativeWatch) {
  48867. initWatch(vm, opts.watch);
  48868. }
  48869. }
  48870. function initProps (vm, propsOptions) {
  48871. var propsData = vm.$options.propsData || {};
  48872. var props = vm._props = {};
  48873. // cache prop keys so that future props updates can iterate using Array
  48874. // instead of dynamic object key enumeration.
  48875. var keys = vm.$options._propKeys = [];
  48876. var isRoot = !vm.$parent;
  48877. // root instance props should be converted
  48878. if (!isRoot) {
  48879. toggleObserving(false);
  48880. }
  48881. var loop = function ( key ) {
  48882. keys.push(key);
  48883. var value = validateProp(key, propsOptions, propsData, vm);
  48884. /* istanbul ignore else */
  48885. {
  48886. var hyphenatedKey = hyphenate(key);
  48887. if (isReservedAttribute(hyphenatedKey) ||
  48888. config.isReservedAttr(hyphenatedKey)) {
  48889. warn(
  48890. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48891. vm
  48892. );
  48893. }
  48894. defineReactive$$1(props, key, value, function () {
  48895. if (!isRoot && !isUpdatingChildComponent) {
  48896. warn(
  48897. "Avoid mutating a prop directly since the value will be " +
  48898. "overwritten whenever the parent component re-renders. " +
  48899. "Instead, use a data or computed property based on the prop's " +
  48900. "value. Prop being mutated: \"" + key + "\"",
  48901. vm
  48902. );
  48903. }
  48904. });
  48905. }
  48906. // static props are already proxied on the component's prototype
  48907. // during Vue.extend(). We only need to proxy props defined at
  48908. // instantiation here.
  48909. if (!(key in vm)) {
  48910. proxy(vm, "_props", key);
  48911. }
  48912. };
  48913. for (var key in propsOptions) loop( key );
  48914. toggleObserving(true);
  48915. }
  48916. function initData (vm) {
  48917. var data = vm.$options.data;
  48918. data = vm._data = typeof data === 'function'
  48919. ? getData(data, vm)
  48920. : data || {};
  48921. if (!isPlainObject(data)) {
  48922. data = {};
  48923. warn(
  48924. 'data functions should return an object:\n' +
  48925. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48926. vm
  48927. );
  48928. }
  48929. // proxy data on instance
  48930. var keys = Object.keys(data);
  48931. var props = vm.$options.props;
  48932. var methods = vm.$options.methods;
  48933. var i = keys.length;
  48934. while (i--) {
  48935. var key = keys[i];
  48936. {
  48937. if (methods && hasOwn(methods, key)) {
  48938. warn(
  48939. ("Method \"" + key + "\" has already been defined as a data property."),
  48940. vm
  48941. );
  48942. }
  48943. }
  48944. if (props && hasOwn(props, key)) {
  48945. warn(
  48946. "The data property \"" + key + "\" is already declared as a prop. " +
  48947. "Use prop default value instead.",
  48948. vm
  48949. );
  48950. } else if (!isReserved(key)) {
  48951. proxy(vm, "_data", key);
  48952. }
  48953. }
  48954. // observe data
  48955. observe(data, true /* asRootData */);
  48956. }
  48957. function getData (data, vm) {
  48958. // #7573 disable dep collection when invoking data getters
  48959. pushTarget();
  48960. try {
  48961. return data.call(vm, vm)
  48962. } catch (e) {
  48963. handleError(e, vm, "data()");
  48964. return {}
  48965. } finally {
  48966. popTarget();
  48967. }
  48968. }
  48969. var computedWatcherOptions = { lazy: true };
  48970. function initComputed (vm, computed) {
  48971. // $flow-disable-line
  48972. var watchers = vm._computedWatchers = Object.create(null);
  48973. // computed properties are just getters during SSR
  48974. var isSSR = isServerRendering();
  48975. for (var key in computed) {
  48976. var userDef = computed[key];
  48977. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48978. if (getter == null) {
  48979. warn(
  48980. ("Getter is missing for computed property \"" + key + "\"."),
  48981. vm
  48982. );
  48983. }
  48984. if (!isSSR) {
  48985. // create internal watcher for the computed property.
  48986. watchers[key] = new Watcher(
  48987. vm,
  48988. getter || noop,
  48989. noop,
  48990. computedWatcherOptions
  48991. );
  48992. }
  48993. // component-defined computed properties are already defined on the
  48994. // component prototype. We only need to define computed properties defined
  48995. // at instantiation here.
  48996. if (!(key in vm)) {
  48997. defineComputed(vm, key, userDef);
  48998. } else {
  48999. if (key in vm.$data) {
  49000. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  49001. } else if (vm.$options.props && key in vm.$options.props) {
  49002. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  49003. }
  49004. }
  49005. }
  49006. }
  49007. function defineComputed (
  49008. target,
  49009. key,
  49010. userDef
  49011. ) {
  49012. var shouldCache = !isServerRendering();
  49013. if (typeof userDef === 'function') {
  49014. sharedPropertyDefinition.get = shouldCache
  49015. ? createComputedGetter(key)
  49016. : createGetterInvoker(userDef);
  49017. sharedPropertyDefinition.set = noop;
  49018. } else {
  49019. sharedPropertyDefinition.get = userDef.get
  49020. ? shouldCache && userDef.cache !== false
  49021. ? createComputedGetter(key)
  49022. : createGetterInvoker(userDef.get)
  49023. : noop;
  49024. sharedPropertyDefinition.set = userDef.set || noop;
  49025. }
  49026. if (sharedPropertyDefinition.set === noop) {
  49027. sharedPropertyDefinition.set = function () {
  49028. warn(
  49029. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49030. this
  49031. );
  49032. };
  49033. }
  49034. Object.defineProperty(target, key, sharedPropertyDefinition);
  49035. }
  49036. function createComputedGetter (key) {
  49037. return function computedGetter () {
  49038. var watcher = this._computedWatchers && this._computedWatchers[key];
  49039. if (watcher) {
  49040. if (watcher.dirty) {
  49041. watcher.evaluate();
  49042. }
  49043. if (Dep.target) {
  49044. watcher.depend();
  49045. }
  49046. return watcher.value
  49047. }
  49048. }
  49049. }
  49050. function createGetterInvoker(fn) {
  49051. return function computedGetter () {
  49052. return fn.call(this, this)
  49053. }
  49054. }
  49055. function initMethods (vm, methods) {
  49056. var props = vm.$options.props;
  49057. for (var key in methods) {
  49058. {
  49059. if (typeof methods[key] !== 'function') {
  49060. warn(
  49061. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49062. "Did you reference the function correctly?",
  49063. vm
  49064. );
  49065. }
  49066. if (props && hasOwn(props, key)) {
  49067. warn(
  49068. ("Method \"" + key + "\" has already been defined as a prop."),
  49069. vm
  49070. );
  49071. }
  49072. if ((key in vm) && isReserved(key)) {
  49073. warn(
  49074. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49075. "Avoid defining component methods that start with _ or $."
  49076. );
  49077. }
  49078. }
  49079. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49080. }
  49081. }
  49082. function initWatch (vm, watch) {
  49083. for (var key in watch) {
  49084. var handler = watch[key];
  49085. if (Array.isArray(handler)) {
  49086. for (var i = 0; i < handler.length; i++) {
  49087. createWatcher(vm, key, handler[i]);
  49088. }
  49089. } else {
  49090. createWatcher(vm, key, handler);
  49091. }
  49092. }
  49093. }
  49094. function createWatcher (
  49095. vm,
  49096. expOrFn,
  49097. handler,
  49098. options
  49099. ) {
  49100. if (isPlainObject(handler)) {
  49101. options = handler;
  49102. handler = handler.handler;
  49103. }
  49104. if (typeof handler === 'string') {
  49105. handler = vm[handler];
  49106. }
  49107. return vm.$watch(expOrFn, handler, options)
  49108. }
  49109. function stateMixin (Vue) {
  49110. // flow somehow has problems with directly declared definition object
  49111. // when using Object.defineProperty, so we have to procedurally build up
  49112. // the object here.
  49113. var dataDef = {};
  49114. dataDef.get = function () { return this._data };
  49115. var propsDef = {};
  49116. propsDef.get = function () { return this._props };
  49117. {
  49118. dataDef.set = function () {
  49119. warn(
  49120. 'Avoid replacing instance root $data. ' +
  49121. 'Use nested data properties instead.',
  49122. this
  49123. );
  49124. };
  49125. propsDef.set = function () {
  49126. warn("$props is readonly.", this);
  49127. };
  49128. }
  49129. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49130. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49131. Vue.prototype.$set = set;
  49132. Vue.prototype.$delete = del;
  49133. Vue.prototype.$watch = function (
  49134. expOrFn,
  49135. cb,
  49136. options
  49137. ) {
  49138. var vm = this;
  49139. if (isPlainObject(cb)) {
  49140. return createWatcher(vm, expOrFn, cb, options)
  49141. }
  49142. options = options || {};
  49143. options.user = true;
  49144. var watcher = new Watcher(vm, expOrFn, cb, options);
  49145. if (options.immediate) {
  49146. try {
  49147. cb.call(vm, watcher.value);
  49148. } catch (error) {
  49149. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49150. }
  49151. }
  49152. return function unwatchFn () {
  49153. watcher.teardown();
  49154. }
  49155. };
  49156. }
  49157. /* */
  49158. var uid$3 = 0;
  49159. function initMixin (Vue) {
  49160. Vue.prototype._init = function (options) {
  49161. var vm = this;
  49162. // a uid
  49163. vm._uid = uid$3++;
  49164. var startTag, endTag;
  49165. /* istanbul ignore if */
  49166. if (config.performance && mark) {
  49167. startTag = "vue-perf-start:" + (vm._uid);
  49168. endTag = "vue-perf-end:" + (vm._uid);
  49169. mark(startTag);
  49170. }
  49171. // a flag to avoid this being observed
  49172. vm._isVue = true;
  49173. // merge options
  49174. if (options && options._isComponent) {
  49175. // optimize internal component instantiation
  49176. // since dynamic options merging is pretty slow, and none of the
  49177. // internal component options needs special treatment.
  49178. initInternalComponent(vm, options);
  49179. } else {
  49180. vm.$options = mergeOptions(
  49181. resolveConstructorOptions(vm.constructor),
  49182. options || {},
  49183. vm
  49184. );
  49185. }
  49186. /* istanbul ignore else */
  49187. {
  49188. initProxy(vm);
  49189. }
  49190. // expose real self
  49191. vm._self = vm;
  49192. initLifecycle(vm);
  49193. initEvents(vm);
  49194. initRender(vm);
  49195. callHook(vm, 'beforeCreate');
  49196. initInjections(vm); // resolve injections before data/props
  49197. initState(vm);
  49198. initProvide(vm); // resolve provide after data/props
  49199. callHook(vm, 'created');
  49200. /* istanbul ignore if */
  49201. if (config.performance && mark) {
  49202. vm._name = formatComponentName(vm, false);
  49203. mark(endTag);
  49204. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49205. }
  49206. if (vm.$options.el) {
  49207. vm.$mount(vm.$options.el);
  49208. }
  49209. };
  49210. }
  49211. function initInternalComponent (vm, options) {
  49212. var opts = vm.$options = Object.create(vm.constructor.options);
  49213. // doing this because it's faster than dynamic enumeration.
  49214. var parentVnode = options._parentVnode;
  49215. opts.parent = options.parent;
  49216. opts._parentVnode = parentVnode;
  49217. var vnodeComponentOptions = parentVnode.componentOptions;
  49218. opts.propsData = vnodeComponentOptions.propsData;
  49219. opts._parentListeners = vnodeComponentOptions.listeners;
  49220. opts._renderChildren = vnodeComponentOptions.children;
  49221. opts._componentTag = vnodeComponentOptions.tag;
  49222. if (options.render) {
  49223. opts.render = options.render;
  49224. opts.staticRenderFns = options.staticRenderFns;
  49225. }
  49226. }
  49227. function resolveConstructorOptions (Ctor) {
  49228. var options = Ctor.options;
  49229. if (Ctor.super) {
  49230. var superOptions = resolveConstructorOptions(Ctor.super);
  49231. var cachedSuperOptions = Ctor.superOptions;
  49232. if (superOptions !== cachedSuperOptions) {
  49233. // super option changed,
  49234. // need to resolve new options.
  49235. Ctor.superOptions = superOptions;
  49236. // check if there are any late-modified/attached options (#4976)
  49237. var modifiedOptions = resolveModifiedOptions(Ctor);
  49238. // update base extend options
  49239. if (modifiedOptions) {
  49240. extend(Ctor.extendOptions, modifiedOptions);
  49241. }
  49242. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49243. if (options.name) {
  49244. options.components[options.name] = Ctor;
  49245. }
  49246. }
  49247. }
  49248. return options
  49249. }
  49250. function resolveModifiedOptions (Ctor) {
  49251. var modified;
  49252. var latest = Ctor.options;
  49253. var sealed = Ctor.sealedOptions;
  49254. for (var key in latest) {
  49255. if (latest[key] !== sealed[key]) {
  49256. if (!modified) { modified = {}; }
  49257. modified[key] = latest[key];
  49258. }
  49259. }
  49260. return modified
  49261. }
  49262. function Vue (options) {
  49263. if (!(this instanceof Vue)
  49264. ) {
  49265. warn('Vue is a constructor and should be called with the `new` keyword');
  49266. }
  49267. this._init(options);
  49268. }
  49269. initMixin(Vue);
  49270. stateMixin(Vue);
  49271. eventsMixin(Vue);
  49272. lifecycleMixin(Vue);
  49273. renderMixin(Vue);
  49274. /* */
  49275. function initUse (Vue) {
  49276. Vue.use = function (plugin) {
  49277. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49278. if (installedPlugins.indexOf(plugin) > -1) {
  49279. return this
  49280. }
  49281. // additional parameters
  49282. var args = toArray(arguments, 1);
  49283. args.unshift(this);
  49284. if (typeof plugin.install === 'function') {
  49285. plugin.install.apply(plugin, args);
  49286. } else if (typeof plugin === 'function') {
  49287. plugin.apply(null, args);
  49288. }
  49289. installedPlugins.push(plugin);
  49290. return this
  49291. };
  49292. }
  49293. /* */
  49294. function initMixin$1 (Vue) {
  49295. Vue.mixin = function (mixin) {
  49296. this.options = mergeOptions(this.options, mixin);
  49297. return this
  49298. };
  49299. }
  49300. /* */
  49301. function initExtend (Vue) {
  49302. /**
  49303. * Each instance constructor, including Vue, has a unique
  49304. * cid. This enables us to create wrapped "child
  49305. * constructors" for prototypal inheritance and cache them.
  49306. */
  49307. Vue.cid = 0;
  49308. var cid = 1;
  49309. /**
  49310. * Class inheritance
  49311. */
  49312. Vue.extend = function (extendOptions) {
  49313. extendOptions = extendOptions || {};
  49314. var Super = this;
  49315. var SuperId = Super.cid;
  49316. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49317. if (cachedCtors[SuperId]) {
  49318. return cachedCtors[SuperId]
  49319. }
  49320. var name = extendOptions.name || Super.options.name;
  49321. if (name) {
  49322. validateComponentName(name);
  49323. }
  49324. var Sub = function VueComponent (options) {
  49325. this._init(options);
  49326. };
  49327. Sub.prototype = Object.create(Super.prototype);
  49328. Sub.prototype.constructor = Sub;
  49329. Sub.cid = cid++;
  49330. Sub.options = mergeOptions(
  49331. Super.options,
  49332. extendOptions
  49333. );
  49334. Sub['super'] = Super;
  49335. // For props and computed properties, we define the proxy getters on
  49336. // the Vue instances at extension time, on the extended prototype. This
  49337. // avoids Object.defineProperty calls for each instance created.
  49338. if (Sub.options.props) {
  49339. initProps$1(Sub);
  49340. }
  49341. if (Sub.options.computed) {
  49342. initComputed$1(Sub);
  49343. }
  49344. // allow further extension/mixin/plugin usage
  49345. Sub.extend = Super.extend;
  49346. Sub.mixin = Super.mixin;
  49347. Sub.use = Super.use;
  49348. // create asset registers, so extended classes
  49349. // can have their private assets too.
  49350. ASSET_TYPES.forEach(function (type) {
  49351. Sub[type] = Super[type];
  49352. });
  49353. // enable recursive self-lookup
  49354. if (name) {
  49355. Sub.options.components[name] = Sub;
  49356. }
  49357. // keep a reference to the super options at extension time.
  49358. // later at instantiation we can check if Super's options have
  49359. // been updated.
  49360. Sub.superOptions = Super.options;
  49361. Sub.extendOptions = extendOptions;
  49362. Sub.sealedOptions = extend({}, Sub.options);
  49363. // cache constructor
  49364. cachedCtors[SuperId] = Sub;
  49365. return Sub
  49366. };
  49367. }
  49368. function initProps$1 (Comp) {
  49369. var props = Comp.options.props;
  49370. for (var key in props) {
  49371. proxy(Comp.prototype, "_props", key);
  49372. }
  49373. }
  49374. function initComputed$1 (Comp) {
  49375. var computed = Comp.options.computed;
  49376. for (var key in computed) {
  49377. defineComputed(Comp.prototype, key, computed[key]);
  49378. }
  49379. }
  49380. /* */
  49381. function initAssetRegisters (Vue) {
  49382. /**
  49383. * Create asset registration methods.
  49384. */
  49385. ASSET_TYPES.forEach(function (type) {
  49386. Vue[type] = function (
  49387. id,
  49388. definition
  49389. ) {
  49390. if (!definition) {
  49391. return this.options[type + 's'][id]
  49392. } else {
  49393. /* istanbul ignore if */
  49394. if (type === 'component') {
  49395. validateComponentName(id);
  49396. }
  49397. if (type === 'component' && isPlainObject(definition)) {
  49398. definition.name = definition.name || id;
  49399. definition = this.options._base.extend(definition);
  49400. }
  49401. if (type === 'directive' && typeof definition === 'function') {
  49402. definition = { bind: definition, update: definition };
  49403. }
  49404. this.options[type + 's'][id] = definition;
  49405. return definition
  49406. }
  49407. };
  49408. });
  49409. }
  49410. /* */
  49411. function getComponentName (opts) {
  49412. return opts && (opts.Ctor.options.name || opts.tag)
  49413. }
  49414. function matches (pattern, name) {
  49415. if (Array.isArray(pattern)) {
  49416. return pattern.indexOf(name) > -1
  49417. } else if (typeof pattern === 'string') {
  49418. return pattern.split(',').indexOf(name) > -1
  49419. } else if (isRegExp(pattern)) {
  49420. return pattern.test(name)
  49421. }
  49422. /* istanbul ignore next */
  49423. return false
  49424. }
  49425. function pruneCache (keepAliveInstance, filter) {
  49426. var cache = keepAliveInstance.cache;
  49427. var keys = keepAliveInstance.keys;
  49428. var _vnode = keepAliveInstance._vnode;
  49429. for (var key in cache) {
  49430. var cachedNode = cache[key];
  49431. if (cachedNode) {
  49432. var name = getComponentName(cachedNode.componentOptions);
  49433. if (name && !filter(name)) {
  49434. pruneCacheEntry(cache, key, keys, _vnode);
  49435. }
  49436. }
  49437. }
  49438. }
  49439. function pruneCacheEntry (
  49440. cache,
  49441. key,
  49442. keys,
  49443. current
  49444. ) {
  49445. var cached$$1 = cache[key];
  49446. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49447. cached$$1.componentInstance.$destroy();
  49448. }
  49449. cache[key] = null;
  49450. remove(keys, key);
  49451. }
  49452. var patternTypes = [String, RegExp, Array];
  49453. var KeepAlive = {
  49454. name: 'keep-alive',
  49455. abstract: true,
  49456. props: {
  49457. include: patternTypes,
  49458. exclude: patternTypes,
  49459. max: [String, Number]
  49460. },
  49461. created: function created () {
  49462. this.cache = Object.create(null);
  49463. this.keys = [];
  49464. },
  49465. destroyed: function destroyed () {
  49466. for (var key in this.cache) {
  49467. pruneCacheEntry(this.cache, key, this.keys);
  49468. }
  49469. },
  49470. mounted: function mounted () {
  49471. var this$1 = this;
  49472. this.$watch('include', function (val) {
  49473. pruneCache(this$1, function (name) { return matches(val, name); });
  49474. });
  49475. this.$watch('exclude', function (val) {
  49476. pruneCache(this$1, function (name) { return !matches(val, name); });
  49477. });
  49478. },
  49479. render: function render () {
  49480. var slot = this.$slots.default;
  49481. var vnode = getFirstComponentChild(slot);
  49482. var componentOptions = vnode && vnode.componentOptions;
  49483. if (componentOptions) {
  49484. // check pattern
  49485. var name = getComponentName(componentOptions);
  49486. var ref = this;
  49487. var include = ref.include;
  49488. var exclude = ref.exclude;
  49489. if (
  49490. // not included
  49491. (include && (!name || !matches(include, name))) ||
  49492. // excluded
  49493. (exclude && name && matches(exclude, name))
  49494. ) {
  49495. return vnode
  49496. }
  49497. var ref$1 = this;
  49498. var cache = ref$1.cache;
  49499. var keys = ref$1.keys;
  49500. var key = vnode.key == null
  49501. // same constructor may get registered as different local components
  49502. // so cid alone is not enough (#3269)
  49503. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49504. : vnode.key;
  49505. if (cache[key]) {
  49506. vnode.componentInstance = cache[key].componentInstance;
  49507. // make current key freshest
  49508. remove(keys, key);
  49509. keys.push(key);
  49510. } else {
  49511. cache[key] = vnode;
  49512. keys.push(key);
  49513. // prune oldest entry
  49514. if (this.max && keys.length > parseInt(this.max)) {
  49515. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49516. }
  49517. }
  49518. vnode.data.keepAlive = true;
  49519. }
  49520. return vnode || (slot && slot[0])
  49521. }
  49522. };
  49523. var builtInComponents = {
  49524. KeepAlive: KeepAlive
  49525. };
  49526. /* */
  49527. function initGlobalAPI (Vue) {
  49528. // config
  49529. var configDef = {};
  49530. configDef.get = function () { return config; };
  49531. {
  49532. configDef.set = function () {
  49533. warn(
  49534. 'Do not replace the Vue.config object, set individual fields instead.'
  49535. );
  49536. };
  49537. }
  49538. Object.defineProperty(Vue, 'config', configDef);
  49539. // exposed util methods.
  49540. // NOTE: these are not considered part of the public API - avoid relying on
  49541. // them unless you are aware of the risk.
  49542. Vue.util = {
  49543. warn: warn,
  49544. extend: extend,
  49545. mergeOptions: mergeOptions,
  49546. defineReactive: defineReactive$$1
  49547. };
  49548. Vue.set = set;
  49549. Vue.delete = del;
  49550. Vue.nextTick = nextTick;
  49551. // 2.6 explicit observable API
  49552. Vue.observable = function (obj) {
  49553. observe(obj);
  49554. return obj
  49555. };
  49556. Vue.options = Object.create(null);
  49557. ASSET_TYPES.forEach(function (type) {
  49558. Vue.options[type + 's'] = Object.create(null);
  49559. });
  49560. // this is used to identify the "base" constructor to extend all plain-object
  49561. // components with in Weex's multi-instance scenarios.
  49562. Vue.options._base = Vue;
  49563. extend(Vue.options.components, builtInComponents);
  49564. initUse(Vue);
  49565. initMixin$1(Vue);
  49566. initExtend(Vue);
  49567. initAssetRegisters(Vue);
  49568. }
  49569. initGlobalAPI(Vue);
  49570. Object.defineProperty(Vue.prototype, '$isServer', {
  49571. get: isServerRendering
  49572. });
  49573. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49574. get: function get () {
  49575. /* istanbul ignore next */
  49576. return this.$vnode && this.$vnode.ssrContext
  49577. }
  49578. });
  49579. // expose FunctionalRenderContext for ssr runtime helper installation
  49580. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49581. value: FunctionalRenderContext
  49582. });
  49583. Vue.version = '2.6.11';
  49584. /* */
  49585. // these are reserved for web because they are directly compiled away
  49586. // during template compilation
  49587. var isReservedAttr = makeMap('style,class');
  49588. // attributes that should be using props for binding
  49589. var acceptValue = makeMap('input,textarea,option,select,progress');
  49590. var mustUseProp = function (tag, type, attr) {
  49591. return (
  49592. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49593. (attr === 'selected' && tag === 'option') ||
  49594. (attr === 'checked' && tag === 'input') ||
  49595. (attr === 'muted' && tag === 'video')
  49596. )
  49597. };
  49598. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49599. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49600. var convertEnumeratedValue = function (key, value) {
  49601. return isFalsyAttrValue(value) || value === 'false'
  49602. ? 'false'
  49603. // allow arbitrary string value for contenteditable
  49604. : key === 'contenteditable' && isValidContentEditableValue(value)
  49605. ? value
  49606. : 'true'
  49607. };
  49608. var isBooleanAttr = makeMap(
  49609. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49610. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49611. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49612. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49613. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49614. 'truespeed,typemustmatch,visible'
  49615. );
  49616. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49617. var isXlink = function (name) {
  49618. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49619. };
  49620. var getXlinkProp = function (name) {
  49621. return isXlink(name) ? name.slice(6, name.length) : ''
  49622. };
  49623. var isFalsyAttrValue = function (val) {
  49624. return val == null || val === false
  49625. };
  49626. /* */
  49627. function genClassForVnode (vnode) {
  49628. var data = vnode.data;
  49629. var parentNode = vnode;
  49630. var childNode = vnode;
  49631. while (isDef(childNode.componentInstance)) {
  49632. childNode = childNode.componentInstance._vnode;
  49633. if (childNode && childNode.data) {
  49634. data = mergeClassData(childNode.data, data);
  49635. }
  49636. }
  49637. while (isDef(parentNode = parentNode.parent)) {
  49638. if (parentNode && parentNode.data) {
  49639. data = mergeClassData(data, parentNode.data);
  49640. }
  49641. }
  49642. return renderClass(data.staticClass, data.class)
  49643. }
  49644. function mergeClassData (child, parent) {
  49645. return {
  49646. staticClass: concat(child.staticClass, parent.staticClass),
  49647. class: isDef(child.class)
  49648. ? [child.class, parent.class]
  49649. : parent.class
  49650. }
  49651. }
  49652. function renderClass (
  49653. staticClass,
  49654. dynamicClass
  49655. ) {
  49656. if (isDef(staticClass) || isDef(dynamicClass)) {
  49657. return concat(staticClass, stringifyClass(dynamicClass))
  49658. }
  49659. /* istanbul ignore next */
  49660. return ''
  49661. }
  49662. function concat (a, b) {
  49663. return a ? b ? (a + ' ' + b) : a : (b || '')
  49664. }
  49665. function stringifyClass (value) {
  49666. if (Array.isArray(value)) {
  49667. return stringifyArray(value)
  49668. }
  49669. if (isObject(value)) {
  49670. return stringifyObject(value)
  49671. }
  49672. if (typeof value === 'string') {
  49673. return value
  49674. }
  49675. /* istanbul ignore next */
  49676. return ''
  49677. }
  49678. function stringifyArray (value) {
  49679. var res = '';
  49680. var stringified;
  49681. for (var i = 0, l = value.length; i < l; i++) {
  49682. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49683. if (res) { res += ' '; }
  49684. res += stringified;
  49685. }
  49686. }
  49687. return res
  49688. }
  49689. function stringifyObject (value) {
  49690. var res = '';
  49691. for (var key in value) {
  49692. if (value[key]) {
  49693. if (res) { res += ' '; }
  49694. res += key;
  49695. }
  49696. }
  49697. return res
  49698. }
  49699. /* */
  49700. var namespaceMap = {
  49701. svg: 'http://www.w3.org/2000/svg',
  49702. math: 'http://www.w3.org/1998/Math/MathML'
  49703. };
  49704. var isHTMLTag = makeMap(
  49705. 'html,body,base,head,link,meta,style,title,' +
  49706. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49707. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49708. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49709. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49710. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49711. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49712. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49713. 'output,progress,select,textarea,' +
  49714. 'details,dialog,menu,menuitem,summary,' +
  49715. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49716. );
  49717. // this map is intentionally selective, only covering SVG elements that may
  49718. // contain child elements.
  49719. var isSVG = makeMap(
  49720. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49721. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49722. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49723. true
  49724. );
  49725. var isPreTag = function (tag) { return tag === 'pre'; };
  49726. var isReservedTag = function (tag) {
  49727. return isHTMLTag(tag) || isSVG(tag)
  49728. };
  49729. function getTagNamespace (tag) {
  49730. if (isSVG(tag)) {
  49731. return 'svg'
  49732. }
  49733. // basic support for MathML
  49734. // note it doesn't support other MathML elements being component roots
  49735. if (tag === 'math') {
  49736. return 'math'
  49737. }
  49738. }
  49739. var unknownElementCache = Object.create(null);
  49740. function isUnknownElement (tag) {
  49741. /* istanbul ignore if */
  49742. if (!inBrowser) {
  49743. return true
  49744. }
  49745. if (isReservedTag(tag)) {
  49746. return false
  49747. }
  49748. tag = tag.toLowerCase();
  49749. /* istanbul ignore if */
  49750. if (unknownElementCache[tag] != null) {
  49751. return unknownElementCache[tag]
  49752. }
  49753. var el = document.createElement(tag);
  49754. if (tag.indexOf('-') > -1) {
  49755. // http://stackoverflow.com/a/28210364/1070244
  49756. return (unknownElementCache[tag] = (
  49757. el.constructor === window.HTMLUnknownElement ||
  49758. el.constructor === window.HTMLElement
  49759. ))
  49760. } else {
  49761. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49762. }
  49763. }
  49764. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49765. /* */
  49766. /**
  49767. * Query an element selector if it's not an element already.
  49768. */
  49769. function query (el) {
  49770. if (typeof el === 'string') {
  49771. var selected = document.querySelector(el);
  49772. if (!selected) {
  49773. warn(
  49774. 'Cannot find element: ' + el
  49775. );
  49776. return document.createElement('div')
  49777. }
  49778. return selected
  49779. } else {
  49780. return el
  49781. }
  49782. }
  49783. /* */
  49784. function createElement$1 (tagName, vnode) {
  49785. var elm = document.createElement(tagName);
  49786. if (tagName !== 'select') {
  49787. return elm
  49788. }
  49789. // false or null will remove the attribute but undefined will not
  49790. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49791. elm.setAttribute('multiple', 'multiple');
  49792. }
  49793. return elm
  49794. }
  49795. function createElementNS (namespace, tagName) {
  49796. return document.createElementNS(namespaceMap[namespace], tagName)
  49797. }
  49798. function createTextNode (text) {
  49799. return document.createTextNode(text)
  49800. }
  49801. function createComment (text) {
  49802. return document.createComment(text)
  49803. }
  49804. function insertBefore (parentNode, newNode, referenceNode) {
  49805. parentNode.insertBefore(newNode, referenceNode);
  49806. }
  49807. function removeChild (node, child) {
  49808. node.removeChild(child);
  49809. }
  49810. function appendChild (node, child) {
  49811. node.appendChild(child);
  49812. }
  49813. function parentNode (node) {
  49814. return node.parentNode
  49815. }
  49816. function nextSibling (node) {
  49817. return node.nextSibling
  49818. }
  49819. function tagName (node) {
  49820. return node.tagName
  49821. }
  49822. function setTextContent (node, text) {
  49823. node.textContent = text;
  49824. }
  49825. function setStyleScope (node, scopeId) {
  49826. node.setAttribute(scopeId, '');
  49827. }
  49828. var nodeOps = /*#__PURE__*/Object.freeze({
  49829. createElement: createElement$1,
  49830. createElementNS: createElementNS,
  49831. createTextNode: createTextNode,
  49832. createComment: createComment,
  49833. insertBefore: insertBefore,
  49834. removeChild: removeChild,
  49835. appendChild: appendChild,
  49836. parentNode: parentNode,
  49837. nextSibling: nextSibling,
  49838. tagName: tagName,
  49839. setTextContent: setTextContent,
  49840. setStyleScope: setStyleScope
  49841. });
  49842. /* */
  49843. var ref = {
  49844. create: function create (_, vnode) {
  49845. registerRef(vnode);
  49846. },
  49847. update: function update (oldVnode, vnode) {
  49848. if (oldVnode.data.ref !== vnode.data.ref) {
  49849. registerRef(oldVnode, true);
  49850. registerRef(vnode);
  49851. }
  49852. },
  49853. destroy: function destroy (vnode) {
  49854. registerRef(vnode, true);
  49855. }
  49856. };
  49857. function registerRef (vnode, isRemoval) {
  49858. var key = vnode.data.ref;
  49859. if (!isDef(key)) { return }
  49860. var vm = vnode.context;
  49861. var ref = vnode.componentInstance || vnode.elm;
  49862. var refs = vm.$refs;
  49863. if (isRemoval) {
  49864. if (Array.isArray(refs[key])) {
  49865. remove(refs[key], ref);
  49866. } else if (refs[key] === ref) {
  49867. refs[key] = undefined;
  49868. }
  49869. } else {
  49870. if (vnode.data.refInFor) {
  49871. if (!Array.isArray(refs[key])) {
  49872. refs[key] = [ref];
  49873. } else if (refs[key].indexOf(ref) < 0) {
  49874. // $flow-disable-line
  49875. refs[key].push(ref);
  49876. }
  49877. } else {
  49878. refs[key] = ref;
  49879. }
  49880. }
  49881. }
  49882. /**
  49883. * Virtual DOM patching algorithm based on Snabbdom by
  49884. * Simon Friis Vindum (@paldepind)
  49885. * Licensed under the MIT License
  49886. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49887. *
  49888. * modified by Evan You (@yyx990803)
  49889. *
  49890. * Not type-checking this because this file is perf-critical and the cost
  49891. * of making flow understand it is not worth it.
  49892. */
  49893. var emptyNode = new VNode('', {}, []);
  49894. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49895. function sameVnode (a, b) {
  49896. return (
  49897. a.key === b.key && (
  49898. (
  49899. a.tag === b.tag &&
  49900. a.isComment === b.isComment &&
  49901. isDef(a.data) === isDef(b.data) &&
  49902. sameInputType(a, b)
  49903. ) || (
  49904. isTrue(a.isAsyncPlaceholder) &&
  49905. a.asyncFactory === b.asyncFactory &&
  49906. isUndef(b.asyncFactory.error)
  49907. )
  49908. )
  49909. )
  49910. }
  49911. function sameInputType (a, b) {
  49912. if (a.tag !== 'input') { return true }
  49913. var i;
  49914. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49915. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49916. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49917. }
  49918. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49919. var i, key;
  49920. var map = {};
  49921. for (i = beginIdx; i <= endIdx; ++i) {
  49922. key = children[i].key;
  49923. if (isDef(key)) { map[key] = i; }
  49924. }
  49925. return map
  49926. }
  49927. function createPatchFunction (backend) {
  49928. var i, j;
  49929. var cbs = {};
  49930. var modules = backend.modules;
  49931. var nodeOps = backend.nodeOps;
  49932. for (i = 0; i < hooks.length; ++i) {
  49933. cbs[hooks[i]] = [];
  49934. for (j = 0; j < modules.length; ++j) {
  49935. if (isDef(modules[j][hooks[i]])) {
  49936. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49937. }
  49938. }
  49939. }
  49940. function emptyNodeAt (elm) {
  49941. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49942. }
  49943. function createRmCb (childElm, listeners) {
  49944. function remove$$1 () {
  49945. if (--remove$$1.listeners === 0) {
  49946. removeNode(childElm);
  49947. }
  49948. }
  49949. remove$$1.listeners = listeners;
  49950. return remove$$1
  49951. }
  49952. function removeNode (el) {
  49953. var parent = nodeOps.parentNode(el);
  49954. // element may have already been removed due to v-html / v-text
  49955. if (isDef(parent)) {
  49956. nodeOps.removeChild(parent, el);
  49957. }
  49958. }
  49959. function isUnknownElement$$1 (vnode, inVPre) {
  49960. return (
  49961. !inVPre &&
  49962. !vnode.ns &&
  49963. !(
  49964. config.ignoredElements.length &&
  49965. config.ignoredElements.some(function (ignore) {
  49966. return isRegExp(ignore)
  49967. ? ignore.test(vnode.tag)
  49968. : ignore === vnode.tag
  49969. })
  49970. ) &&
  49971. config.isUnknownElement(vnode.tag)
  49972. )
  49973. }
  49974. var creatingElmInVPre = 0;
  49975. function createElm (
  49976. vnode,
  49977. insertedVnodeQueue,
  49978. parentElm,
  49979. refElm,
  49980. nested,
  49981. ownerArray,
  49982. index
  49983. ) {
  49984. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49985. // This vnode was used in a previous render!
  49986. // now it's used as a new node, overwriting its elm would cause
  49987. // potential patch errors down the road when it's used as an insertion
  49988. // reference node. Instead, we clone the node on-demand before creating
  49989. // associated DOM element for it.
  49990. vnode = ownerArray[index] = cloneVNode(vnode);
  49991. }
  49992. vnode.isRootInsert = !nested; // for transition enter check
  49993. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49994. return
  49995. }
  49996. var data = vnode.data;
  49997. var children = vnode.children;
  49998. var tag = vnode.tag;
  49999. if (isDef(tag)) {
  50000. {
  50001. if (data && data.pre) {
  50002. creatingElmInVPre++;
  50003. }
  50004. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50005. warn(
  50006. 'Unknown custom element: <' + tag + '> - did you ' +
  50007. 'register the component correctly? For recursive components, ' +
  50008. 'make sure to provide the "name" option.',
  50009. vnode.context
  50010. );
  50011. }
  50012. }
  50013. vnode.elm = vnode.ns
  50014. ? nodeOps.createElementNS(vnode.ns, tag)
  50015. : nodeOps.createElement(tag, vnode);
  50016. setScope(vnode);
  50017. /* istanbul ignore if */
  50018. {
  50019. createChildren(vnode, children, insertedVnodeQueue);
  50020. if (isDef(data)) {
  50021. invokeCreateHooks(vnode, insertedVnodeQueue);
  50022. }
  50023. insert(parentElm, vnode.elm, refElm);
  50024. }
  50025. if (data && data.pre) {
  50026. creatingElmInVPre--;
  50027. }
  50028. } else if (isTrue(vnode.isComment)) {
  50029. vnode.elm = nodeOps.createComment(vnode.text);
  50030. insert(parentElm, vnode.elm, refElm);
  50031. } else {
  50032. vnode.elm = nodeOps.createTextNode(vnode.text);
  50033. insert(parentElm, vnode.elm, refElm);
  50034. }
  50035. }
  50036. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50037. var i = vnode.data;
  50038. if (isDef(i)) {
  50039. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50040. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50041. i(vnode, false /* hydrating */);
  50042. }
  50043. // after calling the init hook, if the vnode is a child component
  50044. // it should've created a child instance and mounted it. the child
  50045. // component also has set the placeholder vnode's elm.
  50046. // in that case we can just return the element and be done.
  50047. if (isDef(vnode.componentInstance)) {
  50048. initComponent(vnode, insertedVnodeQueue);
  50049. insert(parentElm, vnode.elm, refElm);
  50050. if (isTrue(isReactivated)) {
  50051. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50052. }
  50053. return true
  50054. }
  50055. }
  50056. }
  50057. function initComponent (vnode, insertedVnodeQueue) {
  50058. if (isDef(vnode.data.pendingInsert)) {
  50059. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50060. vnode.data.pendingInsert = null;
  50061. }
  50062. vnode.elm = vnode.componentInstance.$el;
  50063. if (isPatchable(vnode)) {
  50064. invokeCreateHooks(vnode, insertedVnodeQueue);
  50065. setScope(vnode);
  50066. } else {
  50067. // empty component root.
  50068. // skip all element-related modules except for ref (#3455)
  50069. registerRef(vnode);
  50070. // make sure to invoke the insert hook
  50071. insertedVnodeQueue.push(vnode);
  50072. }
  50073. }
  50074. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50075. var i;
  50076. // hack for #4339: a reactivated component with inner transition
  50077. // does not trigger because the inner node's created hooks are not called
  50078. // again. It's not ideal to involve module-specific logic in here but
  50079. // there doesn't seem to be a better way to do it.
  50080. var innerNode = vnode;
  50081. while (innerNode.componentInstance) {
  50082. innerNode = innerNode.componentInstance._vnode;
  50083. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50084. for (i = 0; i < cbs.activate.length; ++i) {
  50085. cbs.activate[i](emptyNode, innerNode);
  50086. }
  50087. insertedVnodeQueue.push(innerNode);
  50088. break
  50089. }
  50090. }
  50091. // unlike a newly created component,
  50092. // a reactivated keep-alive component doesn't insert itself
  50093. insert(parentElm, vnode.elm, refElm);
  50094. }
  50095. function insert (parent, elm, ref$$1) {
  50096. if (isDef(parent)) {
  50097. if (isDef(ref$$1)) {
  50098. if (nodeOps.parentNode(ref$$1) === parent) {
  50099. nodeOps.insertBefore(parent, elm, ref$$1);
  50100. }
  50101. } else {
  50102. nodeOps.appendChild(parent, elm);
  50103. }
  50104. }
  50105. }
  50106. function createChildren (vnode, children, insertedVnodeQueue) {
  50107. if (Array.isArray(children)) {
  50108. {
  50109. checkDuplicateKeys(children);
  50110. }
  50111. for (var i = 0; i < children.length; ++i) {
  50112. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50113. }
  50114. } else if (isPrimitive(vnode.text)) {
  50115. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50116. }
  50117. }
  50118. function isPatchable (vnode) {
  50119. while (vnode.componentInstance) {
  50120. vnode = vnode.componentInstance._vnode;
  50121. }
  50122. return isDef(vnode.tag)
  50123. }
  50124. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50125. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50126. cbs.create[i$1](emptyNode, vnode);
  50127. }
  50128. i = vnode.data.hook; // Reuse variable
  50129. if (isDef(i)) {
  50130. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50131. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50132. }
  50133. }
  50134. // set scope id attribute for scoped CSS.
  50135. // this is implemented as a special case to avoid the overhead
  50136. // of going through the normal attribute patching process.
  50137. function setScope (vnode) {
  50138. var i;
  50139. if (isDef(i = vnode.fnScopeId)) {
  50140. nodeOps.setStyleScope(vnode.elm, i);
  50141. } else {
  50142. var ancestor = vnode;
  50143. while (ancestor) {
  50144. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50145. nodeOps.setStyleScope(vnode.elm, i);
  50146. }
  50147. ancestor = ancestor.parent;
  50148. }
  50149. }
  50150. // for slot content they should also get the scopeId from the host instance.
  50151. if (isDef(i = activeInstance) &&
  50152. i !== vnode.context &&
  50153. i !== vnode.fnContext &&
  50154. isDef(i = i.$options._scopeId)
  50155. ) {
  50156. nodeOps.setStyleScope(vnode.elm, i);
  50157. }
  50158. }
  50159. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50160. for (; startIdx <= endIdx; ++startIdx) {
  50161. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50162. }
  50163. }
  50164. function invokeDestroyHook (vnode) {
  50165. var i, j;
  50166. var data = vnode.data;
  50167. if (isDef(data)) {
  50168. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50169. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50170. }
  50171. if (isDef(i = vnode.children)) {
  50172. for (j = 0; j < vnode.children.length; ++j) {
  50173. invokeDestroyHook(vnode.children[j]);
  50174. }
  50175. }
  50176. }
  50177. function removeVnodes (vnodes, startIdx, endIdx) {
  50178. for (; startIdx <= endIdx; ++startIdx) {
  50179. var ch = vnodes[startIdx];
  50180. if (isDef(ch)) {
  50181. if (isDef(ch.tag)) {
  50182. removeAndInvokeRemoveHook(ch);
  50183. invokeDestroyHook(ch);
  50184. } else { // Text node
  50185. removeNode(ch.elm);
  50186. }
  50187. }
  50188. }
  50189. }
  50190. function removeAndInvokeRemoveHook (vnode, rm) {
  50191. if (isDef(rm) || isDef(vnode.data)) {
  50192. var i;
  50193. var listeners = cbs.remove.length + 1;
  50194. if (isDef(rm)) {
  50195. // we have a recursively passed down rm callback
  50196. // increase the listeners count
  50197. rm.listeners += listeners;
  50198. } else {
  50199. // directly removing
  50200. rm = createRmCb(vnode.elm, listeners);
  50201. }
  50202. // recursively invoke hooks on child component root node
  50203. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50204. removeAndInvokeRemoveHook(i, rm);
  50205. }
  50206. for (i = 0; i < cbs.remove.length; ++i) {
  50207. cbs.remove[i](vnode, rm);
  50208. }
  50209. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50210. i(vnode, rm);
  50211. } else {
  50212. rm();
  50213. }
  50214. } else {
  50215. removeNode(vnode.elm);
  50216. }
  50217. }
  50218. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50219. var oldStartIdx = 0;
  50220. var newStartIdx = 0;
  50221. var oldEndIdx = oldCh.length - 1;
  50222. var oldStartVnode = oldCh[0];
  50223. var oldEndVnode = oldCh[oldEndIdx];
  50224. var newEndIdx = newCh.length - 1;
  50225. var newStartVnode = newCh[0];
  50226. var newEndVnode = newCh[newEndIdx];
  50227. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50228. // removeOnly is a special flag used only by <transition-group>
  50229. // to ensure removed elements stay in correct relative positions
  50230. // during leaving transitions
  50231. var canMove = !removeOnly;
  50232. {
  50233. checkDuplicateKeys(newCh);
  50234. }
  50235. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50236. if (isUndef(oldStartVnode)) {
  50237. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50238. } else if (isUndef(oldEndVnode)) {
  50239. oldEndVnode = oldCh[--oldEndIdx];
  50240. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50241. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50242. oldStartVnode = oldCh[++oldStartIdx];
  50243. newStartVnode = newCh[++newStartIdx];
  50244. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50245. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50246. oldEndVnode = oldCh[--oldEndIdx];
  50247. newEndVnode = newCh[--newEndIdx];
  50248. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50249. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50250. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50251. oldStartVnode = oldCh[++oldStartIdx];
  50252. newEndVnode = newCh[--newEndIdx];
  50253. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50254. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50255. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50256. oldEndVnode = oldCh[--oldEndIdx];
  50257. newStartVnode = newCh[++newStartIdx];
  50258. } else {
  50259. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50260. idxInOld = isDef(newStartVnode.key)
  50261. ? oldKeyToIdx[newStartVnode.key]
  50262. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50263. if (isUndef(idxInOld)) { // New element
  50264. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50265. } else {
  50266. vnodeToMove = oldCh[idxInOld];
  50267. if (sameVnode(vnodeToMove, newStartVnode)) {
  50268. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50269. oldCh[idxInOld] = undefined;
  50270. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50271. } else {
  50272. // same key but different element. treat as new element
  50273. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50274. }
  50275. }
  50276. newStartVnode = newCh[++newStartIdx];
  50277. }
  50278. }
  50279. if (oldStartIdx > oldEndIdx) {
  50280. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50281. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50282. } else if (newStartIdx > newEndIdx) {
  50283. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50284. }
  50285. }
  50286. function checkDuplicateKeys (children) {
  50287. var seenKeys = {};
  50288. for (var i = 0; i < children.length; i++) {
  50289. var vnode = children[i];
  50290. var key = vnode.key;
  50291. if (isDef(key)) {
  50292. if (seenKeys[key]) {
  50293. warn(
  50294. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50295. vnode.context
  50296. );
  50297. } else {
  50298. seenKeys[key] = true;
  50299. }
  50300. }
  50301. }
  50302. }
  50303. function findIdxInOld (node, oldCh, start, end) {
  50304. for (var i = start; i < end; i++) {
  50305. var c = oldCh[i];
  50306. if (isDef(c) && sameVnode(node, c)) { return i }
  50307. }
  50308. }
  50309. function patchVnode (
  50310. oldVnode,
  50311. vnode,
  50312. insertedVnodeQueue,
  50313. ownerArray,
  50314. index,
  50315. removeOnly
  50316. ) {
  50317. if (oldVnode === vnode) {
  50318. return
  50319. }
  50320. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50321. // clone reused vnode
  50322. vnode = ownerArray[index] = cloneVNode(vnode);
  50323. }
  50324. var elm = vnode.elm = oldVnode.elm;
  50325. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50326. if (isDef(vnode.asyncFactory.resolved)) {
  50327. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50328. } else {
  50329. vnode.isAsyncPlaceholder = true;
  50330. }
  50331. return
  50332. }
  50333. // reuse element for static trees.
  50334. // note we only do this if the vnode is cloned -
  50335. // if the new node is not cloned it means the render functions have been
  50336. // reset by the hot-reload-api and we need to do a proper re-render.
  50337. if (isTrue(vnode.isStatic) &&
  50338. isTrue(oldVnode.isStatic) &&
  50339. vnode.key === oldVnode.key &&
  50340. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50341. ) {
  50342. vnode.componentInstance = oldVnode.componentInstance;
  50343. return
  50344. }
  50345. var i;
  50346. var data = vnode.data;
  50347. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50348. i(oldVnode, vnode);
  50349. }
  50350. var oldCh = oldVnode.children;
  50351. var ch = vnode.children;
  50352. if (isDef(data) && isPatchable(vnode)) {
  50353. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50354. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50355. }
  50356. if (isUndef(vnode.text)) {
  50357. if (isDef(oldCh) && isDef(ch)) {
  50358. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50359. } else if (isDef(ch)) {
  50360. {
  50361. checkDuplicateKeys(ch);
  50362. }
  50363. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50364. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50365. } else if (isDef(oldCh)) {
  50366. removeVnodes(oldCh, 0, oldCh.length - 1);
  50367. } else if (isDef(oldVnode.text)) {
  50368. nodeOps.setTextContent(elm, '');
  50369. }
  50370. } else if (oldVnode.text !== vnode.text) {
  50371. nodeOps.setTextContent(elm, vnode.text);
  50372. }
  50373. if (isDef(data)) {
  50374. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50375. }
  50376. }
  50377. function invokeInsertHook (vnode, queue, initial) {
  50378. // delay insert hooks for component root nodes, invoke them after the
  50379. // element is really inserted
  50380. if (isTrue(initial) && isDef(vnode.parent)) {
  50381. vnode.parent.data.pendingInsert = queue;
  50382. } else {
  50383. for (var i = 0; i < queue.length; ++i) {
  50384. queue[i].data.hook.insert(queue[i]);
  50385. }
  50386. }
  50387. }
  50388. var hydrationBailed = false;
  50389. // list of modules that can skip create hook during hydration because they
  50390. // are already rendered on the client or has no need for initialization
  50391. // Note: style is excluded because it relies on initial clone for future
  50392. // deep updates (#7063).
  50393. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50394. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50395. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50396. var i;
  50397. var tag = vnode.tag;
  50398. var data = vnode.data;
  50399. var children = vnode.children;
  50400. inVPre = inVPre || (data && data.pre);
  50401. vnode.elm = elm;
  50402. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50403. vnode.isAsyncPlaceholder = true;
  50404. return true
  50405. }
  50406. // assert node match
  50407. {
  50408. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50409. return false
  50410. }
  50411. }
  50412. if (isDef(data)) {
  50413. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50414. if (isDef(i = vnode.componentInstance)) {
  50415. // child component. it should have hydrated its own tree.
  50416. initComponent(vnode, insertedVnodeQueue);
  50417. return true
  50418. }
  50419. }
  50420. if (isDef(tag)) {
  50421. if (isDef(children)) {
  50422. // empty element, allow client to pick up and populate children
  50423. if (!elm.hasChildNodes()) {
  50424. createChildren(vnode, children, insertedVnodeQueue);
  50425. } else {
  50426. // v-html and domProps: innerHTML
  50427. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50428. if (i !== elm.innerHTML) {
  50429. /* istanbul ignore if */
  50430. if (typeof console !== 'undefined' &&
  50431. !hydrationBailed
  50432. ) {
  50433. hydrationBailed = true;
  50434. console.warn('Parent: ', elm);
  50435. console.warn('server innerHTML: ', i);
  50436. console.warn('client innerHTML: ', elm.innerHTML);
  50437. }
  50438. return false
  50439. }
  50440. } else {
  50441. // iterate and compare children lists
  50442. var childrenMatch = true;
  50443. var childNode = elm.firstChild;
  50444. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50445. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50446. childrenMatch = false;
  50447. break
  50448. }
  50449. childNode = childNode.nextSibling;
  50450. }
  50451. // if childNode is not null, it means the actual childNodes list is
  50452. // longer than the virtual children list.
  50453. if (!childrenMatch || childNode) {
  50454. /* istanbul ignore if */
  50455. if (typeof console !== 'undefined' &&
  50456. !hydrationBailed
  50457. ) {
  50458. hydrationBailed = true;
  50459. console.warn('Parent: ', elm);
  50460. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50461. }
  50462. return false
  50463. }
  50464. }
  50465. }
  50466. }
  50467. if (isDef(data)) {
  50468. var fullInvoke = false;
  50469. for (var key in data) {
  50470. if (!isRenderedModule(key)) {
  50471. fullInvoke = true;
  50472. invokeCreateHooks(vnode, insertedVnodeQueue);
  50473. break
  50474. }
  50475. }
  50476. if (!fullInvoke && data['class']) {
  50477. // ensure collecting deps for deep class bindings for future updates
  50478. traverse(data['class']);
  50479. }
  50480. }
  50481. } else if (elm.data !== vnode.text) {
  50482. elm.data = vnode.text;
  50483. }
  50484. return true
  50485. }
  50486. function assertNodeMatch (node, vnode, inVPre) {
  50487. if (isDef(vnode.tag)) {
  50488. return vnode.tag.indexOf('vue-component') === 0 || (
  50489. !isUnknownElement$$1(vnode, inVPre) &&
  50490. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50491. )
  50492. } else {
  50493. return node.nodeType === (vnode.isComment ? 8 : 3)
  50494. }
  50495. }
  50496. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50497. if (isUndef(vnode)) {
  50498. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50499. return
  50500. }
  50501. var isInitialPatch = false;
  50502. var insertedVnodeQueue = [];
  50503. if (isUndef(oldVnode)) {
  50504. // empty mount (likely as component), create new root element
  50505. isInitialPatch = true;
  50506. createElm(vnode, insertedVnodeQueue);
  50507. } else {
  50508. var isRealElement = isDef(oldVnode.nodeType);
  50509. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50510. // patch existing root node
  50511. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50512. } else {
  50513. if (isRealElement) {
  50514. // mounting to a real element
  50515. // check if this is server-rendered content and if we can perform
  50516. // a successful hydration.
  50517. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50518. oldVnode.removeAttribute(SSR_ATTR);
  50519. hydrating = true;
  50520. }
  50521. if (isTrue(hydrating)) {
  50522. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50523. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50524. return oldVnode
  50525. } else {
  50526. warn(
  50527. 'The client-side rendered virtual DOM tree is not matching ' +
  50528. 'server-rendered content. This is likely caused by incorrect ' +
  50529. 'HTML markup, for example nesting block-level elements inside ' +
  50530. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50531. 'full client-side render.'
  50532. );
  50533. }
  50534. }
  50535. // either not server-rendered, or hydration failed.
  50536. // create an empty node and replace it
  50537. oldVnode = emptyNodeAt(oldVnode);
  50538. }
  50539. // replacing existing element
  50540. var oldElm = oldVnode.elm;
  50541. var parentElm = nodeOps.parentNode(oldElm);
  50542. // create new node
  50543. createElm(
  50544. vnode,
  50545. insertedVnodeQueue,
  50546. // extremely rare edge case: do not insert if old element is in a
  50547. // leaving transition. Only happens when combining transition +
  50548. // keep-alive + HOCs. (#4590)
  50549. oldElm._leaveCb ? null : parentElm,
  50550. nodeOps.nextSibling(oldElm)
  50551. );
  50552. // update parent placeholder node element, recursively
  50553. if (isDef(vnode.parent)) {
  50554. var ancestor = vnode.parent;
  50555. var patchable = isPatchable(vnode);
  50556. while (ancestor) {
  50557. for (var i = 0; i < cbs.destroy.length; ++i) {
  50558. cbs.destroy[i](ancestor);
  50559. }
  50560. ancestor.elm = vnode.elm;
  50561. if (patchable) {
  50562. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50563. cbs.create[i$1](emptyNode, ancestor);
  50564. }
  50565. // #6513
  50566. // invoke insert hooks that may have been merged by create hooks.
  50567. // e.g. for directives that uses the "inserted" hook.
  50568. var insert = ancestor.data.hook.insert;
  50569. if (insert.merged) {
  50570. // start at index 1 to avoid re-invoking component mounted hook
  50571. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50572. insert.fns[i$2]();
  50573. }
  50574. }
  50575. } else {
  50576. registerRef(ancestor);
  50577. }
  50578. ancestor = ancestor.parent;
  50579. }
  50580. }
  50581. // destroy old node
  50582. if (isDef(parentElm)) {
  50583. removeVnodes([oldVnode], 0, 0);
  50584. } else if (isDef(oldVnode.tag)) {
  50585. invokeDestroyHook(oldVnode);
  50586. }
  50587. }
  50588. }
  50589. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50590. return vnode.elm
  50591. }
  50592. }
  50593. /* */
  50594. var directives = {
  50595. create: updateDirectives,
  50596. update: updateDirectives,
  50597. destroy: function unbindDirectives (vnode) {
  50598. updateDirectives(vnode, emptyNode);
  50599. }
  50600. };
  50601. function updateDirectives (oldVnode, vnode) {
  50602. if (oldVnode.data.directives || vnode.data.directives) {
  50603. _update(oldVnode, vnode);
  50604. }
  50605. }
  50606. function _update (oldVnode, vnode) {
  50607. var isCreate = oldVnode === emptyNode;
  50608. var isDestroy = vnode === emptyNode;
  50609. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50610. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50611. var dirsWithInsert = [];
  50612. var dirsWithPostpatch = [];
  50613. var key, oldDir, dir;
  50614. for (key in newDirs) {
  50615. oldDir = oldDirs[key];
  50616. dir = newDirs[key];
  50617. if (!oldDir) {
  50618. // new directive, bind
  50619. callHook$1(dir, 'bind', vnode, oldVnode);
  50620. if (dir.def && dir.def.inserted) {
  50621. dirsWithInsert.push(dir);
  50622. }
  50623. } else {
  50624. // existing directive, update
  50625. dir.oldValue = oldDir.value;
  50626. dir.oldArg = oldDir.arg;
  50627. callHook$1(dir, 'update', vnode, oldVnode);
  50628. if (dir.def && dir.def.componentUpdated) {
  50629. dirsWithPostpatch.push(dir);
  50630. }
  50631. }
  50632. }
  50633. if (dirsWithInsert.length) {
  50634. var callInsert = function () {
  50635. for (var i = 0; i < dirsWithInsert.length; i++) {
  50636. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50637. }
  50638. };
  50639. if (isCreate) {
  50640. mergeVNodeHook(vnode, 'insert', callInsert);
  50641. } else {
  50642. callInsert();
  50643. }
  50644. }
  50645. if (dirsWithPostpatch.length) {
  50646. mergeVNodeHook(vnode, 'postpatch', function () {
  50647. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50648. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50649. }
  50650. });
  50651. }
  50652. if (!isCreate) {
  50653. for (key in oldDirs) {
  50654. if (!newDirs[key]) {
  50655. // no longer present, unbind
  50656. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50657. }
  50658. }
  50659. }
  50660. }
  50661. var emptyModifiers = Object.create(null);
  50662. function normalizeDirectives$1 (
  50663. dirs,
  50664. vm
  50665. ) {
  50666. var res = Object.create(null);
  50667. if (!dirs) {
  50668. // $flow-disable-line
  50669. return res
  50670. }
  50671. var i, dir;
  50672. for (i = 0; i < dirs.length; i++) {
  50673. dir = dirs[i];
  50674. if (!dir.modifiers) {
  50675. // $flow-disable-line
  50676. dir.modifiers = emptyModifiers;
  50677. }
  50678. res[getRawDirName(dir)] = dir;
  50679. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50680. }
  50681. // $flow-disable-line
  50682. return res
  50683. }
  50684. function getRawDirName (dir) {
  50685. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50686. }
  50687. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50688. var fn = dir.def && dir.def[hook];
  50689. if (fn) {
  50690. try {
  50691. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50692. } catch (e) {
  50693. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50694. }
  50695. }
  50696. }
  50697. var baseModules = [
  50698. ref,
  50699. directives
  50700. ];
  50701. /* */
  50702. function updateAttrs (oldVnode, vnode) {
  50703. var opts = vnode.componentOptions;
  50704. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50705. return
  50706. }
  50707. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50708. return
  50709. }
  50710. var key, cur, old;
  50711. var elm = vnode.elm;
  50712. var oldAttrs = oldVnode.data.attrs || {};
  50713. var attrs = vnode.data.attrs || {};
  50714. // clone observed objects, as the user probably wants to mutate it
  50715. if (isDef(attrs.__ob__)) {
  50716. attrs = vnode.data.attrs = extend({}, attrs);
  50717. }
  50718. for (key in attrs) {
  50719. cur = attrs[key];
  50720. old = oldAttrs[key];
  50721. if (old !== cur) {
  50722. setAttr(elm, key, cur);
  50723. }
  50724. }
  50725. // #4391: in IE9, setting type can reset value for input[type=radio]
  50726. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50727. /* istanbul ignore if */
  50728. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50729. setAttr(elm, 'value', attrs.value);
  50730. }
  50731. for (key in oldAttrs) {
  50732. if (isUndef(attrs[key])) {
  50733. if (isXlink(key)) {
  50734. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50735. } else if (!isEnumeratedAttr(key)) {
  50736. elm.removeAttribute(key);
  50737. }
  50738. }
  50739. }
  50740. }
  50741. function setAttr (el, key, value) {
  50742. if (el.tagName.indexOf('-') > -1) {
  50743. baseSetAttr(el, key, value);
  50744. } else if (isBooleanAttr(key)) {
  50745. // set attribute for blank value
  50746. // e.g. <option disabled>Select one</option>
  50747. if (isFalsyAttrValue(value)) {
  50748. el.removeAttribute(key);
  50749. } else {
  50750. // technically allowfullscreen is a boolean attribute for <iframe>,
  50751. // but Flash expects a value of "true" when used on <embed> tag
  50752. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50753. ? 'true'
  50754. : key;
  50755. el.setAttribute(key, value);
  50756. }
  50757. } else if (isEnumeratedAttr(key)) {
  50758. el.setAttribute(key, convertEnumeratedValue(key, value));
  50759. } else if (isXlink(key)) {
  50760. if (isFalsyAttrValue(value)) {
  50761. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50762. } else {
  50763. el.setAttributeNS(xlinkNS, key, value);
  50764. }
  50765. } else {
  50766. baseSetAttr(el, key, value);
  50767. }
  50768. }
  50769. function baseSetAttr (el, key, value) {
  50770. if (isFalsyAttrValue(value)) {
  50771. el.removeAttribute(key);
  50772. } else {
  50773. // #7138: IE10 & 11 fires input event when setting placeholder on
  50774. // <textarea>... block the first input event and remove the blocker
  50775. // immediately.
  50776. /* istanbul ignore if */
  50777. if (
  50778. isIE && !isIE9 &&
  50779. el.tagName === 'TEXTAREA' &&
  50780. key === 'placeholder' && value !== '' && !el.__ieph
  50781. ) {
  50782. var blocker = function (e) {
  50783. e.stopImmediatePropagation();
  50784. el.removeEventListener('input', blocker);
  50785. };
  50786. el.addEventListener('input', blocker);
  50787. // $flow-disable-line
  50788. el.__ieph = true; /* IE placeholder patched */
  50789. }
  50790. el.setAttribute(key, value);
  50791. }
  50792. }
  50793. var attrs = {
  50794. create: updateAttrs,
  50795. update: updateAttrs
  50796. };
  50797. /* */
  50798. function updateClass (oldVnode, vnode) {
  50799. var el = vnode.elm;
  50800. var data = vnode.data;
  50801. var oldData = oldVnode.data;
  50802. if (
  50803. isUndef(data.staticClass) &&
  50804. isUndef(data.class) && (
  50805. isUndef(oldData) || (
  50806. isUndef(oldData.staticClass) &&
  50807. isUndef(oldData.class)
  50808. )
  50809. )
  50810. ) {
  50811. return
  50812. }
  50813. var cls = genClassForVnode(vnode);
  50814. // handle transition classes
  50815. var transitionClass = el._transitionClasses;
  50816. if (isDef(transitionClass)) {
  50817. cls = concat(cls, stringifyClass(transitionClass));
  50818. }
  50819. // set the class
  50820. if (cls !== el._prevClass) {
  50821. el.setAttribute('class', cls);
  50822. el._prevClass = cls;
  50823. }
  50824. }
  50825. var klass = {
  50826. create: updateClass,
  50827. update: updateClass
  50828. };
  50829. /* */
  50830. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50831. function parseFilters (exp) {
  50832. var inSingle = false;
  50833. var inDouble = false;
  50834. var inTemplateString = false;
  50835. var inRegex = false;
  50836. var curly = 0;
  50837. var square = 0;
  50838. var paren = 0;
  50839. var lastFilterIndex = 0;
  50840. var c, prev, i, expression, filters;
  50841. for (i = 0; i < exp.length; i++) {
  50842. prev = c;
  50843. c = exp.charCodeAt(i);
  50844. if (inSingle) {
  50845. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50846. } else if (inDouble) {
  50847. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50848. } else if (inTemplateString) {
  50849. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50850. } else if (inRegex) {
  50851. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50852. } else if (
  50853. c === 0x7C && // pipe
  50854. exp.charCodeAt(i + 1) !== 0x7C &&
  50855. exp.charCodeAt(i - 1) !== 0x7C &&
  50856. !curly && !square && !paren
  50857. ) {
  50858. if (expression === undefined) {
  50859. // first filter, end of expression
  50860. lastFilterIndex = i + 1;
  50861. expression = exp.slice(0, i).trim();
  50862. } else {
  50863. pushFilter();
  50864. }
  50865. } else {
  50866. switch (c) {
  50867. case 0x22: inDouble = true; break // "
  50868. case 0x27: inSingle = true; break // '
  50869. case 0x60: inTemplateString = true; break // `
  50870. case 0x28: paren++; break // (
  50871. case 0x29: paren--; break // )
  50872. case 0x5B: square++; break // [
  50873. case 0x5D: square--; break // ]
  50874. case 0x7B: curly++; break // {
  50875. case 0x7D: curly--; break // }
  50876. }
  50877. if (c === 0x2f) { // /
  50878. var j = i - 1;
  50879. var p = (void 0);
  50880. // find first non-whitespace prev char
  50881. for (; j >= 0; j--) {
  50882. p = exp.charAt(j);
  50883. if (p !== ' ') { break }
  50884. }
  50885. if (!p || !validDivisionCharRE.test(p)) {
  50886. inRegex = true;
  50887. }
  50888. }
  50889. }
  50890. }
  50891. if (expression === undefined) {
  50892. expression = exp.slice(0, i).trim();
  50893. } else if (lastFilterIndex !== 0) {
  50894. pushFilter();
  50895. }
  50896. function pushFilter () {
  50897. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50898. lastFilterIndex = i + 1;
  50899. }
  50900. if (filters) {
  50901. for (i = 0; i < filters.length; i++) {
  50902. expression = wrapFilter(expression, filters[i]);
  50903. }
  50904. }
  50905. return expression
  50906. }
  50907. function wrapFilter (exp, filter) {
  50908. var i = filter.indexOf('(');
  50909. if (i < 0) {
  50910. // _f: resolveFilter
  50911. return ("_f(\"" + filter + "\")(" + exp + ")")
  50912. } else {
  50913. var name = filter.slice(0, i);
  50914. var args = filter.slice(i + 1);
  50915. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50916. }
  50917. }
  50918. /* */
  50919. /* eslint-disable no-unused-vars */
  50920. function baseWarn (msg, range) {
  50921. console.error(("[Vue compiler]: " + msg));
  50922. }
  50923. /* eslint-enable no-unused-vars */
  50924. function pluckModuleFunction (
  50925. modules,
  50926. key
  50927. ) {
  50928. return modules
  50929. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50930. : []
  50931. }
  50932. function addProp (el, name, value, range, dynamic) {
  50933. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50934. el.plain = false;
  50935. }
  50936. function addAttr (el, name, value, range, dynamic) {
  50937. var attrs = dynamic
  50938. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50939. : (el.attrs || (el.attrs = []));
  50940. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50941. el.plain = false;
  50942. }
  50943. // add a raw attr (use this in preTransforms)
  50944. function addRawAttr (el, name, value, range) {
  50945. el.attrsMap[name] = value;
  50946. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50947. }
  50948. function addDirective (
  50949. el,
  50950. name,
  50951. rawName,
  50952. value,
  50953. arg,
  50954. isDynamicArg,
  50955. modifiers,
  50956. range
  50957. ) {
  50958. (el.directives || (el.directives = [])).push(rangeSetItem({
  50959. name: name,
  50960. rawName: rawName,
  50961. value: value,
  50962. arg: arg,
  50963. isDynamicArg: isDynamicArg,
  50964. modifiers: modifiers
  50965. }, range));
  50966. el.plain = false;
  50967. }
  50968. function prependModifierMarker (symbol, name, dynamic) {
  50969. return dynamic
  50970. ? ("_p(" + name + ",\"" + symbol + "\")")
  50971. : symbol + name // mark the event as captured
  50972. }
  50973. function addHandler (
  50974. el,
  50975. name,
  50976. value,
  50977. modifiers,
  50978. important,
  50979. warn,
  50980. range,
  50981. dynamic
  50982. ) {
  50983. modifiers = modifiers || emptyObject;
  50984. // warn prevent and passive modifier
  50985. /* istanbul ignore if */
  50986. if (
  50987. warn &&
  50988. modifiers.prevent && modifiers.passive
  50989. ) {
  50990. warn(
  50991. 'passive and prevent can\'t be used together. ' +
  50992. 'Passive handler can\'t prevent default event.',
  50993. range
  50994. );
  50995. }
  50996. // normalize click.right and click.middle since they don't actually fire
  50997. // this is technically browser-specific, but at least for now browsers are
  50998. // the only target envs that have right/middle clicks.
  50999. if (modifiers.right) {
  51000. if (dynamic) {
  51001. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  51002. } else if (name === 'click') {
  51003. name = 'contextmenu';
  51004. delete modifiers.right;
  51005. }
  51006. } else if (modifiers.middle) {
  51007. if (dynamic) {
  51008. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51009. } else if (name === 'click') {
  51010. name = 'mouseup';
  51011. }
  51012. }
  51013. // check capture modifier
  51014. if (modifiers.capture) {
  51015. delete modifiers.capture;
  51016. name = prependModifierMarker('!', name, dynamic);
  51017. }
  51018. if (modifiers.once) {
  51019. delete modifiers.once;
  51020. name = prependModifierMarker('~', name, dynamic);
  51021. }
  51022. /* istanbul ignore if */
  51023. if (modifiers.passive) {
  51024. delete modifiers.passive;
  51025. name = prependModifierMarker('&', name, dynamic);
  51026. }
  51027. var events;
  51028. if (modifiers.native) {
  51029. delete modifiers.native;
  51030. events = el.nativeEvents || (el.nativeEvents = {});
  51031. } else {
  51032. events = el.events || (el.events = {});
  51033. }
  51034. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51035. if (modifiers !== emptyObject) {
  51036. newHandler.modifiers = modifiers;
  51037. }
  51038. var handlers = events[name];
  51039. /* istanbul ignore if */
  51040. if (Array.isArray(handlers)) {
  51041. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51042. } else if (handlers) {
  51043. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51044. } else {
  51045. events[name] = newHandler;
  51046. }
  51047. el.plain = false;
  51048. }
  51049. function getRawBindingAttr (
  51050. el,
  51051. name
  51052. ) {
  51053. return el.rawAttrsMap[':' + name] ||
  51054. el.rawAttrsMap['v-bind:' + name] ||
  51055. el.rawAttrsMap[name]
  51056. }
  51057. function getBindingAttr (
  51058. el,
  51059. name,
  51060. getStatic
  51061. ) {
  51062. var dynamicValue =
  51063. getAndRemoveAttr(el, ':' + name) ||
  51064. getAndRemoveAttr(el, 'v-bind:' + name);
  51065. if (dynamicValue != null) {
  51066. return parseFilters(dynamicValue)
  51067. } else if (getStatic !== false) {
  51068. var staticValue = getAndRemoveAttr(el, name);
  51069. if (staticValue != null) {
  51070. return JSON.stringify(staticValue)
  51071. }
  51072. }
  51073. }
  51074. // note: this only removes the attr from the Array (attrsList) so that it
  51075. // doesn't get processed by processAttrs.
  51076. // By default it does NOT remove it from the map (attrsMap) because the map is
  51077. // needed during codegen.
  51078. function getAndRemoveAttr (
  51079. el,
  51080. name,
  51081. removeFromMap
  51082. ) {
  51083. var val;
  51084. if ((val = el.attrsMap[name]) != null) {
  51085. var list = el.attrsList;
  51086. for (var i = 0, l = list.length; i < l; i++) {
  51087. if (list[i].name === name) {
  51088. list.splice(i, 1);
  51089. break
  51090. }
  51091. }
  51092. }
  51093. if (removeFromMap) {
  51094. delete el.attrsMap[name];
  51095. }
  51096. return val
  51097. }
  51098. function getAndRemoveAttrByRegex (
  51099. el,
  51100. name
  51101. ) {
  51102. var list = el.attrsList;
  51103. for (var i = 0, l = list.length; i < l; i++) {
  51104. var attr = list[i];
  51105. if (name.test(attr.name)) {
  51106. list.splice(i, 1);
  51107. return attr
  51108. }
  51109. }
  51110. }
  51111. function rangeSetItem (
  51112. item,
  51113. range
  51114. ) {
  51115. if (range) {
  51116. if (range.start != null) {
  51117. item.start = range.start;
  51118. }
  51119. if (range.end != null) {
  51120. item.end = range.end;
  51121. }
  51122. }
  51123. return item
  51124. }
  51125. /* */
  51126. /**
  51127. * Cross-platform code generation for component v-model
  51128. */
  51129. function genComponentModel (
  51130. el,
  51131. value,
  51132. modifiers
  51133. ) {
  51134. var ref = modifiers || {};
  51135. var number = ref.number;
  51136. var trim = ref.trim;
  51137. var baseValueExpression = '$$v';
  51138. var valueExpression = baseValueExpression;
  51139. if (trim) {
  51140. valueExpression =
  51141. "(typeof " + baseValueExpression + " === 'string'" +
  51142. "? " + baseValueExpression + ".trim()" +
  51143. ": " + baseValueExpression + ")";
  51144. }
  51145. if (number) {
  51146. valueExpression = "_n(" + valueExpression + ")";
  51147. }
  51148. var assignment = genAssignmentCode(value, valueExpression);
  51149. el.model = {
  51150. value: ("(" + value + ")"),
  51151. expression: JSON.stringify(value),
  51152. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51153. };
  51154. }
  51155. /**
  51156. * Cross-platform codegen helper for generating v-model value assignment code.
  51157. */
  51158. function genAssignmentCode (
  51159. value,
  51160. assignment
  51161. ) {
  51162. var res = parseModel(value);
  51163. if (res.key === null) {
  51164. return (value + "=" + assignment)
  51165. } else {
  51166. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51167. }
  51168. }
  51169. /**
  51170. * Parse a v-model expression into a base path and a final key segment.
  51171. * Handles both dot-path and possible square brackets.
  51172. *
  51173. * Possible cases:
  51174. *
  51175. * - test
  51176. * - test[key]
  51177. * - test[test1[key]]
  51178. * - test["a"][key]
  51179. * - xxx.test[a[a].test1[key]]
  51180. * - test.xxx.a["asa"][test1[key]]
  51181. *
  51182. */
  51183. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51184. function parseModel (val) {
  51185. // Fix https://github.com/vuejs/vue/pull/7730
  51186. // allow v-model="obj.val " (trailing whitespace)
  51187. val = val.trim();
  51188. len = val.length;
  51189. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51190. index$1 = val.lastIndexOf('.');
  51191. if (index$1 > -1) {
  51192. return {
  51193. exp: val.slice(0, index$1),
  51194. key: '"' + val.slice(index$1 + 1) + '"'
  51195. }
  51196. } else {
  51197. return {
  51198. exp: val,
  51199. key: null
  51200. }
  51201. }
  51202. }
  51203. str = val;
  51204. index$1 = expressionPos = expressionEndPos = 0;
  51205. while (!eof()) {
  51206. chr = next();
  51207. /* istanbul ignore if */
  51208. if (isStringStart(chr)) {
  51209. parseString(chr);
  51210. } else if (chr === 0x5B) {
  51211. parseBracket(chr);
  51212. }
  51213. }
  51214. return {
  51215. exp: val.slice(0, expressionPos),
  51216. key: val.slice(expressionPos + 1, expressionEndPos)
  51217. }
  51218. }
  51219. function next () {
  51220. return str.charCodeAt(++index$1)
  51221. }
  51222. function eof () {
  51223. return index$1 >= len
  51224. }
  51225. function isStringStart (chr) {
  51226. return chr === 0x22 || chr === 0x27
  51227. }
  51228. function parseBracket (chr) {
  51229. var inBracket = 1;
  51230. expressionPos = index$1;
  51231. while (!eof()) {
  51232. chr = next();
  51233. if (isStringStart(chr)) {
  51234. parseString(chr);
  51235. continue
  51236. }
  51237. if (chr === 0x5B) { inBracket++; }
  51238. if (chr === 0x5D) { inBracket--; }
  51239. if (inBracket === 0) {
  51240. expressionEndPos = index$1;
  51241. break
  51242. }
  51243. }
  51244. }
  51245. function parseString (chr) {
  51246. var stringQuote = chr;
  51247. while (!eof()) {
  51248. chr = next();
  51249. if (chr === stringQuote) {
  51250. break
  51251. }
  51252. }
  51253. }
  51254. /* */
  51255. var warn$1;
  51256. // in some cases, the event used has to be determined at runtime
  51257. // so we used some reserved tokens during compile.
  51258. var RANGE_TOKEN = '__r';
  51259. var CHECKBOX_RADIO_TOKEN = '__c';
  51260. function model (
  51261. el,
  51262. dir,
  51263. _warn
  51264. ) {
  51265. warn$1 = _warn;
  51266. var value = dir.value;
  51267. var modifiers = dir.modifiers;
  51268. var tag = el.tag;
  51269. var type = el.attrsMap.type;
  51270. {
  51271. // inputs with type="file" are read only and setting the input's
  51272. // value will throw an error.
  51273. if (tag === 'input' && type === 'file') {
  51274. warn$1(
  51275. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51276. "File inputs are read only. Use a v-on:change listener instead.",
  51277. el.rawAttrsMap['v-model']
  51278. );
  51279. }
  51280. }
  51281. if (el.component) {
  51282. genComponentModel(el, value, modifiers);
  51283. // component v-model doesn't need extra runtime
  51284. return false
  51285. } else if (tag === 'select') {
  51286. genSelect(el, value, modifiers);
  51287. } else if (tag === 'input' && type === 'checkbox') {
  51288. genCheckboxModel(el, value, modifiers);
  51289. } else if (tag === 'input' && type === 'radio') {
  51290. genRadioModel(el, value, modifiers);
  51291. } else if (tag === 'input' || tag === 'textarea') {
  51292. genDefaultModel(el, value, modifiers);
  51293. } else if (!config.isReservedTag(tag)) {
  51294. genComponentModel(el, value, modifiers);
  51295. // component v-model doesn't need extra runtime
  51296. return false
  51297. } else {
  51298. warn$1(
  51299. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51300. "v-model is not supported on this element type. " +
  51301. 'If you are working with contenteditable, it\'s recommended to ' +
  51302. 'wrap a library dedicated for that purpose inside a custom component.',
  51303. el.rawAttrsMap['v-model']
  51304. );
  51305. }
  51306. // ensure runtime directive metadata
  51307. return true
  51308. }
  51309. function genCheckboxModel (
  51310. el,
  51311. value,
  51312. modifiers
  51313. ) {
  51314. var number = modifiers && modifiers.number;
  51315. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51316. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51317. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51318. addProp(el, 'checked',
  51319. "Array.isArray(" + value + ")" +
  51320. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51321. trueValueBinding === 'true'
  51322. ? (":(" + value + ")")
  51323. : (":_q(" + value + "," + trueValueBinding + ")")
  51324. )
  51325. );
  51326. addHandler(el, 'change',
  51327. "var $$a=" + value + "," +
  51328. '$$el=$event.target,' +
  51329. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51330. 'if(Array.isArray($$a)){' +
  51331. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51332. '$$i=_i($$a,$$v);' +
  51333. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51334. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51335. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51336. null, true
  51337. );
  51338. }
  51339. function genRadioModel (
  51340. el,
  51341. value,
  51342. modifiers
  51343. ) {
  51344. var number = modifiers && modifiers.number;
  51345. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51346. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51347. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51348. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51349. }
  51350. function genSelect (
  51351. el,
  51352. value,
  51353. modifiers
  51354. ) {
  51355. var number = modifiers && modifiers.number;
  51356. var selectedVal = "Array.prototype.filter" +
  51357. ".call($event.target.options,function(o){return o.selected})" +
  51358. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51359. "return " + (number ? '_n(val)' : 'val') + "})";
  51360. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51361. var code = "var $$selectedVal = " + selectedVal + ";";
  51362. code = code + " " + (genAssignmentCode(value, assignment));
  51363. addHandler(el, 'change', code, null, true);
  51364. }
  51365. function genDefaultModel (
  51366. el,
  51367. value,
  51368. modifiers
  51369. ) {
  51370. var type = el.attrsMap.type;
  51371. // warn if v-bind:value conflicts with v-model
  51372. // except for inputs with v-bind:type
  51373. {
  51374. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51375. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51376. if (value$1 && !typeBinding) {
  51377. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51378. warn$1(
  51379. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51380. 'because the latter already expands to a value binding internally',
  51381. el.rawAttrsMap[binding]
  51382. );
  51383. }
  51384. }
  51385. var ref = modifiers || {};
  51386. var lazy = ref.lazy;
  51387. var number = ref.number;
  51388. var trim = ref.trim;
  51389. var needCompositionGuard = !lazy && type !== 'range';
  51390. var event = lazy
  51391. ? 'change'
  51392. : type === 'range'
  51393. ? RANGE_TOKEN
  51394. : 'input';
  51395. var valueExpression = '$event.target.value';
  51396. if (trim) {
  51397. valueExpression = "$event.target.value.trim()";
  51398. }
  51399. if (number) {
  51400. valueExpression = "_n(" + valueExpression + ")";
  51401. }
  51402. var code = genAssignmentCode(value, valueExpression);
  51403. if (needCompositionGuard) {
  51404. code = "if($event.target.composing)return;" + code;
  51405. }
  51406. addProp(el, 'value', ("(" + value + ")"));
  51407. addHandler(el, event, code, null, true);
  51408. if (trim || number) {
  51409. addHandler(el, 'blur', '$forceUpdate()');
  51410. }
  51411. }
  51412. /* */
  51413. // normalize v-model event tokens that can only be determined at runtime.
  51414. // it's important to place the event as the first in the array because
  51415. // the whole point is ensuring the v-model callback gets called before
  51416. // user-attached handlers.
  51417. function normalizeEvents (on) {
  51418. /* istanbul ignore if */
  51419. if (isDef(on[RANGE_TOKEN])) {
  51420. // IE input[type=range] only supports `change` event
  51421. var event = isIE ? 'change' : 'input';
  51422. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51423. delete on[RANGE_TOKEN];
  51424. }
  51425. // This was originally intended to fix #4521 but no longer necessary
  51426. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51427. /* istanbul ignore if */
  51428. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51429. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51430. delete on[CHECKBOX_RADIO_TOKEN];
  51431. }
  51432. }
  51433. var target$1;
  51434. function createOnceHandler$1 (event, handler, capture) {
  51435. var _target = target$1; // save current target element in closure
  51436. return function onceHandler () {
  51437. var res = handler.apply(null, arguments);
  51438. if (res !== null) {
  51439. remove$2(event, onceHandler, capture, _target);
  51440. }
  51441. }
  51442. }
  51443. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51444. // implementation and does not fire microtasks in between event propagation, so
  51445. // safe to exclude.
  51446. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51447. function add$1 (
  51448. name,
  51449. handler,
  51450. capture,
  51451. passive
  51452. ) {
  51453. // async edge case #6566: inner click event triggers patch, event handler
  51454. // attached to outer element during patch, and triggered again. This
  51455. // happens because browsers fire microtask ticks between event propagation.
  51456. // the solution is simple: we save the timestamp when a handler is attached,
  51457. // and the handler would only fire if the event passed to it was fired
  51458. // AFTER it was attached.
  51459. if (useMicrotaskFix) {
  51460. var attachedTimestamp = currentFlushTimestamp;
  51461. var original = handler;
  51462. handler = original._wrapper = function (e) {
  51463. if (
  51464. // no bubbling, should always fire.
  51465. // this is just a safety net in case event.timeStamp is unreliable in
  51466. // certain weird environments...
  51467. e.target === e.currentTarget ||
  51468. // event is fired after handler attachment
  51469. e.timeStamp >= attachedTimestamp ||
  51470. // bail for environments that have buggy event.timeStamp implementations
  51471. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51472. // #9681 QtWebEngine event.timeStamp is negative value
  51473. e.timeStamp <= 0 ||
  51474. // #9448 bail if event is fired in another document in a multi-page
  51475. // electron/nw.js app, since event.timeStamp will be using a different
  51476. // starting reference
  51477. e.target.ownerDocument !== document
  51478. ) {
  51479. return original.apply(this, arguments)
  51480. }
  51481. };
  51482. }
  51483. target$1.addEventListener(
  51484. name,
  51485. handler,
  51486. supportsPassive
  51487. ? { capture: capture, passive: passive }
  51488. : capture
  51489. );
  51490. }
  51491. function remove$2 (
  51492. name,
  51493. handler,
  51494. capture,
  51495. _target
  51496. ) {
  51497. (_target || target$1).removeEventListener(
  51498. name,
  51499. handler._wrapper || handler,
  51500. capture
  51501. );
  51502. }
  51503. function updateDOMListeners (oldVnode, vnode) {
  51504. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51505. return
  51506. }
  51507. var on = vnode.data.on || {};
  51508. var oldOn = oldVnode.data.on || {};
  51509. target$1 = vnode.elm;
  51510. normalizeEvents(on);
  51511. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51512. target$1 = undefined;
  51513. }
  51514. var events = {
  51515. create: updateDOMListeners,
  51516. update: updateDOMListeners
  51517. };
  51518. /* */
  51519. var svgContainer;
  51520. function updateDOMProps (oldVnode, vnode) {
  51521. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51522. return
  51523. }
  51524. var key, cur;
  51525. var elm = vnode.elm;
  51526. var oldProps = oldVnode.data.domProps || {};
  51527. var props = vnode.data.domProps || {};
  51528. // clone observed objects, as the user probably wants to mutate it
  51529. if (isDef(props.__ob__)) {
  51530. props = vnode.data.domProps = extend({}, props);
  51531. }
  51532. for (key in oldProps) {
  51533. if (!(key in props)) {
  51534. elm[key] = '';
  51535. }
  51536. }
  51537. for (key in props) {
  51538. cur = props[key];
  51539. // ignore children if the node has textContent or innerHTML,
  51540. // as these will throw away existing DOM nodes and cause removal errors
  51541. // on subsequent patches (#3360)
  51542. if (key === 'textContent' || key === 'innerHTML') {
  51543. if (vnode.children) { vnode.children.length = 0; }
  51544. if (cur === oldProps[key]) { continue }
  51545. // #6601 work around Chrome version <= 55 bug where single textNode
  51546. // replaced by innerHTML/textContent retains its parentNode property
  51547. if (elm.childNodes.length === 1) {
  51548. elm.removeChild(elm.childNodes[0]);
  51549. }
  51550. }
  51551. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51552. // store value as _value as well since
  51553. // non-string values will be stringified
  51554. elm._value = cur;
  51555. // avoid resetting cursor position when value is the same
  51556. var strCur = isUndef(cur) ? '' : String(cur);
  51557. if (shouldUpdateValue(elm, strCur)) {
  51558. elm.value = strCur;
  51559. }
  51560. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51561. // IE doesn't support innerHTML for SVG elements
  51562. svgContainer = svgContainer || document.createElement('div');
  51563. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51564. var svg = svgContainer.firstChild;
  51565. while (elm.firstChild) {
  51566. elm.removeChild(elm.firstChild);
  51567. }
  51568. while (svg.firstChild) {
  51569. elm.appendChild(svg.firstChild);
  51570. }
  51571. } else if (
  51572. // skip the update if old and new VDOM state is the same.
  51573. // `value` is handled separately because the DOM value may be temporarily
  51574. // out of sync with VDOM state due to focus, composition and modifiers.
  51575. // This #4521 by skipping the unnecesarry `checked` update.
  51576. cur !== oldProps[key]
  51577. ) {
  51578. // some property updates can throw
  51579. // e.g. `value` on <progress> w/ non-finite value
  51580. try {
  51581. elm[key] = cur;
  51582. } catch (e) {}
  51583. }
  51584. }
  51585. }
  51586. // check platforms/web/util/attrs.js acceptValue
  51587. function shouldUpdateValue (elm, checkVal) {
  51588. return (!elm.composing && (
  51589. elm.tagName === 'OPTION' ||
  51590. isNotInFocusAndDirty(elm, checkVal) ||
  51591. isDirtyWithModifiers(elm, checkVal)
  51592. ))
  51593. }
  51594. function isNotInFocusAndDirty (elm, checkVal) {
  51595. // return true when textbox (.number and .trim) loses focus and its value is
  51596. // not equal to the updated value
  51597. var notInFocus = true;
  51598. // #6157
  51599. // work around IE bug when accessing document.activeElement in an iframe
  51600. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51601. return notInFocus && elm.value !== checkVal
  51602. }
  51603. function isDirtyWithModifiers (elm, newVal) {
  51604. var value = elm.value;
  51605. var modifiers = elm._vModifiers; // injected by v-model runtime
  51606. if (isDef(modifiers)) {
  51607. if (modifiers.number) {
  51608. return toNumber(value) !== toNumber(newVal)
  51609. }
  51610. if (modifiers.trim) {
  51611. return value.trim() !== newVal.trim()
  51612. }
  51613. }
  51614. return value !== newVal
  51615. }
  51616. var domProps = {
  51617. create: updateDOMProps,
  51618. update: updateDOMProps
  51619. };
  51620. /* */
  51621. var parseStyleText = cached(function (cssText) {
  51622. var res = {};
  51623. var listDelimiter = /;(?![^(]*\))/g;
  51624. var propertyDelimiter = /:(.+)/;
  51625. cssText.split(listDelimiter).forEach(function (item) {
  51626. if (item) {
  51627. var tmp = item.split(propertyDelimiter);
  51628. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51629. }
  51630. });
  51631. return res
  51632. });
  51633. // merge static and dynamic style data on the same vnode
  51634. function normalizeStyleData (data) {
  51635. var style = normalizeStyleBinding(data.style);
  51636. // static style is pre-processed into an object during compilation
  51637. // and is always a fresh object, so it's safe to merge into it
  51638. return data.staticStyle
  51639. ? extend(data.staticStyle, style)
  51640. : style
  51641. }
  51642. // normalize possible array / string values into Object
  51643. function normalizeStyleBinding (bindingStyle) {
  51644. if (Array.isArray(bindingStyle)) {
  51645. return toObject(bindingStyle)
  51646. }
  51647. if (typeof bindingStyle === 'string') {
  51648. return parseStyleText(bindingStyle)
  51649. }
  51650. return bindingStyle
  51651. }
  51652. /**
  51653. * parent component style should be after child's
  51654. * so that parent component's style could override it
  51655. */
  51656. function getStyle (vnode, checkChild) {
  51657. var res = {};
  51658. var styleData;
  51659. if (checkChild) {
  51660. var childNode = vnode;
  51661. while (childNode.componentInstance) {
  51662. childNode = childNode.componentInstance._vnode;
  51663. if (
  51664. childNode && childNode.data &&
  51665. (styleData = normalizeStyleData(childNode.data))
  51666. ) {
  51667. extend(res, styleData);
  51668. }
  51669. }
  51670. }
  51671. if ((styleData = normalizeStyleData(vnode.data))) {
  51672. extend(res, styleData);
  51673. }
  51674. var parentNode = vnode;
  51675. while ((parentNode = parentNode.parent)) {
  51676. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51677. extend(res, styleData);
  51678. }
  51679. }
  51680. return res
  51681. }
  51682. /* */
  51683. var cssVarRE = /^--/;
  51684. var importantRE = /\s*!important$/;
  51685. var setProp = function (el, name, val) {
  51686. /* istanbul ignore if */
  51687. if (cssVarRE.test(name)) {
  51688. el.style.setProperty(name, val);
  51689. } else if (importantRE.test(val)) {
  51690. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51691. } else {
  51692. var normalizedName = normalize(name);
  51693. if (Array.isArray(val)) {
  51694. // Support values array created by autoprefixer, e.g.
  51695. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51696. // Set them one by one, and the browser will only set those it can recognize
  51697. for (var i = 0, len = val.length; i < len; i++) {
  51698. el.style[normalizedName] = val[i];
  51699. }
  51700. } else {
  51701. el.style[normalizedName] = val;
  51702. }
  51703. }
  51704. };
  51705. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51706. var emptyStyle;
  51707. var normalize = cached(function (prop) {
  51708. emptyStyle = emptyStyle || document.createElement('div').style;
  51709. prop = camelize(prop);
  51710. if (prop !== 'filter' && (prop in emptyStyle)) {
  51711. return prop
  51712. }
  51713. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51714. for (var i = 0; i < vendorNames.length; i++) {
  51715. var name = vendorNames[i] + capName;
  51716. if (name in emptyStyle) {
  51717. return name
  51718. }
  51719. }
  51720. });
  51721. function updateStyle (oldVnode, vnode) {
  51722. var data = vnode.data;
  51723. var oldData = oldVnode.data;
  51724. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51725. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51726. ) {
  51727. return
  51728. }
  51729. var cur, name;
  51730. var el = vnode.elm;
  51731. var oldStaticStyle = oldData.staticStyle;
  51732. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51733. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51734. var oldStyle = oldStaticStyle || oldStyleBinding;
  51735. var style = normalizeStyleBinding(vnode.data.style) || {};
  51736. // store normalized style under a different key for next diff
  51737. // make sure to clone it if it's reactive, since the user likely wants
  51738. // to mutate it.
  51739. vnode.data.normalizedStyle = isDef(style.__ob__)
  51740. ? extend({}, style)
  51741. : style;
  51742. var newStyle = getStyle(vnode, true);
  51743. for (name in oldStyle) {
  51744. if (isUndef(newStyle[name])) {
  51745. setProp(el, name, '');
  51746. }
  51747. }
  51748. for (name in newStyle) {
  51749. cur = newStyle[name];
  51750. if (cur !== oldStyle[name]) {
  51751. // ie9 setting to null has no effect, must use empty string
  51752. setProp(el, name, cur == null ? '' : cur);
  51753. }
  51754. }
  51755. }
  51756. var style = {
  51757. create: updateStyle,
  51758. update: updateStyle
  51759. };
  51760. /* */
  51761. var whitespaceRE = /\s+/;
  51762. /**
  51763. * Add class with compatibility for SVG since classList is not supported on
  51764. * SVG elements in IE
  51765. */
  51766. function addClass (el, cls) {
  51767. /* istanbul ignore if */
  51768. if (!cls || !(cls = cls.trim())) {
  51769. return
  51770. }
  51771. /* istanbul ignore else */
  51772. if (el.classList) {
  51773. if (cls.indexOf(' ') > -1) {
  51774. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51775. } else {
  51776. el.classList.add(cls);
  51777. }
  51778. } else {
  51779. var cur = " " + (el.getAttribute('class') || '') + " ";
  51780. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51781. el.setAttribute('class', (cur + cls).trim());
  51782. }
  51783. }
  51784. }
  51785. /**
  51786. * Remove class with compatibility for SVG since classList is not supported on
  51787. * SVG elements in IE
  51788. */
  51789. function removeClass (el, cls) {
  51790. /* istanbul ignore if */
  51791. if (!cls || !(cls = cls.trim())) {
  51792. return
  51793. }
  51794. /* istanbul ignore else */
  51795. if (el.classList) {
  51796. if (cls.indexOf(' ') > -1) {
  51797. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51798. } else {
  51799. el.classList.remove(cls);
  51800. }
  51801. if (!el.classList.length) {
  51802. el.removeAttribute('class');
  51803. }
  51804. } else {
  51805. var cur = " " + (el.getAttribute('class') || '') + " ";
  51806. var tar = ' ' + cls + ' ';
  51807. while (cur.indexOf(tar) >= 0) {
  51808. cur = cur.replace(tar, ' ');
  51809. }
  51810. cur = cur.trim();
  51811. if (cur) {
  51812. el.setAttribute('class', cur);
  51813. } else {
  51814. el.removeAttribute('class');
  51815. }
  51816. }
  51817. }
  51818. /* */
  51819. function resolveTransition (def$$1) {
  51820. if (!def$$1) {
  51821. return
  51822. }
  51823. /* istanbul ignore else */
  51824. if (typeof def$$1 === 'object') {
  51825. var res = {};
  51826. if (def$$1.css !== false) {
  51827. extend(res, autoCssTransition(def$$1.name || 'v'));
  51828. }
  51829. extend(res, def$$1);
  51830. return res
  51831. } else if (typeof def$$1 === 'string') {
  51832. return autoCssTransition(def$$1)
  51833. }
  51834. }
  51835. var autoCssTransition = cached(function (name) {
  51836. return {
  51837. enterClass: (name + "-enter"),
  51838. enterToClass: (name + "-enter-to"),
  51839. enterActiveClass: (name + "-enter-active"),
  51840. leaveClass: (name + "-leave"),
  51841. leaveToClass: (name + "-leave-to"),
  51842. leaveActiveClass: (name + "-leave-active")
  51843. }
  51844. });
  51845. var hasTransition = inBrowser && !isIE9;
  51846. var TRANSITION = 'transition';
  51847. var ANIMATION = 'animation';
  51848. // Transition property/event sniffing
  51849. var transitionProp = 'transition';
  51850. var transitionEndEvent = 'transitionend';
  51851. var animationProp = 'animation';
  51852. var animationEndEvent = 'animationend';
  51853. if (hasTransition) {
  51854. /* istanbul ignore if */
  51855. if (window.ontransitionend === undefined &&
  51856. window.onwebkittransitionend !== undefined
  51857. ) {
  51858. transitionProp = 'WebkitTransition';
  51859. transitionEndEvent = 'webkitTransitionEnd';
  51860. }
  51861. if (window.onanimationend === undefined &&
  51862. window.onwebkitanimationend !== undefined
  51863. ) {
  51864. animationProp = 'WebkitAnimation';
  51865. animationEndEvent = 'webkitAnimationEnd';
  51866. }
  51867. }
  51868. // binding to window is necessary to make hot reload work in IE in strict mode
  51869. var raf = inBrowser
  51870. ? window.requestAnimationFrame
  51871. ? window.requestAnimationFrame.bind(window)
  51872. : setTimeout
  51873. : /* istanbul ignore next */ function (fn) { return fn(); };
  51874. function nextFrame (fn) {
  51875. raf(function () {
  51876. raf(fn);
  51877. });
  51878. }
  51879. function addTransitionClass (el, cls) {
  51880. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51881. if (transitionClasses.indexOf(cls) < 0) {
  51882. transitionClasses.push(cls);
  51883. addClass(el, cls);
  51884. }
  51885. }
  51886. function removeTransitionClass (el, cls) {
  51887. if (el._transitionClasses) {
  51888. remove(el._transitionClasses, cls);
  51889. }
  51890. removeClass(el, cls);
  51891. }
  51892. function whenTransitionEnds (
  51893. el,
  51894. expectedType,
  51895. cb
  51896. ) {
  51897. var ref = getTransitionInfo(el, expectedType);
  51898. var type = ref.type;
  51899. var timeout = ref.timeout;
  51900. var propCount = ref.propCount;
  51901. if (!type) { return cb() }
  51902. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51903. var ended = 0;
  51904. var end = function () {
  51905. el.removeEventListener(event, onEnd);
  51906. cb();
  51907. };
  51908. var onEnd = function (e) {
  51909. if (e.target === el) {
  51910. if (++ended >= propCount) {
  51911. end();
  51912. }
  51913. }
  51914. };
  51915. setTimeout(function () {
  51916. if (ended < propCount) {
  51917. end();
  51918. }
  51919. }, timeout + 1);
  51920. el.addEventListener(event, onEnd);
  51921. }
  51922. var transformRE = /\b(transform|all)(,|$)/;
  51923. function getTransitionInfo (el, expectedType) {
  51924. var styles = window.getComputedStyle(el);
  51925. // JSDOM may return undefined for transition properties
  51926. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51927. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51928. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51929. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51930. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51931. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51932. var type;
  51933. var timeout = 0;
  51934. var propCount = 0;
  51935. /* istanbul ignore if */
  51936. if (expectedType === TRANSITION) {
  51937. if (transitionTimeout > 0) {
  51938. type = TRANSITION;
  51939. timeout = transitionTimeout;
  51940. propCount = transitionDurations.length;
  51941. }
  51942. } else if (expectedType === ANIMATION) {
  51943. if (animationTimeout > 0) {
  51944. type = ANIMATION;
  51945. timeout = animationTimeout;
  51946. propCount = animationDurations.length;
  51947. }
  51948. } else {
  51949. timeout = Math.max(transitionTimeout, animationTimeout);
  51950. type = timeout > 0
  51951. ? transitionTimeout > animationTimeout
  51952. ? TRANSITION
  51953. : ANIMATION
  51954. : null;
  51955. propCount = type
  51956. ? type === TRANSITION
  51957. ? transitionDurations.length
  51958. : animationDurations.length
  51959. : 0;
  51960. }
  51961. var hasTransform =
  51962. type === TRANSITION &&
  51963. transformRE.test(styles[transitionProp + 'Property']);
  51964. return {
  51965. type: type,
  51966. timeout: timeout,
  51967. propCount: propCount,
  51968. hasTransform: hasTransform
  51969. }
  51970. }
  51971. function getTimeout (delays, durations) {
  51972. /* istanbul ignore next */
  51973. while (delays.length < durations.length) {
  51974. delays = delays.concat(delays);
  51975. }
  51976. return Math.max.apply(null, durations.map(function (d, i) {
  51977. return toMs(d) + toMs(delays[i])
  51978. }))
  51979. }
  51980. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51981. // in a locale-dependent way, using a comma instead of a dot.
  51982. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51983. // as a floor function) causing unexpected behaviors
  51984. function toMs (s) {
  51985. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51986. }
  51987. /* */
  51988. function enter (vnode, toggleDisplay) {
  51989. var el = vnode.elm;
  51990. // call leave callback now
  51991. if (isDef(el._leaveCb)) {
  51992. el._leaveCb.cancelled = true;
  51993. el._leaveCb();
  51994. }
  51995. var data = resolveTransition(vnode.data.transition);
  51996. if (isUndef(data)) {
  51997. return
  51998. }
  51999. /* istanbul ignore if */
  52000. if (isDef(el._enterCb) || el.nodeType !== 1) {
  52001. return
  52002. }
  52003. var css = data.css;
  52004. var type = data.type;
  52005. var enterClass = data.enterClass;
  52006. var enterToClass = data.enterToClass;
  52007. var enterActiveClass = data.enterActiveClass;
  52008. var appearClass = data.appearClass;
  52009. var appearToClass = data.appearToClass;
  52010. var appearActiveClass = data.appearActiveClass;
  52011. var beforeEnter = data.beforeEnter;
  52012. var enter = data.enter;
  52013. var afterEnter = data.afterEnter;
  52014. var enterCancelled = data.enterCancelled;
  52015. var beforeAppear = data.beforeAppear;
  52016. var appear = data.appear;
  52017. var afterAppear = data.afterAppear;
  52018. var appearCancelled = data.appearCancelled;
  52019. var duration = data.duration;
  52020. // activeInstance will always be the <transition> component managing this
  52021. // transition. One edge case to check is when the <transition> is placed
  52022. // as the root node of a child component. In that case we need to check
  52023. // <transition>'s parent for appear check.
  52024. var context = activeInstance;
  52025. var transitionNode = activeInstance.$vnode;
  52026. while (transitionNode && transitionNode.parent) {
  52027. context = transitionNode.context;
  52028. transitionNode = transitionNode.parent;
  52029. }
  52030. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52031. if (isAppear && !appear && appear !== '') {
  52032. return
  52033. }
  52034. var startClass = isAppear && appearClass
  52035. ? appearClass
  52036. : enterClass;
  52037. var activeClass = isAppear && appearActiveClass
  52038. ? appearActiveClass
  52039. : enterActiveClass;
  52040. var toClass = isAppear && appearToClass
  52041. ? appearToClass
  52042. : enterToClass;
  52043. var beforeEnterHook = isAppear
  52044. ? (beforeAppear || beforeEnter)
  52045. : beforeEnter;
  52046. var enterHook = isAppear
  52047. ? (typeof appear === 'function' ? appear : enter)
  52048. : enter;
  52049. var afterEnterHook = isAppear
  52050. ? (afterAppear || afterEnter)
  52051. : afterEnter;
  52052. var enterCancelledHook = isAppear
  52053. ? (appearCancelled || enterCancelled)
  52054. : enterCancelled;
  52055. var explicitEnterDuration = toNumber(
  52056. isObject(duration)
  52057. ? duration.enter
  52058. : duration
  52059. );
  52060. if (explicitEnterDuration != null) {
  52061. checkDuration(explicitEnterDuration, 'enter', vnode);
  52062. }
  52063. var expectsCSS = css !== false && !isIE9;
  52064. var userWantsControl = getHookArgumentsLength(enterHook);
  52065. var cb = el._enterCb = once(function () {
  52066. if (expectsCSS) {
  52067. removeTransitionClass(el, toClass);
  52068. removeTransitionClass(el, activeClass);
  52069. }
  52070. if (cb.cancelled) {
  52071. if (expectsCSS) {
  52072. removeTransitionClass(el, startClass);
  52073. }
  52074. enterCancelledHook && enterCancelledHook(el);
  52075. } else {
  52076. afterEnterHook && afterEnterHook(el);
  52077. }
  52078. el._enterCb = null;
  52079. });
  52080. if (!vnode.data.show) {
  52081. // remove pending leave element on enter by injecting an insert hook
  52082. mergeVNodeHook(vnode, 'insert', function () {
  52083. var parent = el.parentNode;
  52084. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52085. if (pendingNode &&
  52086. pendingNode.tag === vnode.tag &&
  52087. pendingNode.elm._leaveCb
  52088. ) {
  52089. pendingNode.elm._leaveCb();
  52090. }
  52091. enterHook && enterHook(el, cb);
  52092. });
  52093. }
  52094. // start enter transition
  52095. beforeEnterHook && beforeEnterHook(el);
  52096. if (expectsCSS) {
  52097. addTransitionClass(el, startClass);
  52098. addTransitionClass(el, activeClass);
  52099. nextFrame(function () {
  52100. removeTransitionClass(el, startClass);
  52101. if (!cb.cancelled) {
  52102. addTransitionClass(el, toClass);
  52103. if (!userWantsControl) {
  52104. if (isValidDuration(explicitEnterDuration)) {
  52105. setTimeout(cb, explicitEnterDuration);
  52106. } else {
  52107. whenTransitionEnds(el, type, cb);
  52108. }
  52109. }
  52110. }
  52111. });
  52112. }
  52113. if (vnode.data.show) {
  52114. toggleDisplay && toggleDisplay();
  52115. enterHook && enterHook(el, cb);
  52116. }
  52117. if (!expectsCSS && !userWantsControl) {
  52118. cb();
  52119. }
  52120. }
  52121. function leave (vnode, rm) {
  52122. var el = vnode.elm;
  52123. // call enter callback now
  52124. if (isDef(el._enterCb)) {
  52125. el._enterCb.cancelled = true;
  52126. el._enterCb();
  52127. }
  52128. var data = resolveTransition(vnode.data.transition);
  52129. if (isUndef(data) || el.nodeType !== 1) {
  52130. return rm()
  52131. }
  52132. /* istanbul ignore if */
  52133. if (isDef(el._leaveCb)) {
  52134. return
  52135. }
  52136. var css = data.css;
  52137. var type = data.type;
  52138. var leaveClass = data.leaveClass;
  52139. var leaveToClass = data.leaveToClass;
  52140. var leaveActiveClass = data.leaveActiveClass;
  52141. var beforeLeave = data.beforeLeave;
  52142. var leave = data.leave;
  52143. var afterLeave = data.afterLeave;
  52144. var leaveCancelled = data.leaveCancelled;
  52145. var delayLeave = data.delayLeave;
  52146. var duration = data.duration;
  52147. var expectsCSS = css !== false && !isIE9;
  52148. var userWantsControl = getHookArgumentsLength(leave);
  52149. var explicitLeaveDuration = toNumber(
  52150. isObject(duration)
  52151. ? duration.leave
  52152. : duration
  52153. );
  52154. if (isDef(explicitLeaveDuration)) {
  52155. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52156. }
  52157. var cb = el._leaveCb = once(function () {
  52158. if (el.parentNode && el.parentNode._pending) {
  52159. el.parentNode._pending[vnode.key] = null;
  52160. }
  52161. if (expectsCSS) {
  52162. removeTransitionClass(el, leaveToClass);
  52163. removeTransitionClass(el, leaveActiveClass);
  52164. }
  52165. if (cb.cancelled) {
  52166. if (expectsCSS) {
  52167. removeTransitionClass(el, leaveClass);
  52168. }
  52169. leaveCancelled && leaveCancelled(el);
  52170. } else {
  52171. rm();
  52172. afterLeave && afterLeave(el);
  52173. }
  52174. el._leaveCb = null;
  52175. });
  52176. if (delayLeave) {
  52177. delayLeave(performLeave);
  52178. } else {
  52179. performLeave();
  52180. }
  52181. function performLeave () {
  52182. // the delayed leave may have already been cancelled
  52183. if (cb.cancelled) {
  52184. return
  52185. }
  52186. // record leaving element
  52187. if (!vnode.data.show && el.parentNode) {
  52188. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52189. }
  52190. beforeLeave && beforeLeave(el);
  52191. if (expectsCSS) {
  52192. addTransitionClass(el, leaveClass);
  52193. addTransitionClass(el, leaveActiveClass);
  52194. nextFrame(function () {
  52195. removeTransitionClass(el, leaveClass);
  52196. if (!cb.cancelled) {
  52197. addTransitionClass(el, leaveToClass);
  52198. if (!userWantsControl) {
  52199. if (isValidDuration(explicitLeaveDuration)) {
  52200. setTimeout(cb, explicitLeaveDuration);
  52201. } else {
  52202. whenTransitionEnds(el, type, cb);
  52203. }
  52204. }
  52205. }
  52206. });
  52207. }
  52208. leave && leave(el, cb);
  52209. if (!expectsCSS && !userWantsControl) {
  52210. cb();
  52211. }
  52212. }
  52213. }
  52214. // only used in dev mode
  52215. function checkDuration (val, name, vnode) {
  52216. if (typeof val !== 'number') {
  52217. warn(
  52218. "<transition> explicit " + name + " duration is not a valid number - " +
  52219. "got " + (JSON.stringify(val)) + ".",
  52220. vnode.context
  52221. );
  52222. } else if (isNaN(val)) {
  52223. warn(
  52224. "<transition> explicit " + name + " duration is NaN - " +
  52225. 'the duration expression might be incorrect.',
  52226. vnode.context
  52227. );
  52228. }
  52229. }
  52230. function isValidDuration (val) {
  52231. return typeof val === 'number' && !isNaN(val)
  52232. }
  52233. /**
  52234. * Normalize a transition hook's argument length. The hook may be:
  52235. * - a merged hook (invoker) with the original in .fns
  52236. * - a wrapped component method (check ._length)
  52237. * - a plain function (.length)
  52238. */
  52239. function getHookArgumentsLength (fn) {
  52240. if (isUndef(fn)) {
  52241. return false
  52242. }
  52243. var invokerFns = fn.fns;
  52244. if (isDef(invokerFns)) {
  52245. // invoker
  52246. return getHookArgumentsLength(
  52247. Array.isArray(invokerFns)
  52248. ? invokerFns[0]
  52249. : invokerFns
  52250. )
  52251. } else {
  52252. return (fn._length || fn.length) > 1
  52253. }
  52254. }
  52255. function _enter (_, vnode) {
  52256. if (vnode.data.show !== true) {
  52257. enter(vnode);
  52258. }
  52259. }
  52260. var transition = inBrowser ? {
  52261. create: _enter,
  52262. activate: _enter,
  52263. remove: function remove$$1 (vnode, rm) {
  52264. /* istanbul ignore else */
  52265. if (vnode.data.show !== true) {
  52266. leave(vnode, rm);
  52267. } else {
  52268. rm();
  52269. }
  52270. }
  52271. } : {};
  52272. var platformModules = [
  52273. attrs,
  52274. klass,
  52275. events,
  52276. domProps,
  52277. style,
  52278. transition
  52279. ];
  52280. /* */
  52281. // the directive module should be applied last, after all
  52282. // built-in modules have been applied.
  52283. var modules = platformModules.concat(baseModules);
  52284. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52285. /**
  52286. * Not type checking this file because flow doesn't like attaching
  52287. * properties to Elements.
  52288. */
  52289. /* istanbul ignore if */
  52290. if (isIE9) {
  52291. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52292. document.addEventListener('selectionchange', function () {
  52293. var el = document.activeElement;
  52294. if (el && el.vmodel) {
  52295. trigger(el, 'input');
  52296. }
  52297. });
  52298. }
  52299. var directive = {
  52300. inserted: function inserted (el, binding, vnode, oldVnode) {
  52301. if (vnode.tag === 'select') {
  52302. // #6903
  52303. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52304. mergeVNodeHook(vnode, 'postpatch', function () {
  52305. directive.componentUpdated(el, binding, vnode);
  52306. });
  52307. } else {
  52308. setSelected(el, binding, vnode.context);
  52309. }
  52310. el._vOptions = [].map.call(el.options, getValue);
  52311. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52312. el._vModifiers = binding.modifiers;
  52313. if (!binding.modifiers.lazy) {
  52314. el.addEventListener('compositionstart', onCompositionStart);
  52315. el.addEventListener('compositionend', onCompositionEnd);
  52316. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52317. // switching focus before confirming composition choice
  52318. // this also fixes the issue where some browsers e.g. iOS Chrome
  52319. // fires "change" instead of "input" on autocomplete.
  52320. el.addEventListener('change', onCompositionEnd);
  52321. /* istanbul ignore if */
  52322. if (isIE9) {
  52323. el.vmodel = true;
  52324. }
  52325. }
  52326. }
  52327. },
  52328. componentUpdated: function componentUpdated (el, binding, vnode) {
  52329. if (vnode.tag === 'select') {
  52330. setSelected(el, binding, vnode.context);
  52331. // in case the options rendered by v-for have changed,
  52332. // it's possible that the value is out-of-sync with the rendered options.
  52333. // detect such cases and filter out values that no longer has a matching
  52334. // option in the DOM.
  52335. var prevOptions = el._vOptions;
  52336. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52337. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52338. // trigger change event if
  52339. // no matching option found for at least one value
  52340. var needReset = el.multiple
  52341. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52342. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52343. if (needReset) {
  52344. trigger(el, 'change');
  52345. }
  52346. }
  52347. }
  52348. }
  52349. };
  52350. function setSelected (el, binding, vm) {
  52351. actuallySetSelected(el, binding, vm);
  52352. /* istanbul ignore if */
  52353. if (isIE || isEdge) {
  52354. setTimeout(function () {
  52355. actuallySetSelected(el, binding, vm);
  52356. }, 0);
  52357. }
  52358. }
  52359. function actuallySetSelected (el, binding, vm) {
  52360. var value = binding.value;
  52361. var isMultiple = el.multiple;
  52362. if (isMultiple && !Array.isArray(value)) {
  52363. warn(
  52364. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52365. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52366. vm
  52367. );
  52368. return
  52369. }
  52370. var selected, option;
  52371. for (var i = 0, l = el.options.length; i < l; i++) {
  52372. option = el.options[i];
  52373. if (isMultiple) {
  52374. selected = looseIndexOf(value, getValue(option)) > -1;
  52375. if (option.selected !== selected) {
  52376. option.selected = selected;
  52377. }
  52378. } else {
  52379. if (looseEqual(getValue(option), value)) {
  52380. if (el.selectedIndex !== i) {
  52381. el.selectedIndex = i;
  52382. }
  52383. return
  52384. }
  52385. }
  52386. }
  52387. if (!isMultiple) {
  52388. el.selectedIndex = -1;
  52389. }
  52390. }
  52391. function hasNoMatchingOption (value, options) {
  52392. return options.every(function (o) { return !looseEqual(o, value); })
  52393. }
  52394. function getValue (option) {
  52395. return '_value' in option
  52396. ? option._value
  52397. : option.value
  52398. }
  52399. function onCompositionStart (e) {
  52400. e.target.composing = true;
  52401. }
  52402. function onCompositionEnd (e) {
  52403. // prevent triggering an input event for no reason
  52404. if (!e.target.composing) { return }
  52405. e.target.composing = false;
  52406. trigger(e.target, 'input');
  52407. }
  52408. function trigger (el, type) {
  52409. var e = document.createEvent('HTMLEvents');
  52410. e.initEvent(type, true, true);
  52411. el.dispatchEvent(e);
  52412. }
  52413. /* */
  52414. // recursively search for possible transition defined inside the component root
  52415. function locateNode (vnode) {
  52416. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52417. ? locateNode(vnode.componentInstance._vnode)
  52418. : vnode
  52419. }
  52420. var show = {
  52421. bind: function bind (el, ref, vnode) {
  52422. var value = ref.value;
  52423. vnode = locateNode(vnode);
  52424. var transition$$1 = vnode.data && vnode.data.transition;
  52425. var originalDisplay = el.__vOriginalDisplay =
  52426. el.style.display === 'none' ? '' : el.style.display;
  52427. if (value && transition$$1) {
  52428. vnode.data.show = true;
  52429. enter(vnode, function () {
  52430. el.style.display = originalDisplay;
  52431. });
  52432. } else {
  52433. el.style.display = value ? originalDisplay : 'none';
  52434. }
  52435. },
  52436. update: function update (el, ref, vnode) {
  52437. var value = ref.value;
  52438. var oldValue = ref.oldValue;
  52439. /* istanbul ignore if */
  52440. if (!value === !oldValue) { return }
  52441. vnode = locateNode(vnode);
  52442. var transition$$1 = vnode.data && vnode.data.transition;
  52443. if (transition$$1) {
  52444. vnode.data.show = true;
  52445. if (value) {
  52446. enter(vnode, function () {
  52447. el.style.display = el.__vOriginalDisplay;
  52448. });
  52449. } else {
  52450. leave(vnode, function () {
  52451. el.style.display = 'none';
  52452. });
  52453. }
  52454. } else {
  52455. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52456. }
  52457. },
  52458. unbind: function unbind (
  52459. el,
  52460. binding,
  52461. vnode,
  52462. oldVnode,
  52463. isDestroy
  52464. ) {
  52465. if (!isDestroy) {
  52466. el.style.display = el.__vOriginalDisplay;
  52467. }
  52468. }
  52469. };
  52470. var platformDirectives = {
  52471. model: directive,
  52472. show: show
  52473. };
  52474. /* */
  52475. var transitionProps = {
  52476. name: String,
  52477. appear: Boolean,
  52478. css: Boolean,
  52479. mode: String,
  52480. type: String,
  52481. enterClass: String,
  52482. leaveClass: String,
  52483. enterToClass: String,
  52484. leaveToClass: String,
  52485. enterActiveClass: String,
  52486. leaveActiveClass: String,
  52487. appearClass: String,
  52488. appearActiveClass: String,
  52489. appearToClass: String,
  52490. duration: [Number, String, Object]
  52491. };
  52492. // in case the child is also an abstract component, e.g. <keep-alive>
  52493. // we want to recursively retrieve the real component to be rendered
  52494. function getRealChild (vnode) {
  52495. var compOptions = vnode && vnode.componentOptions;
  52496. if (compOptions && compOptions.Ctor.options.abstract) {
  52497. return getRealChild(getFirstComponentChild(compOptions.children))
  52498. } else {
  52499. return vnode
  52500. }
  52501. }
  52502. function extractTransitionData (comp) {
  52503. var data = {};
  52504. var options = comp.$options;
  52505. // props
  52506. for (var key in options.propsData) {
  52507. data[key] = comp[key];
  52508. }
  52509. // events.
  52510. // extract listeners and pass them directly to the transition methods
  52511. var listeners = options._parentListeners;
  52512. for (var key$1 in listeners) {
  52513. data[camelize(key$1)] = listeners[key$1];
  52514. }
  52515. return data
  52516. }
  52517. function placeholder (h, rawChild) {
  52518. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52519. return h('keep-alive', {
  52520. props: rawChild.componentOptions.propsData
  52521. })
  52522. }
  52523. }
  52524. function hasParentTransition (vnode) {
  52525. while ((vnode = vnode.parent)) {
  52526. if (vnode.data.transition) {
  52527. return true
  52528. }
  52529. }
  52530. }
  52531. function isSameChild (child, oldChild) {
  52532. return oldChild.key === child.key && oldChild.tag === child.tag
  52533. }
  52534. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52535. var isVShowDirective = function (d) { return d.name === 'show'; };
  52536. var Transition = {
  52537. name: 'transition',
  52538. props: transitionProps,
  52539. abstract: true,
  52540. render: function render (h) {
  52541. var this$1 = this;
  52542. var children = this.$slots.default;
  52543. if (!children) {
  52544. return
  52545. }
  52546. // filter out text nodes (possible whitespaces)
  52547. children = children.filter(isNotTextNode);
  52548. /* istanbul ignore if */
  52549. if (!children.length) {
  52550. return
  52551. }
  52552. // warn multiple elements
  52553. if (children.length > 1) {
  52554. warn(
  52555. '<transition> can only be used on a single element. Use ' +
  52556. '<transition-group> for lists.',
  52557. this.$parent
  52558. );
  52559. }
  52560. var mode = this.mode;
  52561. // warn invalid mode
  52562. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52563. ) {
  52564. warn(
  52565. 'invalid <transition> mode: ' + mode,
  52566. this.$parent
  52567. );
  52568. }
  52569. var rawChild = children[0];
  52570. // if this is a component root node and the component's
  52571. // parent container node also has transition, skip.
  52572. if (hasParentTransition(this.$vnode)) {
  52573. return rawChild
  52574. }
  52575. // apply transition data to child
  52576. // use getRealChild() to ignore abstract components e.g. keep-alive
  52577. var child = getRealChild(rawChild);
  52578. /* istanbul ignore if */
  52579. if (!child) {
  52580. return rawChild
  52581. }
  52582. if (this._leaving) {
  52583. return placeholder(h, rawChild)
  52584. }
  52585. // ensure a key that is unique to the vnode type and to this transition
  52586. // component instance. This key will be used to remove pending leaving nodes
  52587. // during entering.
  52588. var id = "__transition-" + (this._uid) + "-";
  52589. child.key = child.key == null
  52590. ? child.isComment
  52591. ? id + 'comment'
  52592. : id + child.tag
  52593. : isPrimitive(child.key)
  52594. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52595. : child.key;
  52596. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52597. var oldRawChild = this._vnode;
  52598. var oldChild = getRealChild(oldRawChild);
  52599. // mark v-show
  52600. // so that the transition module can hand over the control to the directive
  52601. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52602. child.data.show = true;
  52603. }
  52604. if (
  52605. oldChild &&
  52606. oldChild.data &&
  52607. !isSameChild(child, oldChild) &&
  52608. !isAsyncPlaceholder(oldChild) &&
  52609. // #6687 component root is a comment node
  52610. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52611. ) {
  52612. // replace old child transition data with fresh one
  52613. // important for dynamic transitions!
  52614. var oldData = oldChild.data.transition = extend({}, data);
  52615. // handle transition mode
  52616. if (mode === 'out-in') {
  52617. // return placeholder node and queue update when leave finishes
  52618. this._leaving = true;
  52619. mergeVNodeHook(oldData, 'afterLeave', function () {
  52620. this$1._leaving = false;
  52621. this$1.$forceUpdate();
  52622. });
  52623. return placeholder(h, rawChild)
  52624. } else if (mode === 'in-out') {
  52625. if (isAsyncPlaceholder(child)) {
  52626. return oldRawChild
  52627. }
  52628. var delayedLeave;
  52629. var performLeave = function () { delayedLeave(); };
  52630. mergeVNodeHook(data, 'afterEnter', performLeave);
  52631. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52632. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52633. }
  52634. }
  52635. return rawChild
  52636. }
  52637. };
  52638. /* */
  52639. var props = extend({
  52640. tag: String,
  52641. moveClass: String
  52642. }, transitionProps);
  52643. delete props.mode;
  52644. var TransitionGroup = {
  52645. props: props,
  52646. beforeMount: function beforeMount () {
  52647. var this$1 = this;
  52648. var update = this._update;
  52649. this._update = function (vnode, hydrating) {
  52650. var restoreActiveInstance = setActiveInstance(this$1);
  52651. // force removing pass
  52652. this$1.__patch__(
  52653. this$1._vnode,
  52654. this$1.kept,
  52655. false, // hydrating
  52656. true // removeOnly (!important, avoids unnecessary moves)
  52657. );
  52658. this$1._vnode = this$1.kept;
  52659. restoreActiveInstance();
  52660. update.call(this$1, vnode, hydrating);
  52661. };
  52662. },
  52663. render: function render (h) {
  52664. var tag = this.tag || this.$vnode.data.tag || 'span';
  52665. var map = Object.create(null);
  52666. var prevChildren = this.prevChildren = this.children;
  52667. var rawChildren = this.$slots.default || [];
  52668. var children = this.children = [];
  52669. var transitionData = extractTransitionData(this);
  52670. for (var i = 0; i < rawChildren.length; i++) {
  52671. var c = rawChildren[i];
  52672. if (c.tag) {
  52673. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52674. children.push(c);
  52675. map[c.key] = c
  52676. ;(c.data || (c.data = {})).transition = transitionData;
  52677. } else {
  52678. var opts = c.componentOptions;
  52679. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52680. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52681. }
  52682. }
  52683. }
  52684. if (prevChildren) {
  52685. var kept = [];
  52686. var removed = [];
  52687. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52688. var c$1 = prevChildren[i$1];
  52689. c$1.data.transition = transitionData;
  52690. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52691. if (map[c$1.key]) {
  52692. kept.push(c$1);
  52693. } else {
  52694. removed.push(c$1);
  52695. }
  52696. }
  52697. this.kept = h(tag, null, kept);
  52698. this.removed = removed;
  52699. }
  52700. return h(tag, null, children)
  52701. },
  52702. updated: function updated () {
  52703. var children = this.prevChildren;
  52704. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52705. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52706. return
  52707. }
  52708. // we divide the work into three loops to avoid mixing DOM reads and writes
  52709. // in each iteration - which helps prevent layout thrashing.
  52710. children.forEach(callPendingCbs);
  52711. children.forEach(recordPosition);
  52712. children.forEach(applyTranslation);
  52713. // force reflow to put everything in position
  52714. // assign to this to avoid being removed in tree-shaking
  52715. // $flow-disable-line
  52716. this._reflow = document.body.offsetHeight;
  52717. children.forEach(function (c) {
  52718. if (c.data.moved) {
  52719. var el = c.elm;
  52720. var s = el.style;
  52721. addTransitionClass(el, moveClass);
  52722. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52723. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52724. if (e && e.target !== el) {
  52725. return
  52726. }
  52727. if (!e || /transform$/.test(e.propertyName)) {
  52728. el.removeEventListener(transitionEndEvent, cb);
  52729. el._moveCb = null;
  52730. removeTransitionClass(el, moveClass);
  52731. }
  52732. });
  52733. }
  52734. });
  52735. },
  52736. methods: {
  52737. hasMove: function hasMove (el, moveClass) {
  52738. /* istanbul ignore if */
  52739. if (!hasTransition) {
  52740. return false
  52741. }
  52742. /* istanbul ignore if */
  52743. if (this._hasMove) {
  52744. return this._hasMove
  52745. }
  52746. // Detect whether an element with the move class applied has
  52747. // CSS transitions. Since the element may be inside an entering
  52748. // transition at this very moment, we make a clone of it and remove
  52749. // all other transition classes applied to ensure only the move class
  52750. // is applied.
  52751. var clone = el.cloneNode();
  52752. if (el._transitionClasses) {
  52753. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52754. }
  52755. addClass(clone, moveClass);
  52756. clone.style.display = 'none';
  52757. this.$el.appendChild(clone);
  52758. var info = getTransitionInfo(clone);
  52759. this.$el.removeChild(clone);
  52760. return (this._hasMove = info.hasTransform)
  52761. }
  52762. }
  52763. };
  52764. function callPendingCbs (c) {
  52765. /* istanbul ignore if */
  52766. if (c.elm._moveCb) {
  52767. c.elm._moveCb();
  52768. }
  52769. /* istanbul ignore if */
  52770. if (c.elm._enterCb) {
  52771. c.elm._enterCb();
  52772. }
  52773. }
  52774. function recordPosition (c) {
  52775. c.data.newPos = c.elm.getBoundingClientRect();
  52776. }
  52777. function applyTranslation (c) {
  52778. var oldPos = c.data.pos;
  52779. var newPos = c.data.newPos;
  52780. var dx = oldPos.left - newPos.left;
  52781. var dy = oldPos.top - newPos.top;
  52782. if (dx || dy) {
  52783. c.data.moved = true;
  52784. var s = c.elm.style;
  52785. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52786. s.transitionDuration = '0s';
  52787. }
  52788. }
  52789. var platformComponents = {
  52790. Transition: Transition,
  52791. TransitionGroup: TransitionGroup
  52792. };
  52793. /* */
  52794. // install platform specific utils
  52795. Vue.config.mustUseProp = mustUseProp;
  52796. Vue.config.isReservedTag = isReservedTag;
  52797. Vue.config.isReservedAttr = isReservedAttr;
  52798. Vue.config.getTagNamespace = getTagNamespace;
  52799. Vue.config.isUnknownElement = isUnknownElement;
  52800. // install platform runtime directives & components
  52801. extend(Vue.options.directives, platformDirectives);
  52802. extend(Vue.options.components, platformComponents);
  52803. // install platform patch function
  52804. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52805. // public mount method
  52806. Vue.prototype.$mount = function (
  52807. el,
  52808. hydrating
  52809. ) {
  52810. el = el && inBrowser ? query(el) : undefined;
  52811. return mountComponent(this, el, hydrating)
  52812. };
  52813. // devtools global hook
  52814. /* istanbul ignore next */
  52815. if (inBrowser) {
  52816. setTimeout(function () {
  52817. if (config.devtools) {
  52818. if (devtools) {
  52819. devtools.emit('init', Vue);
  52820. } else {
  52821. console[console.info ? 'info' : 'log'](
  52822. 'Download the Vue Devtools extension for a better development experience:\n' +
  52823. 'https://github.com/vuejs/vue-devtools'
  52824. );
  52825. }
  52826. }
  52827. if (config.productionTip !== false &&
  52828. typeof console !== 'undefined'
  52829. ) {
  52830. console[console.info ? 'info' : 'log'](
  52831. "You are running Vue in development mode.\n" +
  52832. "Make sure to turn on production mode when deploying for production.\n" +
  52833. "See more tips at https://vuejs.org/guide/deployment.html"
  52834. );
  52835. }
  52836. }, 0);
  52837. }
  52838. /* */
  52839. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52840. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52841. var buildRegex = cached(function (delimiters) {
  52842. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52843. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52844. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52845. });
  52846. function parseText (
  52847. text,
  52848. delimiters
  52849. ) {
  52850. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52851. if (!tagRE.test(text)) {
  52852. return
  52853. }
  52854. var tokens = [];
  52855. var rawTokens = [];
  52856. var lastIndex = tagRE.lastIndex = 0;
  52857. var match, index, tokenValue;
  52858. while ((match = tagRE.exec(text))) {
  52859. index = match.index;
  52860. // push text token
  52861. if (index > lastIndex) {
  52862. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52863. tokens.push(JSON.stringify(tokenValue));
  52864. }
  52865. // tag token
  52866. var exp = parseFilters(match[1].trim());
  52867. tokens.push(("_s(" + exp + ")"));
  52868. rawTokens.push({ '@binding': exp });
  52869. lastIndex = index + match[0].length;
  52870. }
  52871. if (lastIndex < text.length) {
  52872. rawTokens.push(tokenValue = text.slice(lastIndex));
  52873. tokens.push(JSON.stringify(tokenValue));
  52874. }
  52875. return {
  52876. expression: tokens.join('+'),
  52877. tokens: rawTokens
  52878. }
  52879. }
  52880. /* */
  52881. function transformNode (el, options) {
  52882. var warn = options.warn || baseWarn;
  52883. var staticClass = getAndRemoveAttr(el, 'class');
  52884. if (staticClass) {
  52885. var res = parseText(staticClass, options.delimiters);
  52886. if (res) {
  52887. warn(
  52888. "class=\"" + staticClass + "\": " +
  52889. 'Interpolation inside attributes has been removed. ' +
  52890. 'Use v-bind or the colon shorthand instead. For example, ' +
  52891. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52892. el.rawAttrsMap['class']
  52893. );
  52894. }
  52895. }
  52896. if (staticClass) {
  52897. el.staticClass = JSON.stringify(staticClass);
  52898. }
  52899. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52900. if (classBinding) {
  52901. el.classBinding = classBinding;
  52902. }
  52903. }
  52904. function genData (el) {
  52905. var data = '';
  52906. if (el.staticClass) {
  52907. data += "staticClass:" + (el.staticClass) + ",";
  52908. }
  52909. if (el.classBinding) {
  52910. data += "class:" + (el.classBinding) + ",";
  52911. }
  52912. return data
  52913. }
  52914. var klass$1 = {
  52915. staticKeys: ['staticClass'],
  52916. transformNode: transformNode,
  52917. genData: genData
  52918. };
  52919. /* */
  52920. function transformNode$1 (el, options) {
  52921. var warn = options.warn || baseWarn;
  52922. var staticStyle = getAndRemoveAttr(el, 'style');
  52923. if (staticStyle) {
  52924. /* istanbul ignore if */
  52925. {
  52926. var res = parseText(staticStyle, options.delimiters);
  52927. if (res) {
  52928. warn(
  52929. "style=\"" + staticStyle + "\": " +
  52930. 'Interpolation inside attributes has been removed. ' +
  52931. 'Use v-bind or the colon shorthand instead. For example, ' +
  52932. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52933. el.rawAttrsMap['style']
  52934. );
  52935. }
  52936. }
  52937. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52938. }
  52939. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52940. if (styleBinding) {
  52941. el.styleBinding = styleBinding;
  52942. }
  52943. }
  52944. function genData$1 (el) {
  52945. var data = '';
  52946. if (el.staticStyle) {
  52947. data += "staticStyle:" + (el.staticStyle) + ",";
  52948. }
  52949. if (el.styleBinding) {
  52950. data += "style:(" + (el.styleBinding) + "),";
  52951. }
  52952. return data
  52953. }
  52954. var style$1 = {
  52955. staticKeys: ['staticStyle'],
  52956. transformNode: transformNode$1,
  52957. genData: genData$1
  52958. };
  52959. /* */
  52960. var decoder;
  52961. var he = {
  52962. decode: function decode (html) {
  52963. decoder = decoder || document.createElement('div');
  52964. decoder.innerHTML = html;
  52965. return decoder.textContent
  52966. }
  52967. };
  52968. /* */
  52969. var isUnaryTag = makeMap(
  52970. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52971. 'link,meta,param,source,track,wbr'
  52972. );
  52973. // Elements that you can, intentionally, leave open
  52974. // (and which close themselves)
  52975. var canBeLeftOpenTag = makeMap(
  52976. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52977. );
  52978. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52979. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52980. var isNonPhrasingTag = makeMap(
  52981. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52982. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52983. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52984. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52985. 'title,tr,track'
  52986. );
  52987. /**
  52988. * Not type-checking this file because it's mostly vendor code.
  52989. */
  52990. // Regular Expressions for parsing tags and attributes
  52991. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52992. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52993. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52994. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52995. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52996. var startTagClose = /^\s*(\/?)>/;
  52997. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52998. var doctype = /^<!DOCTYPE [^>]+>/i;
  52999. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  53000. var comment = /^<!\--/;
  53001. var conditionalComment = /^<!\[/;
  53002. // Special Elements (can contain anything)
  53003. var isPlainTextElement = makeMap('script,style,textarea', true);
  53004. var reCache = {};
  53005. var decodingMap = {
  53006. '&lt;': '<',
  53007. '&gt;': '>',
  53008. '&quot;': '"',
  53009. '&amp;': '&',
  53010. '&#10;': '\n',
  53011. '&#9;': '\t',
  53012. '&#39;': "'"
  53013. };
  53014. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53015. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53016. // #5992
  53017. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53018. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53019. function decodeAttr (value, shouldDecodeNewlines) {
  53020. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53021. return value.replace(re, function (match) { return decodingMap[match]; })
  53022. }
  53023. function parseHTML (html, options) {
  53024. var stack = [];
  53025. var expectHTML = options.expectHTML;
  53026. var isUnaryTag$$1 = options.isUnaryTag || no;
  53027. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53028. var index = 0;
  53029. var last, lastTag;
  53030. while (html) {
  53031. last = html;
  53032. // Make sure we're not in a plaintext content element like script/style
  53033. if (!lastTag || !isPlainTextElement(lastTag)) {
  53034. var textEnd = html.indexOf('<');
  53035. if (textEnd === 0) {
  53036. // Comment:
  53037. if (comment.test(html)) {
  53038. var commentEnd = html.indexOf('-->');
  53039. if (commentEnd >= 0) {
  53040. if (options.shouldKeepComment) {
  53041. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53042. }
  53043. advance(commentEnd + 3);
  53044. continue
  53045. }
  53046. }
  53047. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53048. if (conditionalComment.test(html)) {
  53049. var conditionalEnd = html.indexOf(']>');
  53050. if (conditionalEnd >= 0) {
  53051. advance(conditionalEnd + 2);
  53052. continue
  53053. }
  53054. }
  53055. // Doctype:
  53056. var doctypeMatch = html.match(doctype);
  53057. if (doctypeMatch) {
  53058. advance(doctypeMatch[0].length);
  53059. continue
  53060. }
  53061. // End tag:
  53062. var endTagMatch = html.match(endTag);
  53063. if (endTagMatch) {
  53064. var curIndex = index;
  53065. advance(endTagMatch[0].length);
  53066. parseEndTag(endTagMatch[1], curIndex, index);
  53067. continue
  53068. }
  53069. // Start tag:
  53070. var startTagMatch = parseStartTag();
  53071. if (startTagMatch) {
  53072. handleStartTag(startTagMatch);
  53073. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53074. advance(1);
  53075. }
  53076. continue
  53077. }
  53078. }
  53079. var text = (void 0), rest = (void 0), next = (void 0);
  53080. if (textEnd >= 0) {
  53081. rest = html.slice(textEnd);
  53082. while (
  53083. !endTag.test(rest) &&
  53084. !startTagOpen.test(rest) &&
  53085. !comment.test(rest) &&
  53086. !conditionalComment.test(rest)
  53087. ) {
  53088. // < in plain text, be forgiving and treat it as text
  53089. next = rest.indexOf('<', 1);
  53090. if (next < 0) { break }
  53091. textEnd += next;
  53092. rest = html.slice(textEnd);
  53093. }
  53094. text = html.substring(0, textEnd);
  53095. }
  53096. if (textEnd < 0) {
  53097. text = html;
  53098. }
  53099. if (text) {
  53100. advance(text.length);
  53101. }
  53102. if (options.chars && text) {
  53103. options.chars(text, index - text.length, index);
  53104. }
  53105. } else {
  53106. var endTagLength = 0;
  53107. var stackedTag = lastTag.toLowerCase();
  53108. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53109. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53110. endTagLength = endTag.length;
  53111. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53112. text = text
  53113. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53114. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53115. }
  53116. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53117. text = text.slice(1);
  53118. }
  53119. if (options.chars) {
  53120. options.chars(text);
  53121. }
  53122. return ''
  53123. });
  53124. index += html.length - rest$1.length;
  53125. html = rest$1;
  53126. parseEndTag(stackedTag, index - endTagLength, index);
  53127. }
  53128. if (html === last) {
  53129. options.chars && options.chars(html);
  53130. if (!stack.length && options.warn) {
  53131. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53132. }
  53133. break
  53134. }
  53135. }
  53136. // Clean up any remaining tags
  53137. parseEndTag();
  53138. function advance (n) {
  53139. index += n;
  53140. html = html.substring(n);
  53141. }
  53142. function parseStartTag () {
  53143. var start = html.match(startTagOpen);
  53144. if (start) {
  53145. var match = {
  53146. tagName: start[1],
  53147. attrs: [],
  53148. start: index
  53149. };
  53150. advance(start[0].length);
  53151. var end, attr;
  53152. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53153. attr.start = index;
  53154. advance(attr[0].length);
  53155. attr.end = index;
  53156. match.attrs.push(attr);
  53157. }
  53158. if (end) {
  53159. match.unarySlash = end[1];
  53160. advance(end[0].length);
  53161. match.end = index;
  53162. return match
  53163. }
  53164. }
  53165. }
  53166. function handleStartTag (match) {
  53167. var tagName = match.tagName;
  53168. var unarySlash = match.unarySlash;
  53169. if (expectHTML) {
  53170. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53171. parseEndTag(lastTag);
  53172. }
  53173. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53174. parseEndTag(tagName);
  53175. }
  53176. }
  53177. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53178. var l = match.attrs.length;
  53179. var attrs = new Array(l);
  53180. for (var i = 0; i < l; i++) {
  53181. var args = match.attrs[i];
  53182. var value = args[3] || args[4] || args[5] || '';
  53183. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53184. ? options.shouldDecodeNewlinesForHref
  53185. : options.shouldDecodeNewlines;
  53186. attrs[i] = {
  53187. name: args[1],
  53188. value: decodeAttr(value, shouldDecodeNewlines)
  53189. };
  53190. if (options.outputSourceRange) {
  53191. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53192. attrs[i].end = args.end;
  53193. }
  53194. }
  53195. if (!unary) {
  53196. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53197. lastTag = tagName;
  53198. }
  53199. if (options.start) {
  53200. options.start(tagName, attrs, unary, match.start, match.end);
  53201. }
  53202. }
  53203. function parseEndTag (tagName, start, end) {
  53204. var pos, lowerCasedTagName;
  53205. if (start == null) { start = index; }
  53206. if (end == null) { end = index; }
  53207. // Find the closest opened tag of the same type
  53208. if (tagName) {
  53209. lowerCasedTagName = tagName.toLowerCase();
  53210. for (pos = stack.length - 1; pos >= 0; pos--) {
  53211. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53212. break
  53213. }
  53214. }
  53215. } else {
  53216. // If no tag name is provided, clean shop
  53217. pos = 0;
  53218. }
  53219. if (pos >= 0) {
  53220. // Close all the open elements, up the stack
  53221. for (var i = stack.length - 1; i >= pos; i--) {
  53222. if (i > pos || !tagName &&
  53223. options.warn
  53224. ) {
  53225. options.warn(
  53226. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53227. { start: stack[i].start, end: stack[i].end }
  53228. );
  53229. }
  53230. if (options.end) {
  53231. options.end(stack[i].tag, start, end);
  53232. }
  53233. }
  53234. // Remove the open elements from the stack
  53235. stack.length = pos;
  53236. lastTag = pos && stack[pos - 1].tag;
  53237. } else if (lowerCasedTagName === 'br') {
  53238. if (options.start) {
  53239. options.start(tagName, [], true, start, end);
  53240. }
  53241. } else if (lowerCasedTagName === 'p') {
  53242. if (options.start) {
  53243. options.start(tagName, [], false, start, end);
  53244. }
  53245. if (options.end) {
  53246. options.end(tagName, start, end);
  53247. }
  53248. }
  53249. }
  53250. }
  53251. /* */
  53252. var onRE = /^@|^v-on:/;
  53253. var dirRE = /^v-|^@|^:|^#/;
  53254. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53255. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53256. var stripParensRE = /^\(|\)$/g;
  53257. var dynamicArgRE = /^\[.*\]$/;
  53258. var argRE = /:(.*)$/;
  53259. var bindRE = /^:|^\.|^v-bind:/;
  53260. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53261. var slotRE = /^v-slot(:|$)|^#/;
  53262. var lineBreakRE = /[\r\n]/;
  53263. var whitespaceRE$1 = /\s+/g;
  53264. var invalidAttributeRE = /[\s"'<>\/=]/;
  53265. var decodeHTMLCached = cached(he.decode);
  53266. var emptySlotScopeToken = "_empty_";
  53267. // configurable state
  53268. var warn$2;
  53269. var delimiters;
  53270. var transforms;
  53271. var preTransforms;
  53272. var postTransforms;
  53273. var platformIsPreTag;
  53274. var platformMustUseProp;
  53275. var platformGetTagNamespace;
  53276. var maybeComponent;
  53277. function createASTElement (
  53278. tag,
  53279. attrs,
  53280. parent
  53281. ) {
  53282. return {
  53283. type: 1,
  53284. tag: tag,
  53285. attrsList: attrs,
  53286. attrsMap: makeAttrsMap(attrs),
  53287. rawAttrsMap: {},
  53288. parent: parent,
  53289. children: []
  53290. }
  53291. }
  53292. /**
  53293. * Convert HTML string to AST.
  53294. */
  53295. function parse (
  53296. template,
  53297. options
  53298. ) {
  53299. warn$2 = options.warn || baseWarn;
  53300. platformIsPreTag = options.isPreTag || no;
  53301. platformMustUseProp = options.mustUseProp || no;
  53302. platformGetTagNamespace = options.getTagNamespace || no;
  53303. var isReservedTag = options.isReservedTag || no;
  53304. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53305. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53306. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53307. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53308. delimiters = options.delimiters;
  53309. var stack = [];
  53310. var preserveWhitespace = options.preserveWhitespace !== false;
  53311. var whitespaceOption = options.whitespace;
  53312. var root;
  53313. var currentParent;
  53314. var inVPre = false;
  53315. var inPre = false;
  53316. var warned = false;
  53317. function warnOnce (msg, range) {
  53318. if (!warned) {
  53319. warned = true;
  53320. warn$2(msg, range);
  53321. }
  53322. }
  53323. function closeElement (element) {
  53324. trimEndingWhitespace(element);
  53325. if (!inVPre && !element.processed) {
  53326. element = processElement(element, options);
  53327. }
  53328. // tree management
  53329. if (!stack.length && element !== root) {
  53330. // allow root elements with v-if, v-else-if and v-else
  53331. if (root.if && (element.elseif || element.else)) {
  53332. {
  53333. checkRootConstraints(element);
  53334. }
  53335. addIfCondition(root, {
  53336. exp: element.elseif,
  53337. block: element
  53338. });
  53339. } else {
  53340. warnOnce(
  53341. "Component template should contain exactly one root element. " +
  53342. "If you are using v-if on multiple elements, " +
  53343. "use v-else-if to chain them instead.",
  53344. { start: element.start }
  53345. );
  53346. }
  53347. }
  53348. if (currentParent && !element.forbidden) {
  53349. if (element.elseif || element.else) {
  53350. processIfConditions(element, currentParent);
  53351. } else {
  53352. if (element.slotScope) {
  53353. // scoped slot
  53354. // keep it in the children list so that v-else(-if) conditions can
  53355. // find it as the prev node.
  53356. var name = element.slotTarget || '"default"'
  53357. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53358. }
  53359. currentParent.children.push(element);
  53360. element.parent = currentParent;
  53361. }
  53362. }
  53363. // final children cleanup
  53364. // filter out scoped slots
  53365. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53366. // remove trailing whitespace node again
  53367. trimEndingWhitespace(element);
  53368. // check pre state
  53369. if (element.pre) {
  53370. inVPre = false;
  53371. }
  53372. if (platformIsPreTag(element.tag)) {
  53373. inPre = false;
  53374. }
  53375. // apply post-transforms
  53376. for (var i = 0; i < postTransforms.length; i++) {
  53377. postTransforms[i](element, options);
  53378. }
  53379. }
  53380. function trimEndingWhitespace (el) {
  53381. // remove trailing whitespace node
  53382. if (!inPre) {
  53383. var lastNode;
  53384. while (
  53385. (lastNode = el.children[el.children.length - 1]) &&
  53386. lastNode.type === 3 &&
  53387. lastNode.text === ' '
  53388. ) {
  53389. el.children.pop();
  53390. }
  53391. }
  53392. }
  53393. function checkRootConstraints (el) {
  53394. if (el.tag === 'slot' || el.tag === 'template') {
  53395. warnOnce(
  53396. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53397. 'contain multiple nodes.',
  53398. { start: el.start }
  53399. );
  53400. }
  53401. if (el.attrsMap.hasOwnProperty('v-for')) {
  53402. warnOnce(
  53403. 'Cannot use v-for on stateful component root element because ' +
  53404. 'it renders multiple elements.',
  53405. el.rawAttrsMap['v-for']
  53406. );
  53407. }
  53408. }
  53409. parseHTML(template, {
  53410. warn: warn$2,
  53411. expectHTML: options.expectHTML,
  53412. isUnaryTag: options.isUnaryTag,
  53413. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53414. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53415. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53416. shouldKeepComment: options.comments,
  53417. outputSourceRange: options.outputSourceRange,
  53418. start: function start (tag, attrs, unary, start$1, end) {
  53419. // check namespace.
  53420. // inherit parent ns if there is one
  53421. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53422. // handle IE svg bug
  53423. /* istanbul ignore if */
  53424. if (isIE && ns === 'svg') {
  53425. attrs = guardIESVGBug(attrs);
  53426. }
  53427. var element = createASTElement(tag, attrs, currentParent);
  53428. if (ns) {
  53429. element.ns = ns;
  53430. }
  53431. {
  53432. if (options.outputSourceRange) {
  53433. element.start = start$1;
  53434. element.end = end;
  53435. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53436. cumulated[attr.name] = attr;
  53437. return cumulated
  53438. }, {});
  53439. }
  53440. attrs.forEach(function (attr) {
  53441. if (invalidAttributeRE.test(attr.name)) {
  53442. warn$2(
  53443. "Invalid dynamic argument expression: attribute names cannot contain " +
  53444. "spaces, quotes, <, >, / or =.",
  53445. {
  53446. start: attr.start + attr.name.indexOf("["),
  53447. end: attr.start + attr.name.length
  53448. }
  53449. );
  53450. }
  53451. });
  53452. }
  53453. if (isForbiddenTag(element) && !isServerRendering()) {
  53454. element.forbidden = true;
  53455. warn$2(
  53456. 'Templates should only be responsible for mapping the state to the ' +
  53457. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53458. "<" + tag + ">" + ', as they will not be parsed.',
  53459. { start: element.start }
  53460. );
  53461. }
  53462. // apply pre-transforms
  53463. for (var i = 0; i < preTransforms.length; i++) {
  53464. element = preTransforms[i](element, options) || element;
  53465. }
  53466. if (!inVPre) {
  53467. processPre(element);
  53468. if (element.pre) {
  53469. inVPre = true;
  53470. }
  53471. }
  53472. if (platformIsPreTag(element.tag)) {
  53473. inPre = true;
  53474. }
  53475. if (inVPre) {
  53476. processRawAttrs(element);
  53477. } else if (!element.processed) {
  53478. // structural directives
  53479. processFor(element);
  53480. processIf(element);
  53481. processOnce(element);
  53482. }
  53483. if (!root) {
  53484. root = element;
  53485. {
  53486. checkRootConstraints(root);
  53487. }
  53488. }
  53489. if (!unary) {
  53490. currentParent = element;
  53491. stack.push(element);
  53492. } else {
  53493. closeElement(element);
  53494. }
  53495. },
  53496. end: function end (tag, start, end$1) {
  53497. var element = stack[stack.length - 1];
  53498. // pop stack
  53499. stack.length -= 1;
  53500. currentParent = stack[stack.length - 1];
  53501. if (options.outputSourceRange) {
  53502. element.end = end$1;
  53503. }
  53504. closeElement(element);
  53505. },
  53506. chars: function chars (text, start, end) {
  53507. if (!currentParent) {
  53508. {
  53509. if (text === template) {
  53510. warnOnce(
  53511. 'Component template requires a root element, rather than just text.',
  53512. { start: start }
  53513. );
  53514. } else if ((text = text.trim())) {
  53515. warnOnce(
  53516. ("text \"" + text + "\" outside root element will be ignored."),
  53517. { start: start }
  53518. );
  53519. }
  53520. }
  53521. return
  53522. }
  53523. // IE textarea placeholder bug
  53524. /* istanbul ignore if */
  53525. if (isIE &&
  53526. currentParent.tag === 'textarea' &&
  53527. currentParent.attrsMap.placeholder === text
  53528. ) {
  53529. return
  53530. }
  53531. var children = currentParent.children;
  53532. if (inPre || text.trim()) {
  53533. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53534. } else if (!children.length) {
  53535. // remove the whitespace-only node right after an opening tag
  53536. text = '';
  53537. } else if (whitespaceOption) {
  53538. if (whitespaceOption === 'condense') {
  53539. // in condense mode, remove the whitespace node if it contains
  53540. // line break, otherwise condense to a single space
  53541. text = lineBreakRE.test(text) ? '' : ' ';
  53542. } else {
  53543. text = ' ';
  53544. }
  53545. } else {
  53546. text = preserveWhitespace ? ' ' : '';
  53547. }
  53548. if (text) {
  53549. if (!inPre && whitespaceOption === 'condense') {
  53550. // condense consecutive whitespaces into single space
  53551. text = text.replace(whitespaceRE$1, ' ');
  53552. }
  53553. var res;
  53554. var child;
  53555. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53556. child = {
  53557. type: 2,
  53558. expression: res.expression,
  53559. tokens: res.tokens,
  53560. text: text
  53561. };
  53562. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53563. child = {
  53564. type: 3,
  53565. text: text
  53566. };
  53567. }
  53568. if (child) {
  53569. if (options.outputSourceRange) {
  53570. child.start = start;
  53571. child.end = end;
  53572. }
  53573. children.push(child);
  53574. }
  53575. }
  53576. },
  53577. comment: function comment (text, start, end) {
  53578. // adding anyting as a sibling to the root node is forbidden
  53579. // comments should still be allowed, but ignored
  53580. if (currentParent) {
  53581. var child = {
  53582. type: 3,
  53583. text: text,
  53584. isComment: true
  53585. };
  53586. if (options.outputSourceRange) {
  53587. child.start = start;
  53588. child.end = end;
  53589. }
  53590. currentParent.children.push(child);
  53591. }
  53592. }
  53593. });
  53594. return root
  53595. }
  53596. function processPre (el) {
  53597. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53598. el.pre = true;
  53599. }
  53600. }
  53601. function processRawAttrs (el) {
  53602. var list = el.attrsList;
  53603. var len = list.length;
  53604. if (len) {
  53605. var attrs = el.attrs = new Array(len);
  53606. for (var i = 0; i < len; i++) {
  53607. attrs[i] = {
  53608. name: list[i].name,
  53609. value: JSON.stringify(list[i].value)
  53610. };
  53611. if (list[i].start != null) {
  53612. attrs[i].start = list[i].start;
  53613. attrs[i].end = list[i].end;
  53614. }
  53615. }
  53616. } else if (!el.pre) {
  53617. // non root node in pre blocks with no attributes
  53618. el.plain = true;
  53619. }
  53620. }
  53621. function processElement (
  53622. element,
  53623. options
  53624. ) {
  53625. processKey(element);
  53626. // determine whether this is a plain element after
  53627. // removing structural attributes
  53628. element.plain = (
  53629. !element.key &&
  53630. !element.scopedSlots &&
  53631. !element.attrsList.length
  53632. );
  53633. processRef(element);
  53634. processSlotContent(element);
  53635. processSlotOutlet(element);
  53636. processComponent(element);
  53637. for (var i = 0; i < transforms.length; i++) {
  53638. element = transforms[i](element, options) || element;
  53639. }
  53640. processAttrs(element);
  53641. return element
  53642. }
  53643. function processKey (el) {
  53644. var exp = getBindingAttr(el, 'key');
  53645. if (exp) {
  53646. {
  53647. if (el.tag === 'template') {
  53648. warn$2(
  53649. "<template> cannot be keyed. Place the key on real elements instead.",
  53650. getRawBindingAttr(el, 'key')
  53651. );
  53652. }
  53653. if (el.for) {
  53654. var iterator = el.iterator2 || el.iterator1;
  53655. var parent = el.parent;
  53656. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53657. warn$2(
  53658. "Do not use v-for index as key on <transition-group> children, " +
  53659. "this is the same as not using keys.",
  53660. getRawBindingAttr(el, 'key'),
  53661. true /* tip */
  53662. );
  53663. }
  53664. }
  53665. }
  53666. el.key = exp;
  53667. }
  53668. }
  53669. function processRef (el) {
  53670. var ref = getBindingAttr(el, 'ref');
  53671. if (ref) {
  53672. el.ref = ref;
  53673. el.refInFor = checkInFor(el);
  53674. }
  53675. }
  53676. function processFor (el) {
  53677. var exp;
  53678. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53679. var res = parseFor(exp);
  53680. if (res) {
  53681. extend(el, res);
  53682. } else {
  53683. warn$2(
  53684. ("Invalid v-for expression: " + exp),
  53685. el.rawAttrsMap['v-for']
  53686. );
  53687. }
  53688. }
  53689. }
  53690. function parseFor (exp) {
  53691. var inMatch = exp.match(forAliasRE);
  53692. if (!inMatch) { return }
  53693. var res = {};
  53694. res.for = inMatch[2].trim();
  53695. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53696. var iteratorMatch = alias.match(forIteratorRE);
  53697. if (iteratorMatch) {
  53698. res.alias = alias.replace(forIteratorRE, '').trim();
  53699. res.iterator1 = iteratorMatch[1].trim();
  53700. if (iteratorMatch[2]) {
  53701. res.iterator2 = iteratorMatch[2].trim();
  53702. }
  53703. } else {
  53704. res.alias = alias;
  53705. }
  53706. return res
  53707. }
  53708. function processIf (el) {
  53709. var exp = getAndRemoveAttr(el, 'v-if');
  53710. if (exp) {
  53711. el.if = exp;
  53712. addIfCondition(el, {
  53713. exp: exp,
  53714. block: el
  53715. });
  53716. } else {
  53717. if (getAndRemoveAttr(el, 'v-else') != null) {
  53718. el.else = true;
  53719. }
  53720. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53721. if (elseif) {
  53722. el.elseif = elseif;
  53723. }
  53724. }
  53725. }
  53726. function processIfConditions (el, parent) {
  53727. var prev = findPrevElement(parent.children);
  53728. if (prev && prev.if) {
  53729. addIfCondition(prev, {
  53730. exp: el.elseif,
  53731. block: el
  53732. });
  53733. } else {
  53734. warn$2(
  53735. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53736. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53737. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53738. );
  53739. }
  53740. }
  53741. function findPrevElement (children) {
  53742. var i = children.length;
  53743. while (i--) {
  53744. if (children[i].type === 1) {
  53745. return children[i]
  53746. } else {
  53747. if (children[i].text !== ' ') {
  53748. warn$2(
  53749. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53750. "will be ignored.",
  53751. children[i]
  53752. );
  53753. }
  53754. children.pop();
  53755. }
  53756. }
  53757. }
  53758. function addIfCondition (el, condition) {
  53759. if (!el.ifConditions) {
  53760. el.ifConditions = [];
  53761. }
  53762. el.ifConditions.push(condition);
  53763. }
  53764. function processOnce (el) {
  53765. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53766. if (once$$1 != null) {
  53767. el.once = true;
  53768. }
  53769. }
  53770. // handle content being passed to a component as slot,
  53771. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53772. function processSlotContent (el) {
  53773. var slotScope;
  53774. if (el.tag === 'template') {
  53775. slotScope = getAndRemoveAttr(el, 'scope');
  53776. /* istanbul ignore if */
  53777. if (slotScope) {
  53778. warn$2(
  53779. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53780. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53781. "can also be used on plain elements in addition to <template> to " +
  53782. "denote scoped slots.",
  53783. el.rawAttrsMap['scope'],
  53784. true
  53785. );
  53786. }
  53787. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53788. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53789. /* istanbul ignore if */
  53790. if (el.attrsMap['v-for']) {
  53791. warn$2(
  53792. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53793. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53794. "scoped slot to make it clearer.",
  53795. el.rawAttrsMap['slot-scope'],
  53796. true
  53797. );
  53798. }
  53799. el.slotScope = slotScope;
  53800. }
  53801. // slot="xxx"
  53802. var slotTarget = getBindingAttr(el, 'slot');
  53803. if (slotTarget) {
  53804. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53805. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53806. // preserve slot as an attribute for native shadow DOM compat
  53807. // only for non-scoped slots.
  53808. if (el.tag !== 'template' && !el.slotScope) {
  53809. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53810. }
  53811. }
  53812. // 2.6 v-slot syntax
  53813. {
  53814. if (el.tag === 'template') {
  53815. // v-slot on <template>
  53816. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53817. if (slotBinding) {
  53818. {
  53819. if (el.slotTarget || el.slotScope) {
  53820. warn$2(
  53821. "Unexpected mixed usage of different slot syntaxes.",
  53822. el
  53823. );
  53824. }
  53825. if (el.parent && !maybeComponent(el.parent)) {
  53826. warn$2(
  53827. "<template v-slot> can only appear at the root level inside " +
  53828. "the receiving component",
  53829. el
  53830. );
  53831. }
  53832. }
  53833. var ref = getSlotName(slotBinding);
  53834. var name = ref.name;
  53835. var dynamic = ref.dynamic;
  53836. el.slotTarget = name;
  53837. el.slotTargetDynamic = dynamic;
  53838. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53839. }
  53840. } else {
  53841. // v-slot on component, denotes default slot
  53842. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53843. if (slotBinding$1) {
  53844. {
  53845. if (!maybeComponent(el)) {
  53846. warn$2(
  53847. "v-slot can only be used on components or <template>.",
  53848. slotBinding$1
  53849. );
  53850. }
  53851. if (el.slotScope || el.slotTarget) {
  53852. warn$2(
  53853. "Unexpected mixed usage of different slot syntaxes.",
  53854. el
  53855. );
  53856. }
  53857. if (el.scopedSlots) {
  53858. warn$2(
  53859. "To avoid scope ambiguity, the default slot should also use " +
  53860. "<template> syntax when there are other named slots.",
  53861. slotBinding$1
  53862. );
  53863. }
  53864. }
  53865. // add the component's children to its default slot
  53866. var slots = el.scopedSlots || (el.scopedSlots = {});
  53867. var ref$1 = getSlotName(slotBinding$1);
  53868. var name$1 = ref$1.name;
  53869. var dynamic$1 = ref$1.dynamic;
  53870. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53871. slotContainer.slotTarget = name$1;
  53872. slotContainer.slotTargetDynamic = dynamic$1;
  53873. slotContainer.children = el.children.filter(function (c) {
  53874. if (!c.slotScope) {
  53875. c.parent = slotContainer;
  53876. return true
  53877. }
  53878. });
  53879. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53880. // remove children as they are returned from scopedSlots now
  53881. el.children = [];
  53882. // mark el non-plain so data gets generated
  53883. el.plain = false;
  53884. }
  53885. }
  53886. }
  53887. }
  53888. function getSlotName (binding) {
  53889. var name = binding.name.replace(slotRE, '');
  53890. if (!name) {
  53891. if (binding.name[0] !== '#') {
  53892. name = 'default';
  53893. } else {
  53894. warn$2(
  53895. "v-slot shorthand syntax requires a slot name.",
  53896. binding
  53897. );
  53898. }
  53899. }
  53900. return dynamicArgRE.test(name)
  53901. // dynamic [name]
  53902. ? { name: name.slice(1, -1), dynamic: true }
  53903. // static name
  53904. : { name: ("\"" + name + "\""), dynamic: false }
  53905. }
  53906. // handle <slot/> outlets
  53907. function processSlotOutlet (el) {
  53908. if (el.tag === 'slot') {
  53909. el.slotName = getBindingAttr(el, 'name');
  53910. if (el.key) {
  53911. warn$2(
  53912. "`key` does not work on <slot> because slots are abstract outlets " +
  53913. "and can possibly expand into multiple elements. " +
  53914. "Use the key on a wrapping element instead.",
  53915. getRawBindingAttr(el, 'key')
  53916. );
  53917. }
  53918. }
  53919. }
  53920. function processComponent (el) {
  53921. var binding;
  53922. if ((binding = getBindingAttr(el, 'is'))) {
  53923. el.component = binding;
  53924. }
  53925. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53926. el.inlineTemplate = true;
  53927. }
  53928. }
  53929. function processAttrs (el) {
  53930. var list = el.attrsList;
  53931. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53932. for (i = 0, l = list.length; i < l; i++) {
  53933. name = rawName = list[i].name;
  53934. value = list[i].value;
  53935. if (dirRE.test(name)) {
  53936. // mark element as dynamic
  53937. el.hasBindings = true;
  53938. // modifiers
  53939. modifiers = parseModifiers(name.replace(dirRE, ''));
  53940. // support .foo shorthand syntax for the .prop modifier
  53941. if (modifiers) {
  53942. name = name.replace(modifierRE, '');
  53943. }
  53944. if (bindRE.test(name)) { // v-bind
  53945. name = name.replace(bindRE, '');
  53946. value = parseFilters(value);
  53947. isDynamic = dynamicArgRE.test(name);
  53948. if (isDynamic) {
  53949. name = name.slice(1, -1);
  53950. }
  53951. if (
  53952. value.trim().length === 0
  53953. ) {
  53954. warn$2(
  53955. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53956. );
  53957. }
  53958. if (modifiers) {
  53959. if (modifiers.prop && !isDynamic) {
  53960. name = camelize(name);
  53961. if (name === 'innerHtml') { name = 'innerHTML'; }
  53962. }
  53963. if (modifiers.camel && !isDynamic) {
  53964. name = camelize(name);
  53965. }
  53966. if (modifiers.sync) {
  53967. syncGen = genAssignmentCode(value, "$event");
  53968. if (!isDynamic) {
  53969. addHandler(
  53970. el,
  53971. ("update:" + (camelize(name))),
  53972. syncGen,
  53973. null,
  53974. false,
  53975. warn$2,
  53976. list[i]
  53977. );
  53978. if (hyphenate(name) !== camelize(name)) {
  53979. addHandler(
  53980. el,
  53981. ("update:" + (hyphenate(name))),
  53982. syncGen,
  53983. null,
  53984. false,
  53985. warn$2,
  53986. list[i]
  53987. );
  53988. }
  53989. } else {
  53990. // handler w/ dynamic event name
  53991. addHandler(
  53992. el,
  53993. ("\"update:\"+(" + name + ")"),
  53994. syncGen,
  53995. null,
  53996. false,
  53997. warn$2,
  53998. list[i],
  53999. true // dynamic
  54000. );
  54001. }
  54002. }
  54003. }
  54004. if ((modifiers && modifiers.prop) || (
  54005. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54006. )) {
  54007. addProp(el, name, value, list[i], isDynamic);
  54008. } else {
  54009. addAttr(el, name, value, list[i], isDynamic);
  54010. }
  54011. } else if (onRE.test(name)) { // v-on
  54012. name = name.replace(onRE, '');
  54013. isDynamic = dynamicArgRE.test(name);
  54014. if (isDynamic) {
  54015. name = name.slice(1, -1);
  54016. }
  54017. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54018. } else { // normal directives
  54019. name = name.replace(dirRE, '');
  54020. // parse arg
  54021. var argMatch = name.match(argRE);
  54022. var arg = argMatch && argMatch[1];
  54023. isDynamic = false;
  54024. if (arg) {
  54025. name = name.slice(0, -(arg.length + 1));
  54026. if (dynamicArgRE.test(arg)) {
  54027. arg = arg.slice(1, -1);
  54028. isDynamic = true;
  54029. }
  54030. }
  54031. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54032. if (name === 'model') {
  54033. checkForAliasModel(el, value);
  54034. }
  54035. }
  54036. } else {
  54037. // literal attribute
  54038. {
  54039. var res = parseText(value, delimiters);
  54040. if (res) {
  54041. warn$2(
  54042. name + "=\"" + value + "\": " +
  54043. 'Interpolation inside attributes has been removed. ' +
  54044. 'Use v-bind or the colon shorthand instead. For example, ' +
  54045. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54046. list[i]
  54047. );
  54048. }
  54049. }
  54050. addAttr(el, name, JSON.stringify(value), list[i]);
  54051. // #6887 firefox doesn't update muted state if set via attribute
  54052. // even immediately after element creation
  54053. if (!el.component &&
  54054. name === 'muted' &&
  54055. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54056. addProp(el, name, 'true', list[i]);
  54057. }
  54058. }
  54059. }
  54060. }
  54061. function checkInFor (el) {
  54062. var parent = el;
  54063. while (parent) {
  54064. if (parent.for !== undefined) {
  54065. return true
  54066. }
  54067. parent = parent.parent;
  54068. }
  54069. return false
  54070. }
  54071. function parseModifiers (name) {
  54072. var match = name.match(modifierRE);
  54073. if (match) {
  54074. var ret = {};
  54075. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54076. return ret
  54077. }
  54078. }
  54079. function makeAttrsMap (attrs) {
  54080. var map = {};
  54081. for (var i = 0, l = attrs.length; i < l; i++) {
  54082. if (
  54083. map[attrs[i].name] && !isIE && !isEdge
  54084. ) {
  54085. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54086. }
  54087. map[attrs[i].name] = attrs[i].value;
  54088. }
  54089. return map
  54090. }
  54091. // for script (e.g. type="x/template") or style, do not decode content
  54092. function isTextTag (el) {
  54093. return el.tag === 'script' || el.tag === 'style'
  54094. }
  54095. function isForbiddenTag (el) {
  54096. return (
  54097. el.tag === 'style' ||
  54098. (el.tag === 'script' && (
  54099. !el.attrsMap.type ||
  54100. el.attrsMap.type === 'text/javascript'
  54101. ))
  54102. )
  54103. }
  54104. var ieNSBug = /^xmlns:NS\d+/;
  54105. var ieNSPrefix = /^NS\d+:/;
  54106. /* istanbul ignore next */
  54107. function guardIESVGBug (attrs) {
  54108. var res = [];
  54109. for (var i = 0; i < attrs.length; i++) {
  54110. var attr = attrs[i];
  54111. if (!ieNSBug.test(attr.name)) {
  54112. attr.name = attr.name.replace(ieNSPrefix, '');
  54113. res.push(attr);
  54114. }
  54115. }
  54116. return res
  54117. }
  54118. function checkForAliasModel (el, value) {
  54119. var _el = el;
  54120. while (_el) {
  54121. if (_el.for && _el.alias === value) {
  54122. warn$2(
  54123. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54124. "You are binding v-model directly to a v-for iteration alias. " +
  54125. "This will not be able to modify the v-for source array because " +
  54126. "writing to the alias is like modifying a function local variable. " +
  54127. "Consider using an array of objects and use v-model on an object property instead.",
  54128. el.rawAttrsMap['v-model']
  54129. );
  54130. }
  54131. _el = _el.parent;
  54132. }
  54133. }
  54134. /* */
  54135. function preTransformNode (el, options) {
  54136. if (el.tag === 'input') {
  54137. var map = el.attrsMap;
  54138. if (!map['v-model']) {
  54139. return
  54140. }
  54141. var typeBinding;
  54142. if (map[':type'] || map['v-bind:type']) {
  54143. typeBinding = getBindingAttr(el, 'type');
  54144. }
  54145. if (!map.type && !typeBinding && map['v-bind']) {
  54146. typeBinding = "(" + (map['v-bind']) + ").type";
  54147. }
  54148. if (typeBinding) {
  54149. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54150. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54151. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54152. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54153. // 1. checkbox
  54154. var branch0 = cloneASTElement(el);
  54155. // process for on the main node
  54156. processFor(branch0);
  54157. addRawAttr(branch0, 'type', 'checkbox');
  54158. processElement(branch0, options);
  54159. branch0.processed = true; // prevent it from double-processed
  54160. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54161. addIfCondition(branch0, {
  54162. exp: branch0.if,
  54163. block: branch0
  54164. });
  54165. // 2. add radio else-if condition
  54166. var branch1 = cloneASTElement(el);
  54167. getAndRemoveAttr(branch1, 'v-for', true);
  54168. addRawAttr(branch1, 'type', 'radio');
  54169. processElement(branch1, options);
  54170. addIfCondition(branch0, {
  54171. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54172. block: branch1
  54173. });
  54174. // 3. other
  54175. var branch2 = cloneASTElement(el);
  54176. getAndRemoveAttr(branch2, 'v-for', true);
  54177. addRawAttr(branch2, ':type', typeBinding);
  54178. processElement(branch2, options);
  54179. addIfCondition(branch0, {
  54180. exp: ifCondition,
  54181. block: branch2
  54182. });
  54183. if (hasElse) {
  54184. branch0.else = true;
  54185. } else if (elseIfCondition) {
  54186. branch0.elseif = elseIfCondition;
  54187. }
  54188. return branch0
  54189. }
  54190. }
  54191. }
  54192. function cloneASTElement (el) {
  54193. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54194. }
  54195. var model$1 = {
  54196. preTransformNode: preTransformNode
  54197. };
  54198. var modules$1 = [
  54199. klass$1,
  54200. style$1,
  54201. model$1
  54202. ];
  54203. /* */
  54204. function text (el, dir) {
  54205. if (dir.value) {
  54206. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54207. }
  54208. }
  54209. /* */
  54210. function html (el, dir) {
  54211. if (dir.value) {
  54212. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54213. }
  54214. }
  54215. var directives$1 = {
  54216. model: model,
  54217. text: text,
  54218. html: html
  54219. };
  54220. /* */
  54221. var baseOptions = {
  54222. expectHTML: true,
  54223. modules: modules$1,
  54224. directives: directives$1,
  54225. isPreTag: isPreTag,
  54226. isUnaryTag: isUnaryTag,
  54227. mustUseProp: mustUseProp,
  54228. canBeLeftOpenTag: canBeLeftOpenTag,
  54229. isReservedTag: isReservedTag,
  54230. getTagNamespace: getTagNamespace,
  54231. staticKeys: genStaticKeys(modules$1)
  54232. };
  54233. /* */
  54234. var isStaticKey;
  54235. var isPlatformReservedTag;
  54236. var genStaticKeysCached = cached(genStaticKeys$1);
  54237. /**
  54238. * Goal of the optimizer: walk the generated template AST tree
  54239. * and detect sub-trees that are purely static, i.e. parts of
  54240. * the DOM that never needs to change.
  54241. *
  54242. * Once we detect these sub-trees, we can:
  54243. *
  54244. * 1. Hoist them into constants, so that we no longer need to
  54245. * create fresh nodes for them on each re-render;
  54246. * 2. Completely skip them in the patching process.
  54247. */
  54248. function optimize (root, options) {
  54249. if (!root) { return }
  54250. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54251. isPlatformReservedTag = options.isReservedTag || no;
  54252. // first pass: mark all non-static nodes.
  54253. markStatic$1(root);
  54254. // second pass: mark static roots.
  54255. markStaticRoots(root, false);
  54256. }
  54257. function genStaticKeys$1 (keys) {
  54258. return makeMap(
  54259. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54260. (keys ? ',' + keys : '')
  54261. )
  54262. }
  54263. function markStatic$1 (node) {
  54264. node.static = isStatic(node);
  54265. if (node.type === 1) {
  54266. // do not make component slot content static. this avoids
  54267. // 1. components not able to mutate slot nodes
  54268. // 2. static slot content fails for hot-reloading
  54269. if (
  54270. !isPlatformReservedTag(node.tag) &&
  54271. node.tag !== 'slot' &&
  54272. node.attrsMap['inline-template'] == null
  54273. ) {
  54274. return
  54275. }
  54276. for (var i = 0, l = node.children.length; i < l; i++) {
  54277. var child = node.children[i];
  54278. markStatic$1(child);
  54279. if (!child.static) {
  54280. node.static = false;
  54281. }
  54282. }
  54283. if (node.ifConditions) {
  54284. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54285. var block = node.ifConditions[i$1].block;
  54286. markStatic$1(block);
  54287. if (!block.static) {
  54288. node.static = false;
  54289. }
  54290. }
  54291. }
  54292. }
  54293. }
  54294. function markStaticRoots (node, isInFor) {
  54295. if (node.type === 1) {
  54296. if (node.static || node.once) {
  54297. node.staticInFor = isInFor;
  54298. }
  54299. // For a node to qualify as a static root, it should have children that
  54300. // are not just static text. Otherwise the cost of hoisting out will
  54301. // outweigh the benefits and it's better off to just always render it fresh.
  54302. if (node.static && node.children.length && !(
  54303. node.children.length === 1 &&
  54304. node.children[0].type === 3
  54305. )) {
  54306. node.staticRoot = true;
  54307. return
  54308. } else {
  54309. node.staticRoot = false;
  54310. }
  54311. if (node.children) {
  54312. for (var i = 0, l = node.children.length; i < l; i++) {
  54313. markStaticRoots(node.children[i], isInFor || !!node.for);
  54314. }
  54315. }
  54316. if (node.ifConditions) {
  54317. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54318. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54319. }
  54320. }
  54321. }
  54322. }
  54323. function isStatic (node) {
  54324. if (node.type === 2) { // expression
  54325. return false
  54326. }
  54327. if (node.type === 3) { // text
  54328. return true
  54329. }
  54330. return !!(node.pre || (
  54331. !node.hasBindings && // no dynamic bindings
  54332. !node.if && !node.for && // not v-if or v-for or v-else
  54333. !isBuiltInTag(node.tag) && // not a built-in
  54334. isPlatformReservedTag(node.tag) && // not a component
  54335. !isDirectChildOfTemplateFor(node) &&
  54336. Object.keys(node).every(isStaticKey)
  54337. ))
  54338. }
  54339. function isDirectChildOfTemplateFor (node) {
  54340. while (node.parent) {
  54341. node = node.parent;
  54342. if (node.tag !== 'template') {
  54343. return false
  54344. }
  54345. if (node.for) {
  54346. return true
  54347. }
  54348. }
  54349. return false
  54350. }
  54351. /* */
  54352. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54353. var fnInvokeRE = /\([^)]*?\);*$/;
  54354. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54355. // KeyboardEvent.keyCode aliases
  54356. var keyCodes = {
  54357. esc: 27,
  54358. tab: 9,
  54359. enter: 13,
  54360. space: 32,
  54361. up: 38,
  54362. left: 37,
  54363. right: 39,
  54364. down: 40,
  54365. 'delete': [8, 46]
  54366. };
  54367. // KeyboardEvent.key aliases
  54368. var keyNames = {
  54369. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54370. esc: ['Esc', 'Escape'],
  54371. tab: 'Tab',
  54372. enter: 'Enter',
  54373. // #9112: IE11 uses `Spacebar` for Space key name.
  54374. space: [' ', 'Spacebar'],
  54375. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54376. up: ['Up', 'ArrowUp'],
  54377. left: ['Left', 'ArrowLeft'],
  54378. right: ['Right', 'ArrowRight'],
  54379. down: ['Down', 'ArrowDown'],
  54380. // #9112: IE11 uses `Del` for Delete key name.
  54381. 'delete': ['Backspace', 'Delete', 'Del']
  54382. };
  54383. // #4868: modifiers that prevent the execution of the listener
  54384. // need to explicitly return null so that we can determine whether to remove
  54385. // the listener for .once
  54386. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54387. var modifierCode = {
  54388. stop: '$event.stopPropagation();',
  54389. prevent: '$event.preventDefault();',
  54390. self: genGuard("$event.target !== $event.currentTarget"),
  54391. ctrl: genGuard("!$event.ctrlKey"),
  54392. shift: genGuard("!$event.shiftKey"),
  54393. alt: genGuard("!$event.altKey"),
  54394. meta: genGuard("!$event.metaKey"),
  54395. left: genGuard("'button' in $event && $event.button !== 0"),
  54396. middle: genGuard("'button' in $event && $event.button !== 1"),
  54397. right: genGuard("'button' in $event && $event.button !== 2")
  54398. };
  54399. function genHandlers (
  54400. events,
  54401. isNative
  54402. ) {
  54403. var prefix = isNative ? 'nativeOn:' : 'on:';
  54404. var staticHandlers = "";
  54405. var dynamicHandlers = "";
  54406. for (var name in events) {
  54407. var handlerCode = genHandler(events[name]);
  54408. if (events[name] && events[name].dynamic) {
  54409. dynamicHandlers += name + "," + handlerCode + ",";
  54410. } else {
  54411. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54412. }
  54413. }
  54414. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54415. if (dynamicHandlers) {
  54416. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54417. } else {
  54418. return prefix + staticHandlers
  54419. }
  54420. }
  54421. function genHandler (handler) {
  54422. if (!handler) {
  54423. return 'function(){}'
  54424. }
  54425. if (Array.isArray(handler)) {
  54426. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54427. }
  54428. var isMethodPath = simplePathRE.test(handler.value);
  54429. var isFunctionExpression = fnExpRE.test(handler.value);
  54430. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54431. if (!handler.modifiers) {
  54432. if (isMethodPath || isFunctionExpression) {
  54433. return handler.value
  54434. }
  54435. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54436. } else {
  54437. var code = '';
  54438. var genModifierCode = '';
  54439. var keys = [];
  54440. for (var key in handler.modifiers) {
  54441. if (modifierCode[key]) {
  54442. genModifierCode += modifierCode[key];
  54443. // left/right
  54444. if (keyCodes[key]) {
  54445. keys.push(key);
  54446. }
  54447. } else if (key === 'exact') {
  54448. var modifiers = (handler.modifiers);
  54449. genModifierCode += genGuard(
  54450. ['ctrl', 'shift', 'alt', 'meta']
  54451. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54452. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54453. .join('||')
  54454. );
  54455. } else {
  54456. keys.push(key);
  54457. }
  54458. }
  54459. if (keys.length) {
  54460. code += genKeyFilter(keys);
  54461. }
  54462. // Make sure modifiers like prevent and stop get executed after key filtering
  54463. if (genModifierCode) {
  54464. code += genModifierCode;
  54465. }
  54466. var handlerCode = isMethodPath
  54467. ? ("return " + (handler.value) + "($event)")
  54468. : isFunctionExpression
  54469. ? ("return (" + (handler.value) + ")($event)")
  54470. : isFunctionInvocation
  54471. ? ("return " + (handler.value))
  54472. : handler.value;
  54473. return ("function($event){" + code + handlerCode + "}")
  54474. }
  54475. }
  54476. function genKeyFilter (keys) {
  54477. return (
  54478. // make sure the key filters only apply to KeyboardEvents
  54479. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54480. // key events that do not have keyCode property...
  54481. "if(!$event.type.indexOf('key')&&" +
  54482. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54483. )
  54484. }
  54485. function genFilterCode (key) {
  54486. var keyVal = parseInt(key, 10);
  54487. if (keyVal) {
  54488. return ("$event.keyCode!==" + keyVal)
  54489. }
  54490. var keyCode = keyCodes[key];
  54491. var keyName = keyNames[key];
  54492. return (
  54493. "_k($event.keyCode," +
  54494. (JSON.stringify(key)) + "," +
  54495. (JSON.stringify(keyCode)) + "," +
  54496. "$event.key," +
  54497. "" + (JSON.stringify(keyName)) +
  54498. ")"
  54499. )
  54500. }
  54501. /* */
  54502. function on (el, dir) {
  54503. if (dir.modifiers) {
  54504. warn("v-on without argument does not support modifiers.");
  54505. }
  54506. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54507. }
  54508. /* */
  54509. function bind$1 (el, dir) {
  54510. el.wrapData = function (code) {
  54511. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54512. };
  54513. }
  54514. /* */
  54515. var baseDirectives = {
  54516. on: on,
  54517. bind: bind$1,
  54518. cloak: noop
  54519. };
  54520. /* */
  54521. var CodegenState = function CodegenState (options) {
  54522. this.options = options;
  54523. this.warn = options.warn || baseWarn;
  54524. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54525. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54526. this.directives = extend(extend({}, baseDirectives), options.directives);
  54527. var isReservedTag = options.isReservedTag || no;
  54528. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54529. this.onceId = 0;
  54530. this.staticRenderFns = [];
  54531. this.pre = false;
  54532. };
  54533. function generate (
  54534. ast,
  54535. options
  54536. ) {
  54537. var state = new CodegenState(options);
  54538. var code = ast ? genElement(ast, state) : '_c("div")';
  54539. return {
  54540. render: ("with(this){return " + code + "}"),
  54541. staticRenderFns: state.staticRenderFns
  54542. }
  54543. }
  54544. function genElement (el, state) {
  54545. if (el.parent) {
  54546. el.pre = el.pre || el.parent.pre;
  54547. }
  54548. if (el.staticRoot && !el.staticProcessed) {
  54549. return genStatic(el, state)
  54550. } else if (el.once && !el.onceProcessed) {
  54551. return genOnce(el, state)
  54552. } else if (el.for && !el.forProcessed) {
  54553. return genFor(el, state)
  54554. } else if (el.if && !el.ifProcessed) {
  54555. return genIf(el, state)
  54556. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54557. return genChildren(el, state) || 'void 0'
  54558. } else if (el.tag === 'slot') {
  54559. return genSlot(el, state)
  54560. } else {
  54561. // component or element
  54562. var code;
  54563. if (el.component) {
  54564. code = genComponent(el.component, el, state);
  54565. } else {
  54566. var data;
  54567. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54568. data = genData$2(el, state);
  54569. }
  54570. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54571. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54572. }
  54573. // module transforms
  54574. for (var i = 0; i < state.transforms.length; i++) {
  54575. code = state.transforms[i](el, code);
  54576. }
  54577. return code
  54578. }
  54579. }
  54580. // hoist static sub-trees out
  54581. function genStatic (el, state) {
  54582. el.staticProcessed = true;
  54583. // Some elements (templates) need to behave differently inside of a v-pre
  54584. // node. All pre nodes are static roots, so we can use this as a location to
  54585. // wrap a state change and reset it upon exiting the pre node.
  54586. var originalPreState = state.pre;
  54587. if (el.pre) {
  54588. state.pre = el.pre;
  54589. }
  54590. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54591. state.pre = originalPreState;
  54592. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54593. }
  54594. // v-once
  54595. function genOnce (el, state) {
  54596. el.onceProcessed = true;
  54597. if (el.if && !el.ifProcessed) {
  54598. return genIf(el, state)
  54599. } else if (el.staticInFor) {
  54600. var key = '';
  54601. var parent = el.parent;
  54602. while (parent) {
  54603. if (parent.for) {
  54604. key = parent.key;
  54605. break
  54606. }
  54607. parent = parent.parent;
  54608. }
  54609. if (!key) {
  54610. state.warn(
  54611. "v-once can only be used inside v-for that is keyed. ",
  54612. el.rawAttrsMap['v-once']
  54613. );
  54614. return genElement(el, state)
  54615. }
  54616. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54617. } else {
  54618. return genStatic(el, state)
  54619. }
  54620. }
  54621. function genIf (
  54622. el,
  54623. state,
  54624. altGen,
  54625. altEmpty
  54626. ) {
  54627. el.ifProcessed = true; // avoid recursion
  54628. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54629. }
  54630. function genIfConditions (
  54631. conditions,
  54632. state,
  54633. altGen,
  54634. altEmpty
  54635. ) {
  54636. if (!conditions.length) {
  54637. return altEmpty || '_e()'
  54638. }
  54639. var condition = conditions.shift();
  54640. if (condition.exp) {
  54641. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54642. } else {
  54643. return ("" + (genTernaryExp(condition.block)))
  54644. }
  54645. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54646. function genTernaryExp (el) {
  54647. return altGen
  54648. ? altGen(el, state)
  54649. : el.once
  54650. ? genOnce(el, state)
  54651. : genElement(el, state)
  54652. }
  54653. }
  54654. function genFor (
  54655. el,
  54656. state,
  54657. altGen,
  54658. altHelper
  54659. ) {
  54660. var exp = el.for;
  54661. var alias = el.alias;
  54662. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54663. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54664. if (state.maybeComponent(el) &&
  54665. el.tag !== 'slot' &&
  54666. el.tag !== 'template' &&
  54667. !el.key
  54668. ) {
  54669. state.warn(
  54670. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54671. "v-for should have explicit keys. " +
  54672. "See https://vuejs.org/guide/list.html#key for more info.",
  54673. el.rawAttrsMap['v-for'],
  54674. true /* tip */
  54675. );
  54676. }
  54677. el.forProcessed = true; // avoid recursion
  54678. return (altHelper || '_l') + "((" + exp + ")," +
  54679. "function(" + alias + iterator1 + iterator2 + "){" +
  54680. "return " + ((altGen || genElement)(el, state)) +
  54681. '})'
  54682. }
  54683. function genData$2 (el, state) {
  54684. var data = '{';
  54685. // directives first.
  54686. // directives may mutate the el's other properties before they are generated.
  54687. var dirs = genDirectives(el, state);
  54688. if (dirs) { data += dirs + ','; }
  54689. // key
  54690. if (el.key) {
  54691. data += "key:" + (el.key) + ",";
  54692. }
  54693. // ref
  54694. if (el.ref) {
  54695. data += "ref:" + (el.ref) + ",";
  54696. }
  54697. if (el.refInFor) {
  54698. data += "refInFor:true,";
  54699. }
  54700. // pre
  54701. if (el.pre) {
  54702. data += "pre:true,";
  54703. }
  54704. // record original tag name for components using "is" attribute
  54705. if (el.component) {
  54706. data += "tag:\"" + (el.tag) + "\",";
  54707. }
  54708. // module data generation functions
  54709. for (var i = 0; i < state.dataGenFns.length; i++) {
  54710. data += state.dataGenFns[i](el);
  54711. }
  54712. // attributes
  54713. if (el.attrs) {
  54714. data += "attrs:" + (genProps(el.attrs)) + ",";
  54715. }
  54716. // DOM props
  54717. if (el.props) {
  54718. data += "domProps:" + (genProps(el.props)) + ",";
  54719. }
  54720. // event handlers
  54721. if (el.events) {
  54722. data += (genHandlers(el.events, false)) + ",";
  54723. }
  54724. if (el.nativeEvents) {
  54725. data += (genHandlers(el.nativeEvents, true)) + ",";
  54726. }
  54727. // slot target
  54728. // only for non-scoped slots
  54729. if (el.slotTarget && !el.slotScope) {
  54730. data += "slot:" + (el.slotTarget) + ",";
  54731. }
  54732. // scoped slots
  54733. if (el.scopedSlots) {
  54734. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54735. }
  54736. // component v-model
  54737. if (el.model) {
  54738. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54739. }
  54740. // inline-template
  54741. if (el.inlineTemplate) {
  54742. var inlineTemplate = genInlineTemplate(el, state);
  54743. if (inlineTemplate) {
  54744. data += inlineTemplate + ",";
  54745. }
  54746. }
  54747. data = data.replace(/,$/, '') + '}';
  54748. // v-bind dynamic argument wrap
  54749. // v-bind with dynamic arguments must be applied using the same v-bind object
  54750. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54751. if (el.dynamicAttrs) {
  54752. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54753. }
  54754. // v-bind data wrap
  54755. if (el.wrapData) {
  54756. data = el.wrapData(data);
  54757. }
  54758. // v-on data wrap
  54759. if (el.wrapListeners) {
  54760. data = el.wrapListeners(data);
  54761. }
  54762. return data
  54763. }
  54764. function genDirectives (el, state) {
  54765. var dirs = el.directives;
  54766. if (!dirs) { return }
  54767. var res = 'directives:[';
  54768. var hasRuntime = false;
  54769. var i, l, dir, needRuntime;
  54770. for (i = 0, l = dirs.length; i < l; i++) {
  54771. dir = dirs[i];
  54772. needRuntime = true;
  54773. var gen = state.directives[dir.name];
  54774. if (gen) {
  54775. // compile-time directive that manipulates AST.
  54776. // returns true if it also needs a runtime counterpart.
  54777. needRuntime = !!gen(el, dir, state.warn);
  54778. }
  54779. if (needRuntime) {
  54780. hasRuntime = true;
  54781. 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))) : '') + "},";
  54782. }
  54783. }
  54784. if (hasRuntime) {
  54785. return res.slice(0, -1) + ']'
  54786. }
  54787. }
  54788. function genInlineTemplate (el, state) {
  54789. var ast = el.children[0];
  54790. if (el.children.length !== 1 || ast.type !== 1) {
  54791. state.warn(
  54792. 'Inline-template components must have exactly one child element.',
  54793. { start: el.start }
  54794. );
  54795. }
  54796. if (ast && ast.type === 1) {
  54797. var inlineRenderFns = generate(ast, state.options);
  54798. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54799. }
  54800. }
  54801. function genScopedSlots (
  54802. el,
  54803. slots,
  54804. state
  54805. ) {
  54806. // by default scoped slots are considered "stable", this allows child
  54807. // components with only scoped slots to skip forced updates from parent.
  54808. // but in some cases we have to bail-out of this optimization
  54809. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54810. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54811. var slot = slots[key];
  54812. return (
  54813. slot.slotTargetDynamic ||
  54814. slot.if ||
  54815. slot.for ||
  54816. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54817. )
  54818. });
  54819. // #9534: if a component with scoped slots is inside a conditional branch,
  54820. // it's possible for the same component to be reused but with different
  54821. // compiled slot content. To avoid that, we generate a unique key based on
  54822. // the generated code of all the slot contents.
  54823. var needsKey = !!el.if;
  54824. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54825. // disconnected due to the intermediate scope variable)
  54826. // #9438, #9506
  54827. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54828. // and skip force updating ones that do not actually use scope variables.
  54829. if (!needsForceUpdate) {
  54830. var parent = el.parent;
  54831. while (parent) {
  54832. if (
  54833. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54834. parent.for
  54835. ) {
  54836. needsForceUpdate = true;
  54837. break
  54838. }
  54839. if (parent.if) {
  54840. needsKey = true;
  54841. }
  54842. parent = parent.parent;
  54843. }
  54844. }
  54845. var generatedSlots = Object.keys(slots)
  54846. .map(function (key) { return genScopedSlot(slots[key], state); })
  54847. .join(',');
  54848. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54849. }
  54850. function hash(str) {
  54851. var hash = 5381;
  54852. var i = str.length;
  54853. while(i) {
  54854. hash = (hash * 33) ^ str.charCodeAt(--i);
  54855. }
  54856. return hash >>> 0
  54857. }
  54858. function containsSlotChild (el) {
  54859. if (el.type === 1) {
  54860. if (el.tag === 'slot') {
  54861. return true
  54862. }
  54863. return el.children.some(containsSlotChild)
  54864. }
  54865. return false
  54866. }
  54867. function genScopedSlot (
  54868. el,
  54869. state
  54870. ) {
  54871. var isLegacySyntax = el.attrsMap['slot-scope'];
  54872. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54873. return genIf(el, state, genScopedSlot, "null")
  54874. }
  54875. if (el.for && !el.forProcessed) {
  54876. return genFor(el, state, genScopedSlot)
  54877. }
  54878. var slotScope = el.slotScope === emptySlotScopeToken
  54879. ? ""
  54880. : String(el.slotScope);
  54881. var fn = "function(" + slotScope + "){" +
  54882. "return " + (el.tag === 'template'
  54883. ? el.if && isLegacySyntax
  54884. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54885. : genChildren(el, state) || 'undefined'
  54886. : genElement(el, state)) + "}";
  54887. // reverse proxy v-slot without scope on this.$slots
  54888. var reverseProxy = slotScope ? "" : ",proxy:true";
  54889. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54890. }
  54891. function genChildren (
  54892. el,
  54893. state,
  54894. checkSkip,
  54895. altGenElement,
  54896. altGenNode
  54897. ) {
  54898. var children = el.children;
  54899. if (children.length) {
  54900. var el$1 = children[0];
  54901. // optimize single v-for
  54902. if (children.length === 1 &&
  54903. el$1.for &&
  54904. el$1.tag !== 'template' &&
  54905. el$1.tag !== 'slot'
  54906. ) {
  54907. var normalizationType = checkSkip
  54908. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54909. : "";
  54910. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54911. }
  54912. var normalizationType$1 = checkSkip
  54913. ? getNormalizationType(children, state.maybeComponent)
  54914. : 0;
  54915. var gen = altGenNode || genNode;
  54916. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54917. }
  54918. }
  54919. // determine the normalization needed for the children array.
  54920. // 0: no normalization needed
  54921. // 1: simple normalization needed (possible 1-level deep nested array)
  54922. // 2: full normalization needed
  54923. function getNormalizationType (
  54924. children,
  54925. maybeComponent
  54926. ) {
  54927. var res = 0;
  54928. for (var i = 0; i < children.length; i++) {
  54929. var el = children[i];
  54930. if (el.type !== 1) {
  54931. continue
  54932. }
  54933. if (needsNormalization(el) ||
  54934. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54935. res = 2;
  54936. break
  54937. }
  54938. if (maybeComponent(el) ||
  54939. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54940. res = 1;
  54941. }
  54942. }
  54943. return res
  54944. }
  54945. function needsNormalization (el) {
  54946. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54947. }
  54948. function genNode (node, state) {
  54949. if (node.type === 1) {
  54950. return genElement(node, state)
  54951. } else if (node.type === 3 && node.isComment) {
  54952. return genComment(node)
  54953. } else {
  54954. return genText(node)
  54955. }
  54956. }
  54957. function genText (text) {
  54958. return ("_v(" + (text.type === 2
  54959. ? text.expression // no need for () because already wrapped in _s()
  54960. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54961. }
  54962. function genComment (comment) {
  54963. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54964. }
  54965. function genSlot (el, state) {
  54966. var slotName = el.slotName || '"default"';
  54967. var children = genChildren(el, state);
  54968. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54969. var attrs = el.attrs || el.dynamicAttrs
  54970. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54971. // slot props are camelized
  54972. name: camelize(attr.name),
  54973. value: attr.value,
  54974. dynamic: attr.dynamic
  54975. }); }))
  54976. : null;
  54977. var bind$$1 = el.attrsMap['v-bind'];
  54978. if ((attrs || bind$$1) && !children) {
  54979. res += ",null";
  54980. }
  54981. if (attrs) {
  54982. res += "," + attrs;
  54983. }
  54984. if (bind$$1) {
  54985. res += (attrs ? '' : ',null') + "," + bind$$1;
  54986. }
  54987. return res + ')'
  54988. }
  54989. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54990. function genComponent (
  54991. componentName,
  54992. el,
  54993. state
  54994. ) {
  54995. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54996. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54997. }
  54998. function genProps (props) {
  54999. var staticProps = "";
  55000. var dynamicProps = "";
  55001. for (var i = 0; i < props.length; i++) {
  55002. var prop = props[i];
  55003. var value = transformSpecialNewlines(prop.value);
  55004. if (prop.dynamic) {
  55005. dynamicProps += (prop.name) + "," + value + ",";
  55006. } else {
  55007. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55008. }
  55009. }
  55010. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55011. if (dynamicProps) {
  55012. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55013. } else {
  55014. return staticProps
  55015. }
  55016. }
  55017. // #3895, #4268
  55018. function transformSpecialNewlines (text) {
  55019. return text
  55020. .replace(/\u2028/g, '\\u2028')
  55021. .replace(/\u2029/g, '\\u2029')
  55022. }
  55023. /* */
  55024. // these keywords should not appear inside expressions, but operators like
  55025. // typeof, instanceof and in are allowed
  55026. var prohibitedKeywordRE = new RegExp('\\b' + (
  55027. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55028. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55029. 'extends,finally,continue,debugger,function,arguments'
  55030. ).split(',').join('\\b|\\b') + '\\b');
  55031. // these unary operators should not be used as property/method names
  55032. var unaryOperatorsRE = new RegExp('\\b' + (
  55033. 'delete,typeof,void'
  55034. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55035. // strip strings in expressions
  55036. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55037. // detect problematic expressions in a template
  55038. function detectErrors (ast, warn) {
  55039. if (ast) {
  55040. checkNode(ast, warn);
  55041. }
  55042. }
  55043. function checkNode (node, warn) {
  55044. if (node.type === 1) {
  55045. for (var name in node.attrsMap) {
  55046. if (dirRE.test(name)) {
  55047. var value = node.attrsMap[name];
  55048. if (value) {
  55049. var range = node.rawAttrsMap[name];
  55050. if (name === 'v-for') {
  55051. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55052. } else if (name === 'v-slot' || name[0] === '#') {
  55053. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55054. } else if (onRE.test(name)) {
  55055. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55056. } else {
  55057. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55058. }
  55059. }
  55060. }
  55061. }
  55062. if (node.children) {
  55063. for (var i = 0; i < node.children.length; i++) {
  55064. checkNode(node.children[i], warn);
  55065. }
  55066. }
  55067. } else if (node.type === 2) {
  55068. checkExpression(node.expression, node.text, warn, node);
  55069. }
  55070. }
  55071. function checkEvent (exp, text, warn, range) {
  55072. var stripped = exp.replace(stripStringRE, '');
  55073. var keywordMatch = stripped.match(unaryOperatorsRE);
  55074. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55075. warn(
  55076. "avoid using JavaScript unary operator as property name: " +
  55077. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55078. range
  55079. );
  55080. }
  55081. checkExpression(exp, text, warn, range);
  55082. }
  55083. function checkFor (node, text, warn, range) {
  55084. checkExpression(node.for || '', text, warn, range);
  55085. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55086. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55087. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55088. }
  55089. function checkIdentifier (
  55090. ident,
  55091. type,
  55092. text,
  55093. warn,
  55094. range
  55095. ) {
  55096. if (typeof ident === 'string') {
  55097. try {
  55098. new Function(("var " + ident + "=_"));
  55099. } catch (e) {
  55100. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55101. }
  55102. }
  55103. }
  55104. function checkExpression (exp, text, warn, range) {
  55105. try {
  55106. new Function(("return " + exp));
  55107. } catch (e) {
  55108. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55109. if (keywordMatch) {
  55110. warn(
  55111. "avoid using JavaScript keyword as property name: " +
  55112. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55113. range
  55114. );
  55115. } else {
  55116. warn(
  55117. "invalid expression: " + (e.message) + " in\n\n" +
  55118. " " + exp + "\n\n" +
  55119. " Raw expression: " + (text.trim()) + "\n",
  55120. range
  55121. );
  55122. }
  55123. }
  55124. }
  55125. function checkFunctionParameterExpression (exp, text, warn, range) {
  55126. try {
  55127. new Function(exp, '');
  55128. } catch (e) {
  55129. warn(
  55130. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55131. " " + exp + "\n\n" +
  55132. " Raw expression: " + (text.trim()) + "\n",
  55133. range
  55134. );
  55135. }
  55136. }
  55137. /* */
  55138. var range = 2;
  55139. function generateCodeFrame (
  55140. source,
  55141. start,
  55142. end
  55143. ) {
  55144. if ( start === void 0 ) start = 0;
  55145. if ( end === void 0 ) end = source.length;
  55146. var lines = source.split(/\r?\n/);
  55147. var count = 0;
  55148. var res = [];
  55149. for (var i = 0; i < lines.length; i++) {
  55150. count += lines[i].length + 1;
  55151. if (count >= start) {
  55152. for (var j = i - range; j <= i + range || end > count; j++) {
  55153. if (j < 0 || j >= lines.length) { continue }
  55154. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55155. var lineLength = lines[j].length;
  55156. if (j === i) {
  55157. // push underline
  55158. var pad = start - (count - lineLength) + 1;
  55159. var length = end > count ? lineLength - pad : end - start;
  55160. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55161. } else if (j > i) {
  55162. if (end > count) {
  55163. var length$1 = Math.min(end - count, lineLength);
  55164. res.push(" | " + repeat$1("^", length$1));
  55165. }
  55166. count += lineLength + 1;
  55167. }
  55168. }
  55169. break
  55170. }
  55171. }
  55172. return res.join('\n')
  55173. }
  55174. function repeat$1 (str, n) {
  55175. var result = '';
  55176. if (n > 0) {
  55177. while (true) { // eslint-disable-line
  55178. if (n & 1) { result += str; }
  55179. n >>>= 1;
  55180. if (n <= 0) { break }
  55181. str += str;
  55182. }
  55183. }
  55184. return result
  55185. }
  55186. /* */
  55187. function createFunction (code, errors) {
  55188. try {
  55189. return new Function(code)
  55190. } catch (err) {
  55191. errors.push({ err: err, code: code });
  55192. return noop
  55193. }
  55194. }
  55195. function createCompileToFunctionFn (compile) {
  55196. var cache = Object.create(null);
  55197. return function compileToFunctions (
  55198. template,
  55199. options,
  55200. vm
  55201. ) {
  55202. options = extend({}, options);
  55203. var warn$$1 = options.warn || warn;
  55204. delete options.warn;
  55205. /* istanbul ignore if */
  55206. {
  55207. // detect possible CSP restriction
  55208. try {
  55209. new Function('return 1');
  55210. } catch (e) {
  55211. if (e.toString().match(/unsafe-eval|CSP/)) {
  55212. warn$$1(
  55213. 'It seems you are using the standalone build of Vue.js in an ' +
  55214. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55215. 'The template compiler cannot work in this environment. Consider ' +
  55216. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55217. 'templates into render functions.'
  55218. );
  55219. }
  55220. }
  55221. }
  55222. // check cache
  55223. var key = options.delimiters
  55224. ? String(options.delimiters) + template
  55225. : template;
  55226. if (cache[key]) {
  55227. return cache[key]
  55228. }
  55229. // compile
  55230. var compiled = compile(template, options);
  55231. // check compilation errors/tips
  55232. {
  55233. if (compiled.errors && compiled.errors.length) {
  55234. if (options.outputSourceRange) {
  55235. compiled.errors.forEach(function (e) {
  55236. warn$$1(
  55237. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55238. generateCodeFrame(template, e.start, e.end),
  55239. vm
  55240. );
  55241. });
  55242. } else {
  55243. warn$$1(
  55244. "Error compiling template:\n\n" + template + "\n\n" +
  55245. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55246. vm
  55247. );
  55248. }
  55249. }
  55250. if (compiled.tips && compiled.tips.length) {
  55251. if (options.outputSourceRange) {
  55252. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55253. } else {
  55254. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55255. }
  55256. }
  55257. }
  55258. // turn code into functions
  55259. var res = {};
  55260. var fnGenErrors = [];
  55261. res.render = createFunction(compiled.render, fnGenErrors);
  55262. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55263. return createFunction(code, fnGenErrors)
  55264. });
  55265. // check function generation errors.
  55266. // this should only happen if there is a bug in the compiler itself.
  55267. // mostly for codegen development use
  55268. /* istanbul ignore if */
  55269. {
  55270. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55271. warn$$1(
  55272. "Failed to generate render function:\n\n" +
  55273. fnGenErrors.map(function (ref) {
  55274. var err = ref.err;
  55275. var code = ref.code;
  55276. return ((err.toString()) + " in\n\n" + code + "\n");
  55277. }).join('\n'),
  55278. vm
  55279. );
  55280. }
  55281. }
  55282. return (cache[key] = res)
  55283. }
  55284. }
  55285. /* */
  55286. function createCompilerCreator (baseCompile) {
  55287. return function createCompiler (baseOptions) {
  55288. function compile (
  55289. template,
  55290. options
  55291. ) {
  55292. var finalOptions = Object.create(baseOptions);
  55293. var errors = [];
  55294. var tips = [];
  55295. var warn = function (msg, range, tip) {
  55296. (tip ? tips : errors).push(msg);
  55297. };
  55298. if (options) {
  55299. if (options.outputSourceRange) {
  55300. // $flow-disable-line
  55301. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55302. warn = function (msg, range, tip) {
  55303. var data = { msg: msg };
  55304. if (range) {
  55305. if (range.start != null) {
  55306. data.start = range.start + leadingSpaceLength;
  55307. }
  55308. if (range.end != null) {
  55309. data.end = range.end + leadingSpaceLength;
  55310. }
  55311. }
  55312. (tip ? tips : errors).push(data);
  55313. };
  55314. }
  55315. // merge custom modules
  55316. if (options.modules) {
  55317. finalOptions.modules =
  55318. (baseOptions.modules || []).concat(options.modules);
  55319. }
  55320. // merge custom directives
  55321. if (options.directives) {
  55322. finalOptions.directives = extend(
  55323. Object.create(baseOptions.directives || null),
  55324. options.directives
  55325. );
  55326. }
  55327. // copy other options
  55328. for (var key in options) {
  55329. if (key !== 'modules' && key !== 'directives') {
  55330. finalOptions[key] = options[key];
  55331. }
  55332. }
  55333. }
  55334. finalOptions.warn = warn;
  55335. var compiled = baseCompile(template.trim(), finalOptions);
  55336. {
  55337. detectErrors(compiled.ast, warn);
  55338. }
  55339. compiled.errors = errors;
  55340. compiled.tips = tips;
  55341. return compiled
  55342. }
  55343. return {
  55344. compile: compile,
  55345. compileToFunctions: createCompileToFunctionFn(compile)
  55346. }
  55347. }
  55348. }
  55349. /* */
  55350. // `createCompilerCreator` allows creating compilers that use alternative
  55351. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55352. // Here we just export a default compiler using the default parts.
  55353. var createCompiler = createCompilerCreator(function baseCompile (
  55354. template,
  55355. options
  55356. ) {
  55357. var ast = parse(template.trim(), options);
  55358. if (options.optimize !== false) {
  55359. optimize(ast, options);
  55360. }
  55361. var code = generate(ast, options);
  55362. return {
  55363. ast: ast,
  55364. render: code.render,
  55365. staticRenderFns: code.staticRenderFns
  55366. }
  55367. });
  55368. /* */
  55369. var ref$1 = createCompiler(baseOptions);
  55370. var compile = ref$1.compile;
  55371. var compileToFunctions = ref$1.compileToFunctions;
  55372. /* */
  55373. // check whether current browser encodes a char inside attribute values
  55374. var div;
  55375. function getShouldDecode (href) {
  55376. div = div || document.createElement('div');
  55377. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55378. return div.innerHTML.indexOf('&#10;') > 0
  55379. }
  55380. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55381. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55382. // #6828: chrome encodes content in a[href]
  55383. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55384. /* */
  55385. var idToTemplate = cached(function (id) {
  55386. var el = query(id);
  55387. return el && el.innerHTML
  55388. });
  55389. var mount = Vue.prototype.$mount;
  55390. Vue.prototype.$mount = function (
  55391. el,
  55392. hydrating
  55393. ) {
  55394. el = el && query(el);
  55395. /* istanbul ignore if */
  55396. if (el === document.body || el === document.documentElement) {
  55397. warn(
  55398. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55399. );
  55400. return this
  55401. }
  55402. var options = this.$options;
  55403. // resolve template/el and convert to render function
  55404. if (!options.render) {
  55405. var template = options.template;
  55406. if (template) {
  55407. if (typeof template === 'string') {
  55408. if (template.charAt(0) === '#') {
  55409. template = idToTemplate(template);
  55410. /* istanbul ignore if */
  55411. if (!template) {
  55412. warn(
  55413. ("Template element not found or is empty: " + (options.template)),
  55414. this
  55415. );
  55416. }
  55417. }
  55418. } else if (template.nodeType) {
  55419. template = template.innerHTML;
  55420. } else {
  55421. {
  55422. warn('invalid template option:' + template, this);
  55423. }
  55424. return this
  55425. }
  55426. } else if (el) {
  55427. template = getOuterHTML(el);
  55428. }
  55429. if (template) {
  55430. /* istanbul ignore if */
  55431. if (config.performance && mark) {
  55432. mark('compile');
  55433. }
  55434. var ref = compileToFunctions(template, {
  55435. outputSourceRange: "development" !== 'production',
  55436. shouldDecodeNewlines: shouldDecodeNewlines,
  55437. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55438. delimiters: options.delimiters,
  55439. comments: options.comments
  55440. }, this);
  55441. var render = ref.render;
  55442. var staticRenderFns = ref.staticRenderFns;
  55443. options.render = render;
  55444. options.staticRenderFns = staticRenderFns;
  55445. /* istanbul ignore if */
  55446. if (config.performance && mark) {
  55447. mark('compile end');
  55448. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55449. }
  55450. }
  55451. }
  55452. return mount.call(this, el, hydrating)
  55453. };
  55454. /**
  55455. * Get outerHTML of elements, taking care
  55456. * of SVG elements in IE as well.
  55457. */
  55458. function getOuterHTML (el) {
  55459. if (el.outerHTML) {
  55460. return el.outerHTML
  55461. } else {
  55462. var container = document.createElement('div');
  55463. container.appendChild(el.cloneNode(true));
  55464. return container.innerHTML
  55465. }
  55466. }
  55467. Vue.compile = compileToFunctions;
  55468. module.exports = Vue;
  55469. /* 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))
  55470. /***/ }),
  55471. /***/ "./node_modules/vue/dist/vue.common.js":
  55472. /*!*********************************************!*\
  55473. !*** ./node_modules/vue/dist/vue.common.js ***!
  55474. \*********************************************/
  55475. /*! no static exports found */
  55476. /***/ (function(module, exports, __webpack_require__) {
  55477. if (false) {} else {
  55478. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55479. }
  55480. /***/ }),
  55481. /***/ "./node_modules/webpack/buildin/global.js":
  55482. /*!***********************************!*\
  55483. !*** (webpack)/buildin/global.js ***!
  55484. \***********************************/
  55485. /*! no static exports found */
  55486. /***/ (function(module, exports) {
  55487. var g;
  55488. // This works in non-strict mode
  55489. g = (function() {
  55490. return this;
  55491. })();
  55492. try {
  55493. // This works if eval is allowed (see CSP)
  55494. g = g || new Function("return this")();
  55495. } catch (e) {
  55496. // This works if the window reference is available
  55497. if (typeof window === "object") g = window;
  55498. }
  55499. // g can still be undefined, but nothing to do about it...
  55500. // We return undefined, instead of nothing here, so it's
  55501. // easier to handle this case. if(!global) { ...}
  55502. module.exports = g;
  55503. /***/ }),
  55504. /***/ "./node_modules/webpack/buildin/module.js":
  55505. /*!***********************************!*\
  55506. !*** (webpack)/buildin/module.js ***!
  55507. \***********************************/
  55508. /*! no static exports found */
  55509. /***/ (function(module, exports) {
  55510. module.exports = function(module) {
  55511. if (!module.webpackPolyfill) {
  55512. module.deprecate = function() {};
  55513. module.paths = [];
  55514. // module.parent = undefined by default
  55515. if (!module.children) module.children = [];
  55516. Object.defineProperty(module, "loaded", {
  55517. enumerable: true,
  55518. get: function() {
  55519. return module.l;
  55520. }
  55521. });
  55522. Object.defineProperty(module, "id", {
  55523. enumerable: true,
  55524. get: function() {
  55525. return module.i;
  55526. }
  55527. });
  55528. module.webpackPolyfill = 1;
  55529. }
  55530. return module;
  55531. };
  55532. /***/ }),
  55533. /***/ "./resources/js/app.js":
  55534. /*!*****************************!*\
  55535. !*** ./resources/js/app.js ***!
  55536. \*****************************/
  55537. /*! no static exports found */
  55538. /***/ (function(module, exports, __webpack_require__) {
  55539. /**
  55540. * First we will load all of this project's JavaScript dependencies which
  55541. * includes Vue and other libraries. It is a great starting point when
  55542. * building robust, powerful web applications using Vue and Laravel.
  55543. */
  55544. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55545. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55546. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55547. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55548. /**
  55549. * The following block of code may be used to automatically register your
  55550. * Vue components. It will recursively scan this directory for the Vue
  55551. * components and automatically register them with their "basename".
  55552. *
  55553. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55554. */
  55555. // const files = require.context('./', true, /\.vue$/i)
  55556. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55557. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55558. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55559. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55560. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55561. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55562. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55563. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55564. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55565. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55566. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55567. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55568. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55569. /**
  55570. * Next, we will create a fresh Vue application instance and attach it to
  55571. * the page. Then, you may begin adding components to this application
  55572. * or customize the JavaScript scaffolding to fit your unique needs.
  55573. */
  55574. var app = new Vue({
  55575. el: '#app'
  55576. });
  55577. $(function () {
  55578. $('[data-toggle="tooltip"]').tooltip();
  55579. });
  55580. var clipboard = new Clipboard('.btn-clip');
  55581. clipboard.on('success', function (e) {
  55582. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55583. position: "right",
  55584. className: 'success'
  55585. });
  55586. e.clearSelection();
  55587. });
  55588. /***/ }),
  55589. /***/ "./resources/js/bootstrap.js":
  55590. /*!***********************************!*\
  55591. !*** ./resources/js/bootstrap.js ***!
  55592. \***********************************/
  55593. /*! no exports provided */
  55594. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55595. "use strict";
  55596. __webpack_require__.r(__webpack_exports__);
  55597. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55598. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55599. /**
  55600. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55601. * for JavaScript based Bootstrap features such as modals and tabs. This
  55602. * code may be modified to fit the specific needs of your application.
  55603. */
  55604. try {
  55605. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55606. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55607. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55608. } catch (e) {}
  55609. /**
  55610. * We'll load the axios HTTP library which allows us to easily issue requests
  55611. * to our Laravel back-end. This library automatically handles sending the
  55612. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55613. */
  55614. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55615. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55616. /**
  55617. * Echo exposes an expressive API for subscribing to channels and listening
  55618. * for events that are broadcast by Laravel. Echo and event broadcasting
  55619. * allows your team to easily build robust real-time web applications.
  55620. */
  55621. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55622. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55623. broadcaster: 'pusher',
  55624. key: "upccrt",
  55625. authEndpoint: '/broadcasting/auth',
  55626. wsHost: window.location.hostname,
  55627. wsPort: 6001,
  55628. disableStats: true
  55629. });
  55630. /***/ }),
  55631. /***/ "./resources/js/components/ExampleComponent.vue":
  55632. /*!******************************************************!*\
  55633. !*** ./resources/js/components/ExampleComponent.vue ***!
  55634. \******************************************************/
  55635. /*! exports provided: default */
  55636. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55637. "use strict";
  55638. __webpack_require__.r(__webpack_exports__);
  55639. /* 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&");
  55640. /* 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&");
  55641. /* 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");
  55642. /* normalize component */
  55643. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55644. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55645. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55646. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55647. false,
  55648. null,
  55649. null,
  55650. null
  55651. )
  55652. /* hot reload */
  55653. if (false) { var api; }
  55654. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55655. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55656. /***/ }),
  55657. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55658. /*!*******************************************************************************!*\
  55659. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55660. \*******************************************************************************/
  55661. /*! exports provided: default */
  55662. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55663. "use strict";
  55664. __webpack_require__.r(__webpack_exports__);
  55665. /* 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&");
  55666. /* 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"]);
  55667. /***/ }),
  55668. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55669. /*!*************************************************************************************!*\
  55670. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55671. \*************************************************************************************/
  55672. /*! exports provided: render, staticRenderFns */
  55673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55674. "use strict";
  55675. __webpack_require__.r(__webpack_exports__);
  55676. /* 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&");
  55677. /* 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"]; });
  55678. /* 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"]; });
  55679. /***/ }),
  55680. /***/ "./resources/js/components/assetinfo.vue":
  55681. /*!***********************************************!*\
  55682. !*** ./resources/js/components/assetinfo.vue ***!
  55683. \***********************************************/
  55684. /*! exports provided: default */
  55685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55686. "use strict";
  55687. __webpack_require__.r(__webpack_exports__);
  55688. /* 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&");
  55689. /* 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&");
  55690. /* 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");
  55691. /* normalize component */
  55692. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55693. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55694. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55695. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55696. false,
  55697. null,
  55698. null,
  55699. null
  55700. )
  55701. /* hot reload */
  55702. if (false) { var api; }
  55703. component.options.__file = "resources/js/components/assetinfo.vue"
  55704. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55705. /***/ }),
  55706. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55707. /*!************************************************************************!*\
  55708. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55709. \************************************************************************/
  55710. /*! exports provided: default */
  55711. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55712. "use strict";
  55713. __webpack_require__.r(__webpack_exports__);
  55714. /* 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&");
  55715. /* 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"]);
  55716. /***/ }),
  55717. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55718. /*!******************************************************************************!*\
  55719. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55720. \******************************************************************************/
  55721. /*! exports provided: render, staticRenderFns */
  55722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55723. "use strict";
  55724. __webpack_require__.r(__webpack_exports__);
  55725. /* 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&");
  55726. /* 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"]; });
  55727. /* 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"]; });
  55728. /***/ }),
  55729. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55730. /*!******************************************************************!*\
  55731. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55732. \******************************************************************/
  55733. /*! exports provided: default */
  55734. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55735. "use strict";
  55736. __webpack_require__.r(__webpack_exports__);
  55737. /* 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&");
  55738. /* 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&");
  55739. /* 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");
  55740. /* normalize component */
  55741. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55742. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55743. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55744. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55745. false,
  55746. null,
  55747. null,
  55748. null
  55749. )
  55750. /* hot reload */
  55751. if (false) { var api; }
  55752. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55753. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55754. /***/ }),
  55755. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55756. /*!*******************************************************************************************!*\
  55757. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55758. \*******************************************************************************************/
  55759. /*! exports provided: default */
  55760. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55761. "use strict";
  55762. __webpack_require__.r(__webpack_exports__);
  55763. /* 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&");
  55764. /* 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"]);
  55765. /***/ }),
  55766. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55767. /*!*************************************************************************************************!*\
  55768. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55769. \*************************************************************************************************/
  55770. /*! exports provided: render, staticRenderFns */
  55771. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55772. "use strict";
  55773. __webpack_require__.r(__webpack_exports__);
  55774. /* 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&");
  55775. /* 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"]; });
  55776. /* 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"]; });
  55777. /***/ }),
  55778. /***/ "./resources/js/components/credential-form-modal.vue":
  55779. /*!***********************************************************!*\
  55780. !*** ./resources/js/components/credential-form-modal.vue ***!
  55781. \***********************************************************/
  55782. /*! exports provided: default */
  55783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55784. "use strict";
  55785. __webpack_require__.r(__webpack_exports__);
  55786. /* 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&");
  55787. /* 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&");
  55788. /* 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");
  55789. /* normalize component */
  55790. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55791. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55792. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55793. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55794. false,
  55795. null,
  55796. null,
  55797. null
  55798. )
  55799. /* hot reload */
  55800. if (false) { var api; }
  55801. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55802. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55803. /***/ }),
  55804. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55805. /*!************************************************************************************!*\
  55806. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55807. \************************************************************************************/
  55808. /*! exports provided: default */
  55809. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55810. "use strict";
  55811. __webpack_require__.r(__webpack_exports__);
  55812. /* 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&");
  55813. /* 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"]);
  55814. /***/ }),
  55815. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55816. /*!******************************************************************************************!*\
  55817. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55818. \******************************************************************************************/
  55819. /*! exports provided: render, staticRenderFns */
  55820. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55821. "use strict";
  55822. __webpack_require__.r(__webpack_exports__);
  55823. /* 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&");
  55824. /* 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"]; });
  55825. /* 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"]; });
  55826. /***/ }),
  55827. /***/ "./resources/js/components/credential-list.vue":
  55828. /*!*****************************************************!*\
  55829. !*** ./resources/js/components/credential-list.vue ***!
  55830. \*****************************************************/
  55831. /*! exports provided: default */
  55832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55833. "use strict";
  55834. __webpack_require__.r(__webpack_exports__);
  55835. /* 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&");
  55836. /* 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&");
  55837. /* 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");
  55838. /* normalize component */
  55839. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55840. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55841. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55842. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55843. false,
  55844. null,
  55845. null,
  55846. null
  55847. )
  55848. /* hot reload */
  55849. if (false) { var api; }
  55850. component.options.__file = "resources/js/components/credential-list.vue"
  55851. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55852. /***/ }),
  55853. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55854. /*!******************************************************************************!*\
  55855. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55856. \******************************************************************************/
  55857. /*! exports provided: default */
  55858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55859. "use strict";
  55860. __webpack_require__.r(__webpack_exports__);
  55861. /* 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&");
  55862. /* 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"]);
  55863. /***/ }),
  55864. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55865. /*!************************************************************************************!*\
  55866. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55867. \************************************************************************************/
  55868. /*! exports provided: render, staticRenderFns */
  55869. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55870. "use strict";
  55871. __webpack_require__.r(__webpack_exports__);
  55872. /* 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&");
  55873. /* 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"]; });
  55874. /* 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"]; });
  55875. /***/ }),
  55876. /***/ "./resources/js/components/credential.vue":
  55877. /*!************************************************!*\
  55878. !*** ./resources/js/components/credential.vue ***!
  55879. \************************************************/
  55880. /*! exports provided: default */
  55881. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55882. "use strict";
  55883. __webpack_require__.r(__webpack_exports__);
  55884. /* 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&");
  55885. /* 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&");
  55886. /* 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");
  55887. /* normalize component */
  55888. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55889. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55890. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55891. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55892. false,
  55893. null,
  55894. null,
  55895. null
  55896. )
  55897. /* hot reload */
  55898. if (false) { var api; }
  55899. component.options.__file = "resources/js/components/credential.vue"
  55900. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55901. /***/ }),
  55902. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55903. /*!*************************************************************************!*\
  55904. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55905. \*************************************************************************/
  55906. /*! exports provided: default */
  55907. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55908. "use strict";
  55909. __webpack_require__.r(__webpack_exports__);
  55910. /* 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&");
  55911. /* 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"]);
  55912. /***/ }),
  55913. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55914. /*!*******************************************************************************!*\
  55915. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55916. \*******************************************************************************/
  55917. /*! exports provided: render, staticRenderFns */
  55918. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55919. "use strict";
  55920. __webpack_require__.r(__webpack_exports__);
  55921. /* 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&");
  55922. /* 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"]; });
  55923. /* 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"]; });
  55924. /***/ }),
  55925. /***/ "./resources/js/components/errorlist.vue":
  55926. /*!***********************************************!*\
  55927. !*** ./resources/js/components/errorlist.vue ***!
  55928. \***********************************************/
  55929. /*! exports provided: default */
  55930. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55931. "use strict";
  55932. __webpack_require__.r(__webpack_exports__);
  55933. /* 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&");
  55934. /* 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&");
  55935. /* 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");
  55936. /* normalize component */
  55937. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55938. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55939. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55940. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55941. false,
  55942. null,
  55943. null,
  55944. null
  55945. )
  55946. /* hot reload */
  55947. if (false) { var api; }
  55948. component.options.__file = "resources/js/components/errorlist.vue"
  55949. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55950. /***/ }),
  55951. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55952. /*!************************************************************************!*\
  55953. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55954. \************************************************************************/
  55955. /*! exports provided: default */
  55956. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55957. "use strict";
  55958. __webpack_require__.r(__webpack_exports__);
  55959. /* 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&");
  55960. /* 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"]);
  55961. /***/ }),
  55962. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55963. /*!******************************************************************************!*\
  55964. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55965. \******************************************************************************/
  55966. /*! exports provided: render, staticRenderFns */
  55967. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55968. "use strict";
  55969. __webpack_require__.r(__webpack_exports__);
  55970. /* 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&");
  55971. /* 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"]; });
  55972. /* 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"]; });
  55973. /***/ }),
  55974. /***/ "./resources/js/components/modal.vue":
  55975. /*!*******************************************!*\
  55976. !*** ./resources/js/components/modal.vue ***!
  55977. \*******************************************/
  55978. /*! exports provided: default */
  55979. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55980. "use strict";
  55981. __webpack_require__.r(__webpack_exports__);
  55982. /* 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&");
  55983. /* 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");
  55984. var script = {}
  55985. /* normalize component */
  55986. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55987. script,
  55988. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55989. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55990. false,
  55991. null,
  55992. null,
  55993. null
  55994. )
  55995. /* hot reload */
  55996. if (false) { var api; }
  55997. component.options.__file = "resources/js/components/modal.vue"
  55998. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55999. /***/ }),
  56000. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  56001. /*!**************************************************************************!*\
  56002. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  56003. \**************************************************************************/
  56004. /*! exports provided: render, staticRenderFns */
  56005. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56006. "use strict";
  56007. __webpack_require__.r(__webpack_exports__);
  56008. /* 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&");
  56009. /* 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"]; });
  56010. /* 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"]; });
  56011. /***/ }),
  56012. /***/ "./resources/js/components/note-form-modal.vue":
  56013. /*!*****************************************************!*\
  56014. !*** ./resources/js/components/note-form-modal.vue ***!
  56015. \*****************************************************/
  56016. /*! exports provided: default */
  56017. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56018. "use strict";
  56019. __webpack_require__.r(__webpack_exports__);
  56020. /* harmony import */ var _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=template&id=0435c624& */ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56021. /* harmony import */ var _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&");
  56022. /* 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");
  56023. /* normalize component */
  56024. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56025. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56026. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56027. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56028. false,
  56029. null,
  56030. null,
  56031. null
  56032. )
  56033. /* hot reload */
  56034. if (false) { var api; }
  56035. component.options.__file = "resources/js/components/note-form-modal.vue"
  56036. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56037. /***/ }),
  56038. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56039. /*!******************************************************************************!*\
  56040. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56041. \******************************************************************************/
  56042. /*! exports provided: default */
  56043. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56044. "use strict";
  56045. __webpack_require__.r(__webpack_exports__);
  56046. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_note_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!./note-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/note-form-modal.vue?vue&type=script&lang=js&");
  56047. /* 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_note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  56048. /***/ }),
  56049. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56050. /*!************************************************************************************!*\
  56051. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56052. \************************************************************************************/
  56053. /*! exports provided: render, staticRenderFns */
  56054. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56055. "use strict";
  56056. __webpack_require__.r(__webpack_exports__);
  56057. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_template_id_0435c624___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!./note-form-modal.vue?vue&type=template&id=0435c624& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56058. /* 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_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  56059. /* 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_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  56060. /***/ }),
  56061. /***/ "./resources/js/components/notes.vue":
  56062. /*!*******************************************!*\
  56063. !*** ./resources/js/components/notes.vue ***!
  56064. \*******************************************/
  56065. /*! exports provided: default */
  56066. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56067. "use strict";
  56068. __webpack_require__.r(__webpack_exports__);
  56069. /* 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&");
  56070. /* 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&");
  56071. /* 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");
  56072. /* normalize component */
  56073. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56074. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56075. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56076. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56077. false,
  56078. null,
  56079. null,
  56080. null
  56081. )
  56082. /* hot reload */
  56083. if (false) { var api; }
  56084. component.options.__file = "resources/js/components/notes.vue"
  56085. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56086. /***/ }),
  56087. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56088. /*!********************************************************************!*\
  56089. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56090. \********************************************************************/
  56091. /*! exports provided: default */
  56092. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56093. "use strict";
  56094. __webpack_require__.r(__webpack_exports__);
  56095. /* 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&");
  56096. /* 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"]);
  56097. /***/ }),
  56098. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56099. /*!**************************************************************************!*\
  56100. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56101. \**************************************************************************/
  56102. /*! exports provided: render, staticRenderFns */
  56103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56104. "use strict";
  56105. __webpack_require__.r(__webpack_exports__);
  56106. /* 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&");
  56107. /* 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"]; });
  56108. /* 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"]; });
  56109. /***/ }),
  56110. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56111. /*!*******************************************************!*\
  56112. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56113. \*******************************************************/
  56114. /*! exports provided: default */
  56115. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56116. "use strict";
  56117. __webpack_require__.r(__webpack_exports__);
  56118. /* 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&");
  56119. /* 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&");
  56120. /* 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");
  56121. /* normalize component */
  56122. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56123. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56124. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56125. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56126. false,
  56127. null,
  56128. null,
  56129. null
  56130. )
  56131. /* hot reload */
  56132. if (false) { var api; }
  56133. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56134. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56135. /***/ }),
  56136. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56137. /*!********************************************************************************!*\
  56138. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56139. \********************************************************************************/
  56140. /*! exports provided: default */
  56141. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56142. "use strict";
  56143. __webpack_require__.r(__webpack_exports__);
  56144. /* 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&");
  56145. /* 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"]);
  56146. /***/ }),
  56147. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56148. /*!**************************************************************************************!*\
  56149. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56150. \**************************************************************************************/
  56151. /*! exports provided: render, staticRenderFns */
  56152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56153. "use strict";
  56154. __webpack_require__.r(__webpack_exports__);
  56155. /* 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&");
  56156. /* 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"]; });
  56157. /* 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"]; });
  56158. /***/ }),
  56159. /***/ "./resources/js/components/woinfo.vue":
  56160. /*!********************************************!*\
  56161. !*** ./resources/js/components/woinfo.vue ***!
  56162. \********************************************/
  56163. /*! exports provided: default */
  56164. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56165. "use strict";
  56166. __webpack_require__.r(__webpack_exports__);
  56167. /* 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&");
  56168. /* 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&");
  56169. /* 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");
  56170. /* normalize component */
  56171. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56172. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56173. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56174. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56175. false,
  56176. null,
  56177. null,
  56178. null
  56179. )
  56180. /* hot reload */
  56181. if (false) { var api; }
  56182. component.options.__file = "resources/js/components/woinfo.vue"
  56183. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56184. /***/ }),
  56185. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56186. /*!*********************************************************************!*\
  56187. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56188. \*********************************************************************/
  56189. /*! exports provided: default */
  56190. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56191. "use strict";
  56192. __webpack_require__.r(__webpack_exports__);
  56193. /* 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&");
  56194. /* 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"]);
  56195. /***/ }),
  56196. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56197. /*!***************************************************************************!*\
  56198. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56199. \***************************************************************************/
  56200. /*! exports provided: render, staticRenderFns */
  56201. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56202. "use strict";
  56203. __webpack_require__.r(__webpack_exports__);
  56204. /* 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&");
  56205. /* 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"]; });
  56206. /* 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"]; });
  56207. /***/ }),
  56208. /***/ "./resources/js/mixins/dateMixin.js":
  56209. /*!******************************************!*\
  56210. !*** ./resources/js/mixins/dateMixin.js ***!
  56211. \******************************************/
  56212. /*! exports provided: default */
  56213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56214. "use strict";
  56215. __webpack_require__.r(__webpack_exports__);
  56216. /* harmony default export */ __webpack_exports__["default"] = ({
  56217. methods: {
  56218. treatAsUTC: function treatAsUTC(date) {
  56219. var result = new Date(date);
  56220. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56221. return result;
  56222. },
  56223. daysSinceToday: function daysSinceToday(date) {
  56224. var currentDate = new Date();
  56225. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56226. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56227. },
  56228. getHRDate: function getHRDate(dateString) {
  56229. var date = new Date(dateString);
  56230. return date.toLocaleString('default', {
  56231. month: 'short',
  56232. day: 'numeric',
  56233. year: 'numeric',
  56234. hour: 'numeric',
  56235. minute: 'numeric'
  56236. });
  56237. },
  56238. isZero: function isZero(dateString) {
  56239. return dateString === '0000-00-00 00:00:00';
  56240. }
  56241. }
  56242. });
  56243. /***/ }),
  56244. /***/ "./resources/js/notify.min.js":
  56245. /*!************************************!*\
  56246. !*** ./resources/js/notify.min.js ***!
  56247. \************************************/
  56248. /*! no static exports found */
  56249. /***/ (function(module, exports, __webpack_require__) {
  56250. 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); }
  56251. (function (e) {
  56252. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56253. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56254. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56255. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56256. })(function (e) {
  56257. function A(t, n, i) {
  56258. typeof i == "string" && (i = {
  56259. className: i
  56260. }), 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);
  56261. }
  56262. var t = [].indexOf || function (e) {
  56263. for (var t = 0, n = this.length; t < n; t++) {
  56264. if (t in this && this[t] === e) return t;
  56265. }
  56266. return -1;
  56267. },
  56268. n = "notify",
  56269. r = n + "js",
  56270. i = n + "!blank",
  56271. s = {
  56272. t: "top",
  56273. m: "middle",
  56274. b: "bottom",
  56275. l: "left",
  56276. c: "center",
  56277. r: "right"
  56278. },
  56279. o = ["l", "c", "r"],
  56280. u = ["t", "m", "b"],
  56281. a = ["t", "b", "l", "r"],
  56282. f = {
  56283. t: "b",
  56284. m: null,
  56285. b: "t",
  56286. l: "r",
  56287. c: null,
  56288. r: "l"
  56289. },
  56290. l = function l(t) {
  56291. var n;
  56292. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56293. var r;
  56294. r = t.toLowerCase().charAt(0);
  56295. if (s[r]) return n.push(r);
  56296. }), n;
  56297. },
  56298. c = {},
  56299. h = {
  56300. name: "core",
  56301. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56302. 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}"
  56303. },
  56304. p = {
  56305. "border-radius": ["-webkit-", "-moz-"]
  56306. },
  56307. d = function d(e) {
  56308. return c[e];
  56309. },
  56310. v = function v(e) {
  56311. if (!e) throw "Missing Style name";
  56312. c[e] && delete c[e];
  56313. },
  56314. m = function m(t, i) {
  56315. if (!t) throw "Missing Style name";
  56316. if (!i) throw "Missing Style definition";
  56317. if (!i.html) throw "Missing Style HTML";
  56318. var s = c[t];
  56319. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56320. var o = "";
  56321. i.classes && e.each(i.classes, function (t, n) {
  56322. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56323. return p[t] && e.each(p[t], function (e, r) {
  56324. return o += " " + r + t + ": " + n + ";\n";
  56325. }), o += " " + t + ": " + n + ";\n";
  56326. }), o += "}\n";
  56327. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56328. var u = {},
  56329. a = e(i.html);
  56330. y("html", a, u), y("text", a, u), i.fields = u;
  56331. },
  56332. g = function g(t) {
  56333. var n, r, i;
  56334. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56335. try {
  56336. r.html(t);
  56337. } catch (s) {
  56338. r[0].styleSheet.cssText = t;
  56339. }
  56340. return r;
  56341. },
  56342. y = function y(t, n, r) {
  56343. var s;
  56344. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56345. var n;
  56346. n = e(this).attr(s), n || (n = i), r[n] = t;
  56347. });
  56348. },
  56349. b = function b(e, t) {
  56350. return e.is(t) ? e : e.find(t);
  56351. },
  56352. w = {
  56353. clickToHide: !0,
  56354. autoHide: !0,
  56355. autoHideDelay: 5e3,
  56356. arrowShow: !0,
  56357. arrowSize: 5,
  56358. breakNewLines: !0,
  56359. elementPosition: "bottom",
  56360. globalPosition: "top right",
  56361. style: "bootstrap",
  56362. className: "error",
  56363. showAnimation: "slideDown",
  56364. showDuration: 400,
  56365. hideAnimation: "slideUp",
  56366. hideDuration: 200,
  56367. gap: 5
  56368. },
  56369. E = function E(t, n) {
  56370. var r;
  56371. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56372. },
  56373. S = function S(t) {
  56374. return e.extend(w, t);
  56375. },
  56376. x = function x(t) {
  56377. return e("<" + t + "></" + t + ">");
  56378. },
  56379. T = {},
  56380. N = function N(t) {
  56381. var n;
  56382. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56383. return e(r).attr("name") === t.attr("name");
  56384. }), t = n.first()), t;
  56385. },
  56386. C = function C(e, t, n) {
  56387. var r, i;
  56388. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56389. if (isNaN(n)) return;
  56390. 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;
  56391. },
  56392. k = function k(e, t, n) {
  56393. if (e === "l" || e === "t") return 0;
  56394. if (e === "c" || e === "m") return n / 2 - t / 2;
  56395. if (e === "r" || e === "b") return n - t;
  56396. throw "Invalid alignment";
  56397. },
  56398. L = function L(e) {
  56399. return L.e = L.e || x("div"), L.e.text(e).html();
  56400. };
  56401. A.prototype.loadHTML = function () {
  56402. var t;
  56403. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56404. }, A.prototype.show = function (e, t) {
  56405. var n, r, i, s, o;
  56406. r = function (n) {
  56407. return function () {
  56408. !e && !n.elem && n.destroy();
  56409. if (t) return t();
  56410. };
  56411. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56412. 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 {
  56413. if (!!o || !!e) return r();
  56414. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56415. }
  56416. return n.push(r), i[s].apply(i, n);
  56417. }, A.prototype.setGlobalPosition = function () {
  56418. var t = this.getPosition(),
  56419. n = t[0],
  56420. i = t[1],
  56421. o = s[n],
  56422. u = s[i],
  56423. a = n + "|" + i,
  56424. f = T[a];
  56425. if (!f || !document.body.contains(f[0])) {
  56426. f = T[a] = x("div");
  56427. var l = {};
  56428. 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);
  56429. }
  56430. return f.prepend(this.wrapper);
  56431. }, A.prototype.setElementPosition = function () {
  56432. 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;
  56433. 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"];
  56434. for (w = 0, S = B.length; w < S; w++) {
  56435. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56436. }
  56437. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56438. if (!this.options.arrowShow) this.arrow.hide();else {
  56439. 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";
  56440. for (E = 0, x = a.length; E < x; E++) {
  56441. D = a[E], P = s[D];
  56442. if (D === L) continue;
  56443. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56444. }
  56445. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56446. }
  56447. 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);
  56448. if (r) return this.arrow.removeAttr("style").css(r);
  56449. }, A.prototype.getPosition = function () {
  56450. var e, n, r, i, s, f, c, h;
  56451. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56452. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56453. 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";
  56454. return e.length === 2 && (e[2] = e[1]), e;
  56455. }, A.prototype.getStyle = function (e) {
  56456. var t;
  56457. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56458. if (!t) throw "Missing style: " + e;
  56459. return t;
  56460. }, A.prototype.updateClasses = function () {
  56461. var t, n;
  56462. 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) {
  56463. return r + "-" + n.name + "-" + e;
  56464. }).join(" "), this.userContainer.attr("class", t);
  56465. }, A.prototype.run = function (t, n) {
  56466. var r, s, o, u, a;
  56467. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56468. if (this.container && !t) {
  56469. this.show(!1);
  56470. return;
  56471. }
  56472. if (!this.container && !t) return;
  56473. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56474. for (o in s) {
  56475. r = s[o], u = this.userFields[o];
  56476. if (!u) continue;
  56477. 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);
  56478. }
  56479. 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));
  56480. }, A.prototype.destroy = function () {
  56481. this.wrapper.data(r, null), this.wrapper.remove();
  56482. }, e[n] = function (t, r, i) {
  56483. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56484. }, e.fn[n] = function (t, n) {
  56485. return e(this).each(function () {
  56486. var i = N(e(this)).data(r);
  56487. i && i.destroy();
  56488. var s = new A(e(this), t, n);
  56489. }), this;
  56490. }, e.extend(e[n], {
  56491. defaults: S,
  56492. addStyle: m,
  56493. removeStyle: v,
  56494. pluginOptions: w,
  56495. getStyle: d,
  56496. insertCSS: g
  56497. }), m("bootstrap", {
  56498. html: "<div>\n<span data-notify-text></span>\n</div>",
  56499. classes: {
  56500. base: {
  56501. "font-weight": "bold",
  56502. padding: "8px 15px 8px 14px",
  56503. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56504. "background-color": "#fcf8e3",
  56505. border: "1px solid #fbeed5",
  56506. "border-radius": "4px",
  56507. "white-space": "nowrap",
  56508. "padding-left": "25px",
  56509. "background-repeat": "no-repeat",
  56510. "background-position": "3px 7px"
  56511. },
  56512. error: {
  56513. color: "#B94A48",
  56514. "background-color": "#F2DEDE",
  56515. "border-color": "#EED3D7",
  56516. "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=)"
  56517. },
  56518. success: {
  56519. color: "#468847",
  56520. "background-color": "#DFF0D8",
  56521. "border-color": "#D6E9C6",
  56522. "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==)"
  56523. },
  56524. info: {
  56525. color: "#3A87AD",
  56526. "background-color": "#D9EDF7",
  56527. "border-color": "#BCE8F1",
  56528. "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=)"
  56529. },
  56530. warn: {
  56531. color: "#C09853",
  56532. "background-color": "#FCF8E3",
  56533. "border-color": "#FBEED5",
  56534. "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)"
  56535. }
  56536. }
  56537. }), e(function () {
  56538. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56539. e(this).trigger("notify-hide");
  56540. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56541. var n = e(this).data(r);
  56542. n && n.show(!1);
  56543. });
  56544. });
  56545. });
  56546. /***/ }),
  56547. /***/ "./resources/sass/app.scss":
  56548. /*!*********************************!*\
  56549. !*** ./resources/sass/app.scss ***!
  56550. \*********************************/
  56551. /*! no static exports found */
  56552. /***/ (function(module, exports) {
  56553. // removed by extract-text-webpack-plugin
  56554. /***/ }),
  56555. /***/ 0:
  56556. /*!*************************************************************!*\
  56557. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56558. \*************************************************************/
  56559. /*! no static exports found */
  56560. /***/ (function(module, exports, __webpack_require__) {
  56561. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56562. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56563. /***/ })
  56564. /******/ });